This repository has been archived by the owner on Nov 3, 2021. It is now read-only.
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #16109 from desaintmartin/952912
Bug 952912 - System update check for NOFTU build, r=alive
- Loading branch information
Showing
6 changed files
with
160 additions
and
13 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,97 @@ | ||
/* -*- Mode: Java; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- / | ||
/* vim: set shiftwidth=2 tabstop=2 autoindent cindent expandtab: */ | ||
|
||
/*global MockNavigatormozApps, MockNavigatorSettings, MocksHelper*/ | ||
|
||
'use strict'; | ||
|
||
requireApp('system/shared/test/unit/mocks/mock_navigator_moz_apps.js'); | ||
requireApp('system/shared/test/unit/mocks/mock_navigator_moz_settings.js'); | ||
requireApp('system/shared/test/unit/mocks/mock_settings_listener.js'); | ||
requireApp('system/shared/test/unit/mocks/mock_settings_url.js'); | ||
requireApp('system/test/unit/mock_applications.js'); | ||
requireApp('system/test/unit/mock_ftu_launcher.js'); | ||
requireApp('system/test/unit/mock_homescreen_launcher.js'); | ||
requireApp('system/test/unit/mock_places.js'); | ||
requireApp('system/test/unit/mock_screen_manager.js'); | ||
requireApp('system/test/unit/mock_source_view.js'); | ||
|
||
mocha.globals([ | ||
'Shortcuts', | ||
'wallpaperURL', | ||
'cancelHomeTouchstart', | ||
'cancelHomeTouchend', | ||
'secureWindowManager', | ||
'secureWindowFactory', | ||
]); | ||
|
||
var mocksForBootstrap = new MocksHelper([ | ||
'Applications', | ||
'FtuLauncher', | ||
'HomescreenLauncher', | ||
'Places', | ||
'ScreenManager', | ||
'SettingsListener', | ||
'SettingsURL', | ||
'SourceView', | ||
]).init(); | ||
|
||
suite('system/Bootstrap', function() { | ||
var realNavigatorSettings; | ||
var realNavigatormozApps; | ||
var realDocumentElementDir; | ||
var realDocumentElementLang; | ||
|
||
mocksForBootstrap.attachTestHelpers(); | ||
|
||
suiteSetup(function(done) { | ||
realNavigatormozApps = navigator.mozApps; | ||
navigator.mozApps = MockNavigatormozApps; | ||
|
||
realNavigatorSettings = navigator.mozSettings; | ||
navigator.mozSettings = MockNavigatorSettings; | ||
|
||
realDocumentElementDir = document.documentElement.dir; | ||
realDocumentElementLang = document.documentElement.lang; | ||
|
||
requireApp('system/js/bootstrap.js', done); | ||
}); | ||
|
||
suiteTeardown(function() { | ||
navigator.mozApps = realNavigatormozApps; | ||
realNavigatormozApps = null; | ||
|
||
navigator.mozSettings = realNavigatorSettings; | ||
realNavigatorSettings = null; | ||
|
||
document.documentElement.dir = realDocumentElementDir; | ||
document.documentElement.lang = realDocumentElementLang; | ||
}); | ||
|
||
suite('check for updates setting', function() { | ||
var setting = 'gaia.system.checkForUpdates'; | ||
suite('after First Time User setup has been done', function() { | ||
setup(function() { | ||
MockNavigatorSettings.mSettings[setting] = false; | ||
window.dispatchEvent(new CustomEvent('load')); | ||
window.dispatchEvent(new CustomEvent('ftudone')); | ||
}); | ||
|
||
test('should be enabled', function() { | ||
assert.isTrue(MockNavigatorSettings.mSettings[setting]); | ||
}); | ||
}); | ||
|
||
suite('at boot, if NOFTU is defined (i.e in DEBUG mode)', function() { | ||
setup(function() { | ||
MockNavigatorSettings.mSettings[setting] = false; | ||
window.dispatchEvent(new CustomEvent('load')); | ||
window.dispatchEvent(new CustomEvent('ftuskip')); | ||
}); | ||
|
||
test('should be enabled', function() { | ||
assert.isTrue(MockNavigatorSettings.mSettings[setting]); | ||
}); | ||
}); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
/* -*- Mode: Java; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- / | ||
/* vim: set shiftwidth=2 tabstop=2 autoindent cindent expandtab: */ | ||
|
||
/*exported MockPlaces*/ | ||
|
||
'use strict'; | ||
|
||
var MockPlaces = (function() { | ||
|
||
function init() { | ||
} | ||
|
||
return { | ||
init: init | ||
}; | ||
})(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
/* -*- Mode: Java; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- / | ||
/* vim: set shiftwidth=2 tabstop=2 autoindent cindent expandtab: */ | ||
|
||
/*exported MockScreenManager*/ | ||
|
||
'use strict'; | ||
|
||
var MockScreenManager = (function() { | ||
var screenEnabled = true; | ||
|
||
function turnScreenOn() { | ||
} | ||
|
||
return { | ||
turnScreenOn: turnScreenOn, | ||
screenEnabled: screenEnabled | ||
}; | ||
})(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
/* -*- Mode: Java; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- / | ||
/* vim: set shiftwidth=2 tabstop=2 autoindent cindent expandtab: */ | ||
|
||
/*exported MockSourceView*/ | ||
|
||
'use strict'; | ||
|
||
var MockSourceView = (function() { | ||
|
||
function init() { | ||
} | ||
|
||
return { | ||
init: init | ||
}; | ||
})(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters