Skip to content

Commit

Permalink
Bug 858731 - Update mutt test constants to BASE_URL,TEST_URL. r=hskupin
Browse files Browse the repository at this point in the history
  • Loading branch information
tojon committed Apr 9, 2013
1 parent bc25839 commit ad5d625
Show file tree
Hide file tree
Showing 27 changed files with 96 additions and 103 deletions.
6 changes: 3 additions & 3 deletions mutt/mutt/tests/js/controller/contextmenu.js
Expand Up @@ -2,8 +2,8 @@
* 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/. */

const TEST_FOLDER = collector.addHttpResource('../_files/');

const BASE_URL = collector.addHttpResource('../_files/');
const TEST_URL = BASE_URL + "form.html";

var setupModule = function () {
controller = mozmill.getBrowserController();
Expand All @@ -13,7 +13,7 @@ var setupModule = function () {
}

var testMenu = function () {
controller.open(TEST_FOLDER + "form.html");
controller.open(TEST_URL);
controller.waitForPageLoad();

// Enter text in a text field and select all via the context menu
Expand Down
4 changes: 3 additions & 1 deletion mutt/mutt/tests/js/controller/dnd_chrome.js
Expand Up @@ -2,12 +2,14 @@
* 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/. */

const TEST_URL = "chrome://mozmill/content/test/test.xul";

var setupModule = function () {
controller = mozmill.getBrowserController();
}

var test = function () {
controller.open("chrome://mozmill/content/test/test.xul");
controller.open(TEST_URL);
controller.waitForPageLoad();

let bar = new elementslib.ID(controller.window.document, "item1");
Expand Down
4 changes: 3 additions & 1 deletion mutt/mutt/tests/js/controller/dnd_content.js
Expand Up @@ -2,12 +2,14 @@
* 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/. */

const TEST_URL = "chrome://mozmill/content/test/test.html";

var setupModule = function () {
controller = mozmill.getBrowserController();
}

var test = function () {
controller.open("chrome://mozmill/content/test/test.html");
controller.open(TEST_URL);
controller.waitForPageLoad();

let bar = new elementslib.ID(controller.window.document, "item1");
Expand Down
6 changes: 3 additions & 3 deletions mutt/mutt/tests/js/controller/dnd_content_chrome.js
Expand Up @@ -2,8 +2,8 @@
* 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/. */

const TEST_FOLDER = collector.addHttpResource('../_files/');

const BASE_URL = collector.addHttpResource('../_files/');
const TEST_URL = BASE_URL + "link.html";

var setupModule = function () {
controller = mozmill.getBrowserController();
Expand All @@ -12,7 +12,7 @@ var setupModule = function () {
}

var test = function () {
controller.open(TEST_FOLDER + "link.html");
controller.open(TEST_URL);
controller.waitForPageLoad();

let link = new elementslib.ID(controller.tabs.activeTab, "link");
Expand Down
6 changes: 3 additions & 3 deletions mutt/mutt/tests/js/controller/expected_events.js
Expand Up @@ -2,15 +2,15 @@
* 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/. */

const TEST_FOLDER = collector.addHttpResource('../_files/');

const BASE_URL = collector.addHttpResource('../_files/');
const TEST_URL = BASE_URL + "form.html";

var setupModule = function () {
controller = mozmill.getBrowserController();
}

var test = function () {
controller.open(TEST_FOLDER + "form.html");
controller.open(TEST_URL);
controller.waitForPageLoad();

let fname = new elementslib.ID(controller.tabs.activeTab, "fname");
Expand Down
6 changes: 3 additions & 3 deletions mutt/mutt/tests/js/controller/native_events.js
Expand Up @@ -2,15 +2,15 @@
* 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/. */

const TEST_FOLDER = collector.addHttpResource('../_files/');

const BASE_URL = collector.addHttpResource('../_files/');
const TEST_URL = BASE_URL + "link.html";

var setupModule = function () {
controller = mozmill.getBrowserController();
}

var test = function () {
controller.open(TEST_FOLDER + "link.html");
controller.open(TEST_URL);
controller.waitForPageLoad();

let link = new elementslib.ID(controller.tabs.activeTab, "link");
Expand Down
6 changes: 3 additions & 3 deletions mutt/mutt/tests/js/controller/screenshot.js
Expand Up @@ -2,15 +2,15 @@
* 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/. */

const TEST_FOLDER = collector.addHttpResource('../_files/');

const BASE_URL = collector.addHttpResource('../_files/');
const TEST_URL = BASE_URL + "complex.html";

var setupModule = function () {
controller = mozmill.getBrowserController();
}

var test = function () {
controller.open(TEST_FOLDER + "complex.html");
controller.open(TEST_URL);
controller.waitForPageLoad();

let content = findElement.ID(controller.tabs.activeTab, "content");
Expand Down
6 changes: 3 additions & 3 deletions mutt/mutt/tests/js/controller/synthesize_events.js
Expand Up @@ -2,15 +2,15 @@
* 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/. */

const TEST_FOLDER = collector.addHttpResource('../_files/');

const BASE_URL = collector.addHttpResource('../_files/');
const TEST_URL = BASE_URL + "form.html";

var setupModule = function () {
controller = mozmill.getBrowserController();
}

var test = function () {
controller.open(TEST_FOLDER + "form.html");
controller.open(TEST_URL);
controller.waitForPageLoad();

var fname = new elementslib.ID(controller.tabs.activeTab, "fname");
Expand Down
8 changes: 4 additions & 4 deletions mutt/mutt/tests/js/elementslib/mozelement.js
Expand Up @@ -2,15 +2,15 @@
* 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/. */

const TEST_FOLDER = collector.addHttpResource('../_files/');
const TEST_PAGE = TEST_FOLDER + "form.html";
const BASE_URL = collector.addHttpResource('../_files/');
const TEST_URL = BASE_URL + "form.html";

var setupModule = function () {
controller = mozmill.getBrowserController();
}

var test = function () {
controller.open(TEST_PAGE);
controller.open(TEST_URL);
controller.waitForPageLoad();

let textbox = findElement.ID(controller.tabs.activeTab, "fname");
Expand All @@ -24,7 +24,7 @@ var test = function () {
let previousURL = urlbar.getNode().value;

urlbar.keypress("a", {accelKey: true});
urlbar.sendKeys(TEST_PAGE);
urlbar.sendKeys(TEST_URL);
urlbar.keypress("VK_RETURN", {});
controller.waitForPageLoad();

Expand Down
5 changes: 3 additions & 2 deletions mutt/mutt/tests/js/elementslib/mozelement_window.js
Expand Up @@ -2,7 +2,8 @@
* 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/. */

const TEST_FOLDER = collector.addHttpResource('../_files/');
const BASE_URL = collector.addHttpResource('../_files/');
const TEST_URL = BASE_URL + "form.html";

// Bug 677364:
// Fix controller keyboard methods to allow a null parameter for the target element
Expand All @@ -14,7 +15,7 @@ var setupModule = function () {
}

var testContent = function () {
controller.open(TEST_FOLDER + "form.html");
controller.open(TEST_URL);
controller.waitForPageLoad();

let textbox = new elementslib.ID(controller.tabs.activeTab, "fname");
Expand Down
6 changes: 3 additions & 3 deletions mutt/mutt/tests/js/elementslib/radio_buttons.js
Expand Up @@ -2,16 +2,16 @@
* 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/. */

const TEST_FOLDER = collector.addHttpResource('../_files/');

const BASE_URL = collector.addHttpResource('../_files/');
const TEST_URL = BASE_URL + "radio_button.html";

var setupModule = function () {
controller = mozmill.getBrowserController();
}

var test = function () {
// Test content
controller.open(TEST_FOLDER + "radio_button.html");
controller.open(TEST_URL);
controller.waitForPageLoad();

let radio1 = findElement.ID(controller.tabs.activeTab, "radio1");
Expand Down
6 changes: 3 additions & 3 deletions mutt/mutt/tests/js/elementslib/selector.js
Expand Up @@ -2,15 +2,15 @@
* 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/. */

const TEST_FOLDER = collector.addHttpResource('../_files/');

const BASE_URL = collector.addHttpResource('../_files/');
const TEST_URL = BASE_URL + "complex.html";

var setupModule = function () {
controller = mozmill.getBrowserController();
}

var test = function () {
controller.open(TEST_FOLDER + "complex.html");
controller.open(TEST_URL);
controller.waitForPageLoad();

var id = new elementslib.ID(controller.tabs.activeTab, "page-title");
Expand Down
8 changes: 4 additions & 4 deletions mutt/mutt/tests/js/elementslib/stale_element.js
Expand Up @@ -2,21 +2,21 @@
* 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/. */

const TEST_FOLDER = collector.addHttpResource('../_files/');
const TEST_PAGE = TEST_FOLDER + "singlediv.html";
const BASE_URL = collector.addHttpResource('../_files/');
const TEST_URL = BASE_URL + "singlediv.html";

var setupModule = function () {
controller = mozmill.getBrowserController();
}

var test = function () {
controller.open(TEST_PAGE);
controller.open(TEST_URL);
controller.waitForPageLoad();

var elem = new elementslib.ID(controller.tabs.activeTab, "test-div");
assert.ok(elem.getNode(), "Element has been found.");

controller.open(TEST_PAGE);
controller.open(TEST_URL);
controller.waitForPageLoad();

assert.ok(elem.getNode(), "Element can still be found after a page load.");
Expand Down
5 changes: 3 additions & 2 deletions mutt/mutt/tests/js/elementslib/utf-8.js
Expand Up @@ -2,7 +2,8 @@
* 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/. */

const TEST_FOLDER = collector.addHttpResource('../_files/');
const BASE_URL = collector.addHttpResource('../_files/');
const TEST_URL = BASE_URL + "form.html";

const TEST_STRINGS = [
"tanowiących",
Expand All @@ -14,7 +15,7 @@ var setupModule = function () {
};

var test = function () {
controller.open(TEST_FOLDER + "form.html");
controller.open(TEST_URL);
controller.waitForPageLoad();

var textbox = new elementslib.ID(controller.tabs.activeTab, "fname");
Expand Down
16 changes: 8 additions & 8 deletions mutt/mutt/tests/js/frame/httpd/testHTTPd1.js
Expand Up @@ -8,24 +8,24 @@
* successive tests will fail because of an inappropriate shutdown of the server
**/

var setupModule = function () {
baseURL = collector.addHttpResource('../../_files/');
testPages = [
baseURL + 'complex.html',
baseURL + 'singlediv.html'
];
const BASE_URL = collector.addHttpResource('../../_files/');
const TEST_URLS = [
BASE_URL + "complex.html",
BASE_URL + "singlediv.html"
];

var setupModule = function () {
controller = mozmill.getBrowserController();
}

var testOpenLocalPages = function () {
testPages.forEach(function (aPage) {
TEST_URLS.forEach(function (aPage) {
controller.open(aPage);
controller.waitForPageLoad();

controller.sleep(500);
});

controller.open(testPages[0]);
controller.open(TEST_URLS[0]);
controller.waitForPageLoad();
}
11 changes: 4 additions & 7 deletions mutt/mutt/tests/js/frame/httpd/testHTTPd2.js
Expand Up @@ -2,6 +2,9 @@
* 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/. */

const BASE_URL = collector.addHttpResource('../../_files/');
const TEST_URL = BASE_URL + "link.html";

Cu.import("resource://gre/modules/Services.jsm");


Expand All @@ -16,18 +19,12 @@ observer = {


var setupModule = function () {
baseURL = collector.addHttpResource('../../_files/');
testPages = [
baseURL + 'link.html'
];

controller = mozmill.getBrowserController();

Services.obs.addObserver(observer, "http-on-examine-response", false);
}

var testHttpFailure = function() {
controller.open(testPages[0]);
controller.open(TEST_URL);
controller.waitForPageLoad();

controller.waitFor(function () {
Expand Down
6 changes: 3 additions & 3 deletions mutt/mutt/tests/js/frame/syntax_error.js
Expand Up @@ -2,15 +2,15 @@
* 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/. */

const TEST_FOLDER = collector.addHttpResource('../_files/');

const BASE_URL = collector.addHttpResource('../_files/');
const TEST_URL = BASE_URL + "link.html";

var setupModule = function () {
controller = mozmill.getBrowserController();
}

var testErrorConsole = function () {
controller.open(TEST_FOLDER + "link.html");
controller.open(TEST_URL);
controller.waitForPageLoad();

// syntax error
Expand Down
9 changes: 3 additions & 6 deletions mutt/mutt/tests/js/l10n/getEntity.js
Expand Up @@ -3,23 +3,20 @@
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */

const { getEntity } = require("l10n");


const DTD_FILE = "chrome://branding/locale/brand.dtd";

const TEST_URL = "chrome://branding/locale/brand.dtd";

var test = function () {
// Test a known entity
try {
let value = getEntity([DTD_FILE], "vendorShortName");
let value = getEntity([TEST_URL], "vendorShortName");
expect.ok(value, "Localized content of a known entity has been retrieved");
} catch (e) {
expect.fail("Localized content of a known entity has not been retrieved");
}

// Test an invalid entity
try {
getEntity([DTD_FILE], "test_entity");
getEntity([TEST_URL], "test_entity");
expect.fail("Localized content of an unknown entity has been retrieved");
} catch (e) {
expect.pass("Localized content of an unknown entity has not been retrieved");
Expand Down

1 comment on commit ad5d625

@tojon
Copy link
Owner Author

@tojon tojon commented on ad5d625 Apr 9, 2013

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

All of the 27 Mutt tests above are passing with Default Nightly, with the exception of the following tests which have existing, known-failures. And as such will require extra attention in the review. Since they can't be run to confirm the change.

(known-fail) mutt/mutt/tests/js/elementslib/mozelement.js (bug 859844)
(known-fail) mutt/mutt/tests/js/elementslib/stale_element.js (bug 761600)
(known-fail) mutt/mutt/tests/js/elementslib/utf-8.js (bug 761603)
(known-fail) mutt/mutt/tests/js/utils/pageload_bfcache.js (bug 760720)
(known-fail) mutt/mutt/tests/python/js-tests/expectstack.js (bug 859965)

These two tests below are actually intended failures, so their behavior in continuing to fail, is correct. And in their case, addHttpResource was not used, as no file was loaded with the tests. So that line was removed.
(intended-fail) mutt/mutt/tests/python/js-tests/test_module2.js
(intended-fail) mutt/mutt/tests/python/js-tests/test_module3.js

Chrome XUL url's were also refactored, as requested.

Please sign in to comment.