[Pkg-mozext-commits] [requestpolicy] 240/280: [refact] MozMill: change the way app restarts are detected

David Prévot taffit at moszumanska.debian.org
Sat May 2 20:30:34 UTC 2015


This is an automated email from the git hooks/post-receive script.

taffit pushed a commit to branch master
in repository requestpolicy.

commit e0950554a5752ae880d1c64ad88b3371a3948252
Author: Martin Kimmerle <dev at 256k.de>
Date:   Fri Mar 20 23:39:39 2015 +0100

    [refact] MozMill: change the way app restarts are detected
---
 .../extension/content/restart-detection-helper.jsm | 27 ++++++++++++++++++++++
 .../initDetectingRestarts.js                       |  5 ++--
 .../testAssertNoRestart.js                         |  5 ++--
 .../testDetectingRestarts.js                       |  8 ++++---
 4 files changed, 38 insertions(+), 7 deletions(-)

diff --git a/tests/mozmill/extension/content/restart-detection-helper.jsm b/tests/mozmill/extension/content/restart-detection-helper.jsm
new file mode 100644
index 0000000..c960b28
--- /dev/null
+++ b/tests/mozmill/extension/content/restart-detection-helper.jsm
@@ -0,0 +1,27 @@
+/*
+ * ***** BEGIN LICENSE BLOCK *****
+ *
+ * RequestPolicy Observer - A helper add-on for RequestPolicy development.
+ * Copyright (c) 2015 Martin Kimmerle
+ *
+ * This program is free software: you can redistribute it and/or modify it under
+ * the terms of the GNU General Public License as published by the Free Software
+ * Foundation, either version 3 of the License, or (at your option) any later
+ * version.
+ *
+ * This program is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
+ * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
+ * details.
+ *
+ * You should have received a copy of the GNU General Public License along with
+ * this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ * ***** END LICENSE BLOCK *****
+ */
+
+let EXPORTED_SYMBOLS = ["RestartDetectionHelper"];
+
+RestartDetectionHelper = {
+  mark: null
+};
diff --git a/tests/mozmill/highLevelTests/repeatedTests/detectApplicationRestarts/initDetectingRestarts.js b/tests/mozmill/highLevelTests/repeatedTests/detectApplicationRestarts/initDetectingRestarts.js
index 8adaace..5a7cb1f 100644
--- a/tests/mozmill/highLevelTests/repeatedTests/detectApplicationRestarts/initDetectingRestarts.js
+++ b/tests/mozmill/highLevelTests/repeatedTests/detectApplicationRestarts/initDetectingRestarts.js
@@ -4,9 +4,10 @@
 
 "use strict";
 
+Components.utils.import("chrome://rp-observer/content/restart-detection-helper.jsm");
+
 
 function setupModule(aModule) {
-  aModule.controller = mozmill.getBrowserController();
 }
 
 function teardownModule(aModule) {
@@ -14,5 +15,5 @@ function teardownModule(aModule) {
 
 
 function testInitAssertNoRestart() {
-  controller.window.markForDetectingRestarts = "MARK";
+  RestartDetectionHelper.mark = "MARK";
 }
diff --git a/tests/mozmill/highLevelTests/repeatedTests/detectApplicationRestarts/testAssertNoRestart.js b/tests/mozmill/highLevelTests/repeatedTests/detectApplicationRestarts/testAssertNoRestart.js
index b73fed9..4f58dda 100644
--- a/tests/mozmill/highLevelTests/repeatedTests/detectApplicationRestarts/testAssertNoRestart.js
+++ b/tests/mozmill/highLevelTests/repeatedTests/detectApplicationRestarts/testAssertNoRestart.js
@@ -4,9 +4,10 @@
 
 "use strict";
 
+Components.utils.import("chrome://rp-observer/content/restart-detection-helper.jsm");
+
 
 function setupModule(aModule) {
-  aModule.controller = mozmill.getBrowserController();
 }
 
 function teardownModule(aModule) {
@@ -14,6 +15,6 @@ function teardownModule(aModule) {
 
 
 function testAssertNoRestart() {
-  assert.ok(typeof controller.window.markForDetectingRestarts !== "undefined",
+  assert.ok(RestartDetectionHelper.mark === "MARK",
             "The MARK still exists, which means the browser did not restart.");
 }
diff --git a/tests/mozmill/highLevelTests/repeatedTests/detectApplicationRestarts/testDetectingRestarts.js b/tests/mozmill/highLevelTests/repeatedTests/detectApplicationRestarts/testDetectingRestarts.js
index 0511998..3eda91d 100644
--- a/tests/mozmill/highLevelTests/repeatedTests/detectApplicationRestarts/testDetectingRestarts.js
+++ b/tests/mozmill/highLevelTests/repeatedTests/detectApplicationRestarts/testDetectingRestarts.js
@@ -4,6 +4,8 @@
 
 "use strict";
 
+Components.utils.import("chrome://rp-observer/content/restart-detection-helper.jsm");
+
 
 function setupModule(aModule) {
 }
@@ -16,7 +18,7 @@ function setupTest(aModule) {
 
 function teardownTest(aModule) {
   if (persisted.nextTest) {
-    controller.restartApplication(persisted.nextTest);
+    aModule.controller.restartApplication(persisted.nextTest);
   }
 }
 
@@ -30,10 +32,10 @@ function teardownModule(aModule) {
 function testAddMark() {
   persisted.nextTest = "testMarkHasBeenRemoved";
 
-  controller.window.markForDetectingRestarts = "MARK";
+  RestartDetectionHelper.mark = "MARK";
 }
 
 function testMarkHasBeenRemoved() {
-  assert.ok(typeof controller.window.markForDetectingRestarts === "undefined",
+  assert.ok(RestartDetectionHelper.mark !== "MARK",
             "The MARK has been removed after a restart.");
 }

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-mozext/requestpolicy.git



More information about the Pkg-mozext-commits mailing list