зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1245355
- Add a unit test for tabs.getAllInWindow. r=kmag
MozReview-Commit-ID: 5wVRCLdCuq9 --HG-- extra : transplant_source : %D8%81M%1Fn%04%D4%09%87%C2%1C%FA%3E%F9z%05%E2%7C%AF%E0
This commit is contained in:
Родитель
4a5d71dedf
Коммит
842590013e
|
@ -543,11 +543,8 @@ extensions.registerSchemaAPI("tabs", null, (extension, context) => {
|
|||
},
|
||||
|
||||
getAllInWindow: function(windowId) {
|
||||
if (windowId === null) {
|
||||
windowId = WindowManager.topWindow.windowId;
|
||||
}
|
||||
|
||||
return self.tabs.query({windowId});
|
||||
let window = WindowManager.getWindow(windowId, context);
|
||||
return Promise.resolve(TabManager.for(extension).getTabs(window));
|
||||
},
|
||||
|
||||
query: function(queryInfo) {
|
||||
|
|
|
@ -39,6 +39,7 @@ support-files =
|
|||
[browser_ext_tabs_executeScript_runAt.js]
|
||||
[browser_ext_tabs_insertCSS.js]
|
||||
[browser_ext_tabs_query.js]
|
||||
[browser_ext_tabs_getAllInWindow.js]
|
||||
[browser_ext_tabs_getCurrent.js]
|
||||
[browser_ext_tabs_create.js]
|
||||
[browser_ext_tabs_create_invalid_url.js]
|
||||
|
|
|
@ -0,0 +1,22 @@
|
|||
/* -*- Mode: indent-tabs-mode: nil; js-indent-level: 2 -*- */
|
||||
/* vim: set sts=2 sw=2 et tw=80: */
|
||||
"use strict";
|
||||
|
||||
add_task(function* () {
|
||||
let extension = ExtensionTestUtils.loadExtension({
|
||||
manifest: {
|
||||
"permissions": ["tabs"],
|
||||
},
|
||||
|
||||
background: function() {
|
||||
browser.tabs.getAllInWindow(browser.windows.WINDOW_ID_CURRENT, tabs => {
|
||||
browser.test.assertEq(1, tabs.length, "There should be only 1 tab in the window");
|
||||
browser.test.notifyPass("tabs.getAllInWindow");
|
||||
});
|
||||
},
|
||||
});
|
||||
|
||||
yield extension.startup();
|
||||
yield extension.awaitFinish("tabs.getAllInWindow");
|
||||
yield extension.unload();
|
||||
});
|
Загрузка…
Ссылка в новой задаче