Bug 892765 - part 1 - move common captivedetect test code into head_setprefs.js; r=schien
authorNathan Froyd <froydnj@mozilla.com>
Fri, 12 Jul 2013 17:01:53 -0400
changeset 138392 0b8c0b71c5568b490192faa430a1c5f0d96d484f
parent 138391 7b576d83f89f67f494b754031f35ec0fddc6935d
child 138393 8dfaa3d620fb89228fd434224560a02766f67ccf
push id30954
push usernfroyd@mozilla.com
push dateFri, 12 Jul 2013 21:18:05 +0000
treeherdermozilla-inbound@332c413c55e8 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersschien
bugs892765
milestone25.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 892765 - part 1 - move common captivedetect test code into head_setprefs.js; r=schien
toolkit/components/captivedetect/test/unit/head_setprefs.js
toolkit/components/captivedetect/test/unit/test_abort.js
toolkit/components/captivedetect/test/unit/test_abort_during_user_login.js
toolkit/components/captivedetect/test/unit/test_abort_ongoing_request.js
toolkit/components/captivedetect/test/unit/test_abort_pending_request.js
toolkit/components/captivedetect/test/unit/test_captive_portal_found.js
toolkit/components/captivedetect/test/unit/test_captive_portal_found_303.js
toolkit/components/captivedetect/test/unit/test_captive_portal_not_found.js
toolkit/components/captivedetect/test/unit/test_captive_portal_not_found_404.js
toolkit/components/captivedetect/test/unit/test_multiple_requests.js
toolkit/components/captivedetect/test/unit/test_user_cancel.js
--- a/toolkit/components/captivedetect/test/unit/head_setprefs.js
+++ b/toolkit/components/captivedetect/test/unit/head_setprefs.js
@@ -1,14 +1,24 @@
 /* -*- Mode: Java; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
 /* This Source Code Form is subject to the terms of the Mozilla Public
  * License, v. 2.0. If a copy of the MPL was not distributed with this file,
  * You can obtain one at http://mozilla.org/MPL/2.0/. */
 'use strict';
 
+const {classes: Cc, interfaces: Ci, utils: Cu, results: Cr} = Components;
+
+Cu.import('resource://gre/modules/XPCOMUtils.jsm');
+Cu.import('resource://gre/modules/Services.jsm');
+Cu.import('resource://testing-common/httpd.js');
+
+XPCOMUtils.defineLazyServiceGetter(this, 'gCaptivePortalDetector',
+                                   '@mozilla.org/toolkit/captive-detector;1',
+                                   'nsICaptivePortalDetector');
+
 const kServerURL = 'http://localhost:4444';
 const kCanonicalSitePath = '/canonicalSite.html';
 const kCanonicalSiteContent = 'true';
 const kPrefsCanonicalURL = 'captivedetect.canonicalURL';
 const kPrefsCanonicalContent = 'captivedetect.canonicalContent';
 const kPrefsMaxWaitingTime = 'captivedetect.maxWaitingTime';
 const kPrefsPollingTime = 'captivedetect.pollingTime';
 
--- a/toolkit/components/captivedetect/test/unit/test_abort.js
+++ b/toolkit/components/captivedetect/test/unit/test_abort.js
@@ -1,25 +1,16 @@
 /* -*- Mode: Java; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
 /* This Source Code Form is subject to the terms of the Mozilla Public
  * License, v. 2.0. If a copy of the MPL was not distributed with this file,
  * You can obtain one at http://mozilla.org/MPL/2.0/. */
 'use strict';
 
-const {classes: Cc, interfaces: Ci, utils: Cu, results: Cr} = Components;
-
-Cu.import('resource://gre/modules/XPCOMUtils.jsm');
-Cu.import('resource://gre/modules/Services.jsm');
-Cu.import('resource://testing-common/httpd.js');
-
 const kInterfaceName = 'wifi';
 
-XPCOMUtils.defineLazyServiceGetter(this, 'gCaptivePortalDetector',
-                                   '@mozilla.org/toolkit/captive-detector;1',
-                                   'nsICaptivePortalDetector');
 var server;
 var step = 0;
 var loginFinished = false;
 
 function xhr_handler(metadata, response) {
   response.setStatusLine(metadata.httpVersion, 200, 'OK');
   response.setHeader('Cache-Control', 'no-cache', false);
   response.setHeader('Content-Type', 'text/plain', false);
--- a/toolkit/components/captivedetect/test/unit/test_abort_during_user_login.js
+++ b/toolkit/components/captivedetect/test/unit/test_abort_during_user_login.js
@@ -1,25 +1,16 @@
 /* -*- Mode: Java; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
 /* This Source Code Form is subject to the terms of the Mozilla Public
  * License, v. 2.0. If a copy of the MPL was not distributed with this file,
  * You can obtain one at http://mozilla.org/MPL/2.0/. */
 'use strict';
 
-const {classes: Cc, interfaces: Ci, utils: Cu, results: Cr} = Components;
-
-Cu.import('resource://gre/modules/XPCOMUtils.jsm');
-Cu.import('resource://gre/modules/Services.jsm');
-Cu.import('resource://testing-common/httpd.js');
-
 const kInterfaceName = 'wifi';
 
-XPCOMUtils.defineLazyServiceGetter(this, 'gCaptivePortalDetector',
-                                   '@mozilla.org/toolkit/captive-detector;1',
-                                   'nsICaptivePortalDetector');
 var server;
 var step = 0;
 var loginFinished = false;
 
 function xhr_handler(metadata, response) {
   response.setStatusLine(metadata.httpVersion, 200, 'OK');
   response.setHeader('Cache-Control', 'no-cache', false);
   response.setHeader('Content-Type', 'text/plain', false);
--- a/toolkit/components/captivedetect/test/unit/test_abort_ongoing_request.js
+++ b/toolkit/components/captivedetect/test/unit/test_abort_ongoing_request.js
@@ -1,26 +1,17 @@
 /* -*- Mode: Java; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
 /* This Source Code Form is subject to the terms of the Mozilla Public
  * License, v. 2.0. If a copy of the MPL was not distributed with this file,
  * You can obtain one at http://mozilla.org/MPL/2.0/. */
 'use strict';
 
-const {classes: Cc, interfaces: Ci, utils: Cu, results: Cr} = Components;
-
-Cu.import('resource://gre/modules/XPCOMUtils.jsm');
-Cu.import('resource://gre/modules/Services.jsm');
-Cu.import('resource://testing-common/httpd.js');
-
 const kInterfaceName = 'wifi';
 const kOtherInterfaceName = 'ril';
 
-XPCOMUtils.defineLazyServiceGetter(this, 'gCaptivePortalDetector',
-                                   '@mozilla.org/toolkit/captive-detector;1',
-                                   'nsICaptivePortalDetector');
 var server;
 var step = 0;
 var loginFinished = false;
 
 function xhr_handler(metadata, response) {
   response.setStatusLine(metadata.httpVersion, 200, 'OK');
   response.setHeader('Cache-Control', 'no-cache', false);
   response.setHeader('Content-Type', 'text/plain', false);
--- a/toolkit/components/captivedetect/test/unit/test_abort_pending_request.js
+++ b/toolkit/components/captivedetect/test/unit/test_abort_pending_request.js
@@ -1,26 +1,17 @@
 /* -*- Mode: Java; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
 /* This Source Code Form is subject to the terms of the Mozilla Public
  * License, v. 2.0. If a copy of the MPL was not distributed with this file,
  * You can obtain one at http://mozilla.org/MPL/2.0/. */
 'use strict';
 
-const {classes: Cc, interfaces: Ci, utils: Cu, results: Cr} = Components;
-
-Cu.import('resource://gre/modules/XPCOMUtils.jsm');
-Cu.import('resource://gre/modules/Services.jsm');
-Cu.import('resource://testing-common/httpd.js');
-
 const kInterfaceName = 'wifi';
 const kOtherInterfaceName = 'ril';
 
-XPCOMUtils.defineLazyServiceGetter(this, 'gCaptivePortalDetector',
-                                   '@mozilla.org/toolkit/captive-detector;1',
-                                   'nsICaptivePortalDetector');
 var server;
 var step = 0;
 var loginFinished = false;
 
 function xhr_handler(metadata, response) {
   response.setStatusLine(metadata.httpVersion, 200, 'OK');
   response.setHeader('Cache-Control', 'no-cache', false);
   response.setHeader('Content-Type', 'text/plain', false);
--- a/toolkit/components/captivedetect/test/unit/test_captive_portal_found.js
+++ b/toolkit/components/captivedetect/test/unit/test_captive_portal_found.js
@@ -1,25 +1,16 @@
 /* -*- Mode: Java; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
 /* This Source Code Form is subject to the terms of the Mozilla Public
  * License, v. 2.0. If a copy of the MPL was not distributed with this file,
  * You can obtain one at http://mozilla.org/MPL/2.0/. */
 'use strict';
 
-const {classes: Cc, interfaces: Ci, utils: Cu, results: Cr} = Components;
-
-Cu.import('resource://gre/modules/XPCOMUtils.jsm');
-Cu.import('resource://gre/modules/Services.jsm');
-Cu.import('resource://testing-common/httpd.js');
-
 const kInterfaceName = 'wifi';
 
-XPCOMUtils.defineLazyServiceGetter(this, 'gCaptivePortalDetector',
-                                   '@mozilla.org/toolkit/captive-detector;1',
-                                   'nsICaptivePortalDetector');
 var server;
 var step = 0;
 var loginFinished = false;
 
 function xhr_handler(metadata, response) {
   response.setStatusLine(metadata.httpVersion, 200, 'OK');
   response.setHeader('Cache-Control', 'no-cache', false);
   response.setHeader('Content-Type', 'text/plain', false);
--- a/toolkit/components/captivedetect/test/unit/test_captive_portal_found_303.js
+++ b/toolkit/components/captivedetect/test/unit/test_captive_portal_found_303.js
@@ -1,25 +1,16 @@
 /* -*- Mode: Java; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
 /* This Source Code Form is subject to the terms of the Mozilla Public
  * License, v. 2.0. If a copy of the MPL was not distributed with this file,
  * You can obtain one at http://mozilla.org/MPL/2.0/. */
 'use strict';
 
-const {classes: Cc, interfaces: Ci, utils: Cu, results: Cr} = Components;
-
-Cu.import('resource://gre/modules/XPCOMUtils.jsm');
-Cu.import('resource://gre/modules/Services.jsm');
-Cu.import('resource://testing-common/httpd.js');
-
 const kInterfaceName = 'wifi';
 
-XPCOMUtils.defineLazyServiceGetter(this, 'gCaptivePortalDetector',
-                                   '@mozilla.org/toolkit/captive-detector;1',
-                                   'nsICaptivePortalDetector');
 var server;
 var step = 0;
 var loginFinished = false;
 
 function xhr_handler(metadata, response) {
   if (loginFinished) {
     response.setStatusLine(metadata.httpVersion, 200, 'OK');
     response.setHeader('Cache-Control', 'no-cache', false);
--- a/toolkit/components/captivedetect/test/unit/test_captive_portal_not_found.js
+++ b/toolkit/components/captivedetect/test/unit/test_captive_portal_not_found.js
@@ -1,25 +1,16 @@
 /* -*- Mode: Java; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
 /* This Source Code Form is subject to the terms of the Mozilla Public
  * License, v. 2.0. If a copy of the MPL was not distributed with this file,
  * You can obtain one at http://mozilla.org/MPL/2.0/. */
 'use strict';
 
-const {classes: Cc, interfaces: Ci, utils: Cu, results: Cr} = Components;
-
-Cu.import('resource://gre/modules/XPCOMUtils.jsm');
-Cu.import('resource://gre/modules/Services.jsm');
-Cu.import('resource://testing-common/httpd.js');
-
 const kInterfaceName = 'wifi';
 
-XPCOMUtils.defineLazyServiceGetter(this, 'gCaptivePortalDetector',
-                                   '@mozilla.org/toolkit/captive-detector;1',
-                                   'nsICaptivePortalDetector');
 var server;
 var step = 0;
 var attempt = 0;
 
 function xhr_handler(metadata, response) {
   dump('HTTP activity\n');
   response.setStatusLine(metadata.httpVersion, 200, 'OK');
   response.setHeader('Cache-Control', 'no-cache', false);
--- a/toolkit/components/captivedetect/test/unit/test_captive_portal_not_found_404.js
+++ b/toolkit/components/captivedetect/test/unit/test_captive_portal_not_found_404.js
@@ -1,25 +1,16 @@
 /* -*- Mode: Java; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
 /* This Source Code Form is subject to the terms of the Mozilla Public
  * License, v. 2.0. If a copy of the MPL was not distributed with this file,
  * You can obtain one at http://mozilla.org/MPL/2.0/. */
 'use strict';
 
-const {classes: Cc, interfaces: Ci, utils: Cu, results: Cr} = Components;
-
-Cu.import('resource://gre/modules/XPCOMUtils.jsm');
-Cu.import('resource://gre/modules/Services.jsm');
-Cu.import('resource://testing-common/httpd.js');
-
 const kInterfaceName = 'wifi';
 
-XPCOMUtils.defineLazyServiceGetter(this, 'gCaptivePortalDetector',
-                                   '@mozilla.org/toolkit/captive-detector;1',
-                                   'nsICaptivePortalDetector');
 var server;
 var step = 0;
 var loginFinished = false;
 var attempt = 0;
 
 function xhr_handler(metadata, response) {
   response.setStatusLine(metadata.httpVersion, 404, "Page not Found");
   attempt++;
--- a/toolkit/components/captivedetect/test/unit/test_multiple_requests.js
+++ b/toolkit/components/captivedetect/test/unit/test_multiple_requests.js
@@ -1,26 +1,17 @@
 /* -*- Mode: Java; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
 /* This Source Code Form is subject to the terms of the Mozilla Public
  * License, v. 2.0. If a copy of the MPL was not distributed with this file,
  * You can obtain one at http://mozilla.org/MPL/2.0/. */
 'use strict';
 
-const {classes: Cc, interfaces: Ci, utils: Cu, results: Cr} = Components;
-
-Cu.import('resource://gre/modules/XPCOMUtils.jsm');
-Cu.import('resource://gre/modules/Services.jsm');
-Cu.import('resource://testing-common/httpd.js');
-
 const kInterfaceName = 'wifi';
 const kOtherInterfaceName = 'ril';
 
-XPCOMUtils.defineLazyServiceGetter(this, 'gCaptivePortalDetector',
-                                   '@mozilla.org/toolkit/captive-detector;1',
-                                   'nsICaptivePortalDetector');
 var server;
 var step = 0;
 var loginFinished = false;
 
 function xhr_handler(metadata, response) {
   response.setStatusLine(metadata.httpVersion, 200, 'OK');
   response.setHeader('Cache-Control', 'no-cache', false);
   response.setHeader('Content-Type', 'text/plain', false);
--- a/toolkit/components/captivedetect/test/unit/test_user_cancel.js
+++ b/toolkit/components/captivedetect/test/unit/test_user_cancel.js
@@ -1,25 +1,16 @@
 /* -*- Mode: Java; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
 /* This Source Code Form is subject to the terms of the Mozilla Public
  * License, v. 2.0. If a copy of the MPL was not distributed with this file,
  * You can obtain one at http://mozilla.org/MPL/2.0/. */
 'use strict';
 
-const {classes: Cc, interfaces: Ci, utils: Cu, results: Cr} = Components;
-
-Cu.import('resource://gre/modules/XPCOMUtils.jsm');
-Cu.import('resource://gre/modules/Services.jsm');
-Cu.import('resource://testing-common/httpd.js');
-
 const kInterfaceName = 'wifi';
 
-XPCOMUtils.defineLazyServiceGetter(this, 'gCaptivePortalDetector',
-                                   '@mozilla.org/toolkit/captive-detector;1',
-                                   'nsICaptivePortalDetector');
 var server;
 var step = 0;
 
 function xhr_handler(metadata, response) {
   response.setStatusLine(metadata.httpVersion, 200, 'OK');
   response.setHeader('Cache-Control', 'no-cache', false);
   response.setHeader('Content-Type', 'text/plain', false);
   response.write('false');