Bug 1070250 - Split browser_toolbox_options_disable_cache.js into two separate tests to avoid timeouts. r=miker

--HG--
rename : browser/devtools/framework/test/browser_toolbox_options_disable_cache.js => browser/devtools/framework/test/browser_toolbox_options_disable_cache-01.js
This commit is contained in:
Sami Jaktholm 2014-12-30 19:25:21 +02:00
Родитель c682da92a7
Коммит fc956ec19d
5 изменённых файлов: 96 добавлений и 36 удалений

Просмотреть файл

@ -5,6 +5,7 @@ support-files =
browser_toolbox_options_disable_js_iframe.html
browser_toolbox_options_disable_cache.sjs
head.js
helper_disable_cache.js
doc_theme.css
[browser_devtools_api.js]
@ -25,7 +26,9 @@ skip-if = e10s # Bug 1070837 - devtools/framework/toolbox.js |doc| getter not e1
[browser_toolbox_options.js]
[browser_toolbox_options_devedition.js]
[browser_toolbox_options_disable_buttons.js]
[browser_toolbox_options_disable_cache.js]
[browser_toolbox_options_disable_cache-01.js]
skip-if = e10s # Bug 1030318
[browser_toolbox_options_disable_cache-02.js]
skip-if = e10s # Bug 1030318
[browser_toolbox_options_disable_js.js]
skip-if = e10s # Bug 1070837 - devtools/framework/toolbox.js |doc| getter not e10s friendly

Просмотреть файл

@ -0,0 +1,30 @@
/* vim: set ts=2 et sw=2 tw=80: */
/* Any copyright is dedicated to the Public Domain.
* http://creativecommons.org/publicdomain/zero/1.0/ */
"use strict";
// Tests that disabling the cache for a tab works as it should when toolboxes
// are not toggled.
loadHelperScript("helper_disable_cache.js");
add_task(function*() {
// Ensure that the setting is cleared after the test.
registerCleanupFunction(() => {
info("Resetting devtools.cache.disabled to false.");
Services.prefs.setBoolPref("devtools.cache.disabled", false);
});
// Initialise tabs: 1 and 2 with a toolbox, 3 and 4 without.
for (let tab of tabs) {
yield initTab(tab, tab.startToolbox);
}
// Ensure cache is enabled for all tabs.
yield checkCacheStateForAllTabs([true, true, true, true]);
// Check the checkbox in tab 0 and ensure cache is disabled for tabs 0 and 1.
yield setDisableCacheCheckboxChecked(tabs[0], true);
yield checkCacheStateForAllTabs([false, false, true, true]);
yield finishUp();
});

Просмотреть файл

@ -0,0 +1,43 @@
/* vim: set ts=2 et sw=2 tw=80: */
/* Any copyright is dedicated to the Public Domain.
* http://creativecommons.org/publicdomain/zero/1.0/ */
"use strict";
// Tests that disabling the cache for a tab works as it should when toolboxes
// are toggled.
loadHelperScript("helper_disable_cache.js");
add_task(function*() {
// Ensure that the setting is cleared after the test.
registerCleanupFunction(() => {
info("Resetting devtools.cache.disabled to false.");
Services.prefs.setBoolPref("devtools.cache.disabled", false);
});
// Initialise tabs: 1 and 2 with a toolbox, 3 and 4 without.
for (let tab of tabs) {
yield initTab(tab, tab.startToolbox);
}
// Disable cache in tab 0
yield setDisableCacheCheckboxChecked(tabs[0], true);
// Open toolbox in tab 2 and ensure the cache is then disabled.
tabs[2].toolbox = yield gDevTools.showToolbox(tabs[2].target, "options");
yield checkCacheEnabled(tabs[2], false);
// Close toolbox in tab 2 and ensure the cache is enabled again
yield tabs[2].toolbox.destroy();
tabs[2].target = TargetFactory.forTab(tabs[2].tab);
yield checkCacheEnabled(tabs[2], true);
// Open toolbox in tab 2 and ensure the cache is then disabled.
tabs[2].toolbox = yield gDevTools.showToolbox(tabs[2].target, "options");
yield checkCacheEnabled(tabs[2], false);
// Check the checkbox in tab 2 and ensure cache is enabled for all tabs.
yield setDisableCacheCheckboxChecked(tabs[2], false);
yield checkCacheStateForAllTabs([true, true, true, true]);
yield finishUp();
});

Просмотреть файл

@ -115,6 +115,22 @@ function once(target, eventName, useCapture=false) {
return deferred.promise;
}
/**
* Some tests may need to import one or more of the test helper scripts.
* A test helper script is simply a js file that contains common test code that
* is either not common-enough to be in head.js, or that is located in a separate
* directory.
* The script will be loaded synchronously and in the test's scope.
* @param {String} filePath The file path, relative to the current directory.
* Examples:
* - "helper_attributes_test_runner.js"
* - "../../../commandline/test/helpers.js"
*/
function loadHelperScript(filePath) {
let testDir = gTestPath.substr(0, gTestPath.lastIndexOf("/"));
Services.scriptloader.loadSubScript(testDir + "/" + filePath, this);
}
function waitForTick() {
let deferred = promise.defer();
executeSoon(deferred.resolve);

Просмотреть файл

@ -1,8 +1,9 @@
/* vim: set ts=2 et sw=2 tw=80: */
/* Any copyright is dedicated to the Public Domain.
* http://creativecommons.org/publicdomain/zero/1.0/ */
"use strict";
// Tests that disabling the cache for a tab works as it should.
// Common code shared by browser_toolbox_options_disable_cache-*.js
const TEST_URI = "http://mochi.test:8888/browser/browser/devtools/framework/" +
"test/browser_toolbox_options_disable_cache.sjs";
let tabs = [
@ -27,39 +28,6 @@ let tabs = [
startToolbox: false
}];
add_task(function*() {
// Initialise tabs: 1 and 2 with a toolbox, 3 and 4 without.
for (let tab of tabs) {
yield initTab(tab, tab.startToolbox);
}
// Ensure cache is enabled for all tabs.
yield checkCacheStateForAllTabs([true, true, true, true]);
// Check the checkbox in tab 0 and ensure cache is disabled for tabs 0 and 1.
yield setDisableCacheCheckboxChecked(tabs[0], true);
yield checkCacheStateForAllTabs([false, false, true, true]);
// Open toolbox in tab 2 and ensure the cache is then disabled.
tabs[2].toolbox = yield gDevTools.showToolbox(tabs[2].target, "options");
yield checkCacheEnabled(tabs[2], false);
// Close toolbox in tab 2 and ensure the cache is enabled again
yield tabs[2].toolbox.destroy();
tabs[2].target = TargetFactory.forTab(tabs[2].tab);
yield checkCacheEnabled(tabs[2], true);
// Open toolbox in tab 2 and ensure the cache is then disabled.
tabs[2].toolbox = yield gDevTools.showToolbox(tabs[2].target, "options");
yield checkCacheEnabled(tabs[2], false);
// Check the checkbox in tab 2 and ensure cache is enabled for all tabs.
yield setDisableCacheCheckboxChecked(tabs[2], false);
yield checkCacheStateForAllTabs([true, true, true, true]);
yield finishUp();
});
function* initTab(tabX, startToolbox) {
tabX.tab = yield addTab(TEST_URI);
tabX.target = TargetFactory.forTab(tabX.tab);