зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1264573 - Share tabs in isolation tests. r=baku, r=arthuredelstein
--HG-- extra : rebase_source : 5f51c24993639f8571450871b5b868b712a66aa5
This commit is contained in:
Родитель
e125aeb6c8
Коммит
eb2ea553d6
|
@ -87,8 +87,11 @@ function doTest(blobify, deblobify) {
|
|||
}
|
||||
}
|
||||
|
||||
let tests = [];
|
||||
for (let blobify of [page_blobify, worker_blobify]) {
|
||||
for (let deblobify of [page_deblobify, worker_deblobify]) {
|
||||
IsolationTestTools.runTests(TEST_PAGE, doTest(blobify, deblobify));
|
||||
tests.push(doTest(blobify, deblobify));
|
||||
}
|
||||
}
|
||||
|
||||
IsolationTestTools.runTests(TEST_PAGE, tests);
|
||||
|
|
|
@ -259,11 +259,11 @@ this.IsolationTestTools = {
|
|||
* The URL of the page that will be tested or an object contains 'url',
|
||||
* the tested page, 'firstFrameSetting' for the frame setting of the first
|
||||
* tab, and 'secondFrameSetting' for the second tab.
|
||||
* @param aGetResultFunc
|
||||
* A function which is responsible for returning the isolation result back
|
||||
* to the framework for further checking. This function will be provided
|
||||
* the browser object of the tab, that allows modifying or fetching results
|
||||
* from the page content.
|
||||
* @param aGetResultFuncs
|
||||
* An array of functions or a single function which are responsible for
|
||||
* returning the isolation result back to the framework for further checking.
|
||||
* Each of these functions will be provided the browser object of the tab,
|
||||
* that allows modifying or fetchings results from the page content.
|
||||
* @param aCompareResultFunc
|
||||
* An optional function which allows modifying the way how does framework
|
||||
* check results. This function will be provided a boolean to indicate
|
||||
|
@ -271,7 +271,7 @@ this.IsolationTestTools = {
|
|||
* a boolean to tell that whether isolation is working. If this function
|
||||
* is not given, the framework will take case checking by itself.
|
||||
*/
|
||||
runTests(aURL, aGetResultFunc, aCompareResultFunc) {
|
||||
runTests(aURL, aGetResultFuncs, aCompareResultFunc) {
|
||||
let pageURL;
|
||||
let firstFrameSetting;
|
||||
let secondFrameSetting;
|
||||
|
@ -284,6 +284,10 @@ this.IsolationTestTools = {
|
|||
secondFrameSetting = aURL.secondFrameSetting;
|
||||
}
|
||||
|
||||
if (!Array.isArray(aGetResultFuncs)) {
|
||||
aGetResultFuncs = [aGetResultFuncs];
|
||||
}
|
||||
|
||||
let tabSettings = [
|
||||
{ firstPartyDomain: "http://example.com", userContextId: 1},
|
||||
{ firstPartyDomain: "http://example.org", userContextId: 2}
|
||||
|
@ -303,13 +307,10 @@ this.IsolationTestTools = {
|
|||
tabSettings[tabSettingB],
|
||||
secondFrameSetting);
|
||||
|
||||
for (let getResultFunc of aGetResultFuncs) {
|
||||
// Fetch results from tabs.
|
||||
let resultA = yield aGetResultFunc(tabInfoA.browser);
|
||||
let resultB = yield aGetResultFunc(tabInfoB.browser);
|
||||
|
||||
// Close Tabs.
|
||||
yield BrowserTestUtils.removeTab(tabInfoA.tab);
|
||||
yield BrowserTestUtils.removeTab(tabInfoB.tab);
|
||||
let resultA = yield getResultFunc(tabInfoA.browser);
|
||||
let resultB = yield getResultFunc(tabInfoB.browser);
|
||||
|
||||
// Compare results.
|
||||
let result = false;
|
||||
|
@ -324,11 +325,16 @@ this.IsolationTestTools = {
|
|||
|
||||
let msg = `Testing ${TEST_MODE_NAMES[aMode]} for ` +
|
||||
`isolation ${shouldIsolate ? "on" : "off"} with TabSettingA ` +
|
||||
`${tabSettingA} and tabSettingB ${tabSettingB}`;
|
||||
`${tabSettingA} and tabSettingB ${tabSettingB}` +
|
||||
`, resultA = ${resultA}, resultB = ${resultB}`;
|
||||
|
||||
ok(result, msg);
|
||||
}
|
||||
|
||||
// Close Tabs.
|
||||
yield BrowserTestUtils.removeTab(tabInfoA.tab);
|
||||
yield BrowserTestUtils.removeTab(tabInfoB.tab);
|
||||
}
|
||||
});
|
||||
}
|
||||
};
|
||||
|
|
Загрузка…
Ссылка в новой задаче