зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1367696 - PART II add xpcshell structure for onboarding;r=mossop,rexboy
MozReview-Commit-ID: LA3LD8qx35d --HG-- extra : rebase_source : 839385a2817eb857db265d0d7516b61aed8e5d52
This commit is contained in:
Родитель
865c357751
Коммит
69dd530e1b
|
@ -53,7 +53,7 @@ extensionDir.append(EXTENSION_ID);
|
||||||
// If the unpacked extension doesn't exist, use the packed version.
|
// If the unpacked extension doesn't exist, use the packed version.
|
||||||
if (!extensionDir.exists()) {
|
if (!extensionDir.exists()) {
|
||||||
extensionDir = extensionDir.parent;
|
extensionDir = extensionDir.parent;
|
||||||
extensionDir.append(EXTENSION_ID + ".xpi");
|
extensionDir.leafName += ".xpi";
|
||||||
}
|
}
|
||||||
Components.manager.addBootstrappedManifestLocation(extensionDir);
|
Components.manager.addBootstrappedManifestLocation(extensionDir);
|
||||||
|
|
||||||
|
|
|
@ -19,4 +19,6 @@ FINAL_TARGET_FILES.features['onboarding@mozilla.org'] += [
|
||||||
|
|
||||||
BROWSER_CHROME_MANIFESTS += ['test/browser/browser.ini']
|
BROWSER_CHROME_MANIFESTS += ['test/browser/browser.ini']
|
||||||
|
|
||||||
|
XPCSHELL_TESTS_MANIFESTS += ['test/unit/xpcshell.ini']
|
||||||
|
|
||||||
JAR_MANIFESTS += ['jar.mn']
|
JAR_MANIFESTS += ['jar.mn']
|
||||||
|
|
|
@ -0,0 +1,7 @@
|
||||||
|
"use strict";
|
||||||
|
|
||||||
|
module.exports = {
|
||||||
|
"extends": [
|
||||||
|
"plugin:mozilla/xpcshell-test",
|
||||||
|
],
|
||||||
|
};
|
|
@ -0,0 +1,39 @@
|
||||||
|
/**
|
||||||
|
* Provides infrastructure for automated onboarding components tests.
|
||||||
|
*/
|
||||||
|
|
||||||
|
"use strict";
|
||||||
|
|
||||||
|
/* global Cc, Ci, Cu */
|
||||||
|
const {classes: Cc, interfaces: Ci, utils: Cu} = Components;
|
||||||
|
Cu.import("resource://gre/modules/Preferences.jsm");
|
||||||
|
Cu.import("resource://gre/modules/Services.jsm");
|
||||||
|
Cu.import("resource://gre/modules/XPCOMUtils.jsm");
|
||||||
|
|
||||||
|
// Load our bootstrap extension manifest so we can access our chrome/resource URIs.
|
||||||
|
// Cargo culted from formautofill system add-on
|
||||||
|
const EXTENSION_ID = "onboarding@mozilla.org";
|
||||||
|
let extensionDir = Services.dirsvc.get("GreD", Ci.nsIFile);
|
||||||
|
extensionDir.append("browser");
|
||||||
|
extensionDir.append("features");
|
||||||
|
extensionDir.append(EXTENSION_ID);
|
||||||
|
// If the unpacked extension doesn't exist, use the packed version.
|
||||||
|
if (!extensionDir.exists()) {
|
||||||
|
extensionDir = extensionDir.parent;
|
||||||
|
extensionDir.leafName += ".xpi";
|
||||||
|
}
|
||||||
|
Components.manager.addBootstrappedManifestLocation(extensionDir);
|
||||||
|
|
||||||
|
const TOURSET_VERSION = 1;
|
||||||
|
const PREF_TOUR_TYPE = "browser.onboarding.tour-type";
|
||||||
|
const PREF_TOURSET_VERSION = "browser.onboarding.tourset-version";
|
||||||
|
const PREF_SEEN_TOURSET_VERSION = "browser.onboarding.seen-tourset-version";
|
||||||
|
const PREF_ONBOARDING_HIDDEN = "browser.onboarding.hidden";
|
||||||
|
|
||||||
|
function resetOnboardingDefaultState() {
|
||||||
|
// All the prefs should be reset to what prefs should looks like in a new user profile
|
||||||
|
Services.prefs.setBoolPref(PREF_ONBOARDING_HIDDEN, false);
|
||||||
|
Services.prefs.setIntPref(PREF_TOURSET_VERSION, TOURSET_VERSION);
|
||||||
|
Services.prefs.clearUserPref(PREF_SEEN_TOURSET_VERSION);
|
||||||
|
Services.prefs.clearUserPref(PREF_TOUR_TYPE);
|
||||||
|
}
|
|
@ -0,0 +1,13 @@
|
||||||
|
/*
|
||||||
|
* Test for onboarding tour type check.
|
||||||
|
*/
|
||||||
|
|
||||||
|
"use strict";
|
||||||
|
|
||||||
|
add_task(async function() {
|
||||||
|
do_print("Starting testcase: New user state");
|
||||||
|
resetOnboardingDefaultState();
|
||||||
|
|
||||||
|
do_check_eq(Preferences.get(PREF_TOURSET_VERSION), TOURSET_VERSION);
|
||||||
|
do_check_eq(Preferences.get(PREF_ONBOARDING_HIDDEN), false);
|
||||||
|
});
|
|
@ -0,0 +1,5 @@
|
||||||
|
[DEFAULT]
|
||||||
|
firefox-appdir = browser
|
||||||
|
head = head.js
|
||||||
|
|
||||||
|
[test-onboarding-tour-type.js]
|
|
@ -16,7 +16,7 @@ extensionDir.append(EXTENSION_ID);
|
||||||
// If the unpacked extension doesn't exist, use the packed version.
|
// If the unpacked extension doesn't exist, use the packed version.
|
||||||
if (!extensionDir.exists()) {
|
if (!extensionDir.exists()) {
|
||||||
extensionDir = extensionDir.parent;
|
extensionDir = extensionDir.parent;
|
||||||
extensionDir.append(EXTENSION_ID + ".xpi");
|
extensionDir.leafName += ".xpi";
|
||||||
}
|
}
|
||||||
Components.manager.addBootstrappedManifestLocation(extensionDir);
|
Components.manager.addBootstrappedManifestLocation(extensionDir);
|
||||||
|
|
||||||
|
|
Загрузка…
Ссылка в новой задаче