Bug 1288885: Migrate storage mochitests to xpcshell. r=aswan
authorKris Maglione <maglione.k@gmail.com>
Fri, 22 Jul 2016 17:32:31 -0700
changeset 347199 50064b17c447b6e017347de5f80e210eec34368a
parent 347198 642065cf0f131ce85447290ad737c0857dae9e65
child 347200 82c269c1788e2825aaa8e517b7644700e0ce4170
push id6389
push userraliiev@mozilla.com
push dateMon, 19 Sep 2016 13:38:22 +0000
treeherdermozilla-beta@01d67bfe6c81 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersaswan
bugs1288885
milestone50.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1288885: Migrate storage mochitests to xpcshell. r=aswan MozReview-Commit-ID: 1DYgv3LNDOW
toolkit/components/extensions/test/mochitest/mochitest.ini
toolkit/components/extensions/test/mochitest/test_ext_storage.html
toolkit/components/extensions/test/xpcshell/test_ext_storage.js
toolkit/components/extensions/test/xpcshell/xpcshell.ini
--- a/toolkit/components/extensions/test/mochitest/mochitest.ini
+++ b/toolkit/components/extensions/test/mochitest/mochitest.ini
@@ -65,17 +65,16 @@ skip-if = (os == 'android' || buildapp =
 [test_ext_runtime_id.html]
 [test_ext_sandbox_var.html]
 [test_ext_sendmessage_reply.html]
 skip-if = (os == 'android' || buildapp == 'b2g') # sender.tab is undefined on b2g. Bug 1258975 on android.
 [test_ext_sendmessage_reply2.html]
 skip-if = (os == 'android' || buildapp == 'b2g') # sender.tab is undefined on b2g. Bug 1258975 on android.
 [test_ext_sendmessage_doublereply.html]
 skip-if = (os == 'android' || buildapp == 'b2g') # sender.tab is undefined on b2g. Bug 1258975 on android.
-[test_ext_storage.html]
 [test_ext_storage_content.html]
 [test_ext_storage_tab.html]
 skip-if = os == 'android' # Android does not currently support tabs.
 [test_ext_cookies.html]
 [test_ext_background_window_properties.html]
 [test_ext_background_sub_windows.html]
 [test_ext_background_api_injection.html]
 [test_ext_background_generated_url.html]
rename from toolkit/components/extensions/test/mochitest/test_ext_storage.html
rename to toolkit/components/extensions/test/xpcshell/test_ext_storage.js
--- a/toolkit/components/extensions/test/mochitest/test_ext_storage.html
+++ b/toolkit/components/extensions/test/xpcshell/test_ext_storage.js
@@ -1,21 +1,10 @@
-<!DOCTYPE HTML>
-<html>
-<head>
-  <title>WebExtension test</title>
-  <script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
-  <script type="text/javascript" src="/tests/SimpleTest/SpawnTask.js"></script>
-  <script type="text/javascript" src="/tests/SimpleTest/ExtensionTestUtils.js"></script>
-  <script type="text/javascript" src="head.js"></script>
-  <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
-</head>
-<body>
-
-<script type="text/javascript">
+/* -*- Mode: indent-tabs-mode: nil; js-indent-level: 2 -*- */
+/* vim: set sts=2 sw=2 et tw=80: */
 "use strict";
 
 function backgroundScript() {
   let storage = browser.storage.local;
   function check(prop, value) {
     return storage.get(null).then(data => {
       browser.test.assertEq(value, data[prop], "null getter worked for " + prop);
       return storage.get(prop);
@@ -166,31 +155,28 @@ function backgroundScript() {
     browser.test.notifyPass("storage");
   }).catch(e => {
     browser.test.fail(`Error: ${e} :: ${e.stack}`);
     browser.test.notifyFail("storage");
   });
 }
 
 let extensionData = {
-  background: "(" + backgroundScript.toString() + ")()",
+  background: backgroundScript,
   manifest: {
     permissions: ["storage"],
   },
 };
 
 add_task(function* test_backgroundScript() {
   let extension = ExtensionTestUtils.loadExtension(extensionData);
 
   yield extension.startup();
 
   yield extension.awaitMessage("invalidate");
-  SpecialPowers.invalidateExtensionStorageCache();
+
+  Services.obs.notifyObservers(null, "extension-invalidate-storage-cache", "");
+
   extension.sendMessage("invalidated");
 
   yield extension.awaitFinish("storage");
   yield extension.unload();
 });
-
-</script>
-
-</body>
-</html>
--- a/toolkit/components/extensions/test/xpcshell/xpcshell.ini
+++ b/toolkit/components/extensions/test/xpcshell/xpcshell.ini
@@ -17,13 +17,14 @@ skip-if = toolkit == 'gonk' || appname =
 [test_ext_manifest_incognito.js]
 [test_ext_onmessage_removelistener.js]
 [test_ext_runtime_connect_no_receiver.js]
 [test_ext_runtime_getPlatformInfo.js]
 [test_ext_runtime_sendMessage.js]
 [test_ext_runtime_sendMessage_no_receiver.js]
 [test_ext_schemas.js]
 [test_ext_simple.js]
+[test_ext_storage.js]
 [test_getAPILevelForWindow.js]
 [test_locale_converter.js]
 [test_locale_data.js]
 [test_native_messaging.js]
 skip-if = os == "android"