Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(207)

Unified Diff: chrome/test/data/extensions/api_test/runtime/open_options_page/test.js

Issue 1850593002: Enable ExtensionApiTest.ChromeRuntimeOpenOptionsPage. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: address comments Created 4 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | extensions/browser/api/runtime/runtime_apitest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/test/data/extensions/api_test/runtime/open_options_page/test.js
diff --git a/chrome/test/data/extensions/api_test/runtime/open_options_page/test.js b/chrome/test/data/extensions/api_test/runtime/open_options_page/test.js
index 049167a8525b59907ed3f308a2d459d7db4fe34f..68c8581c6284eabca641af82ed42ff3357ee7a2c 100644
--- a/chrome/test/data/extensions/api_test/runtime/open_options_page/test.js
+++ b/chrome/test/data/extensions/api_test/runtime/open_options_page/test.js
@@ -7,7 +7,7 @@
var assertEq = chrome.test.assertEq;
var assertTrue = chrome.test.assertTrue;
var listenOnce = chrome.test.listenOnce;
-var pass = chrome.test.callbackPass;
+var callbackPass = chrome.test.callbackPass;
var optionsTabUrl = 'chrome://extensions/?options=' + chrome.runtime.id;
@@ -15,7 +15,7 @@ var optionsTabUrl = 'chrome://extensions/?options=' + chrome.runtime.id;
// Asserts that there is at most 1 options page open.
// Result is passed to |callback|.
function findOptionsTab(callback) {
- chrome.tabs.query({url: optionsTabUrl}, pass(function(tabs) {
+ chrome.tabs.query({url: optionsTabUrl}, callbackPass(function(tabs) {
assertTrue(tabs.length <= 1);
callback(tabs.length == 0 ? null : tabs[0]);
}));
@@ -30,14 +30,14 @@ function testNewOptionsPage() {
assertEq(chrome.runtime.id, sender.id);
assertEq(chrome.runtime.getURL('options.html'), sender.url);
});
- chrome.runtime.openOptionsPage();
+ chrome.runtime.openOptionsPage(callbackPass());
});
}
// Gets the active tab, or null if no tab is active. Asserts that there is at
// most 1 active tab. Result is passed to |callback|.
function getActiveTab(callback) {
- chrome.tabs.query({active: true}, pass(function(tabs) {
+ chrome.tabs.query({active: true}, callbackPass(function(tabs) {
assertTrue(tabs.length <= 1);
callback(tabs.length == 0 ? null : tabs[0]);
}));
@@ -45,21 +45,24 @@ function getActiveTab(callback) {
// Tests refocusing an existing page.
function testRefocusExistingOptionsPage() {
- var testUrl = 'chrome://chrome/';
+ // Note that using chrome://chrome/ as |testUrl| would be problematic here,
+ // because the options page will happily overwrite the tab pointing to it.
+ var testUrl = 'about:blank';
// There will already be an options page open from the last test. Find it,
// focus away from it, then make sure openOptionsPage() refocuses it.
findOptionsTab(function(optionsTab) {
assertTrue(optionsTab != null);
- chrome.tabs.create({url: testUrl}, pass(function(tab) {
+ chrome.tabs.create({url: testUrl}, callbackPass(function(tab) {
// Make sure the new tab is active.
getActiveTab(function(activeTab) {
assertEq(testUrl, activeTab.url);
// Open options page should refocus it.
- chrome.runtime.openOptionsPage();
- getActiveTab(function(activeTab) {
- assertEq(optionsTabUrl, activeTab.url);
- });
+ chrome.runtime.openOptionsPage(callbackPass(function() {
+ getActiveTab(function(activeTab) {
+ assertEq(optionsTabUrl, activeTab.url);
+ });
+ }));
});
}));
});
« no previous file with comments | « no previous file | extensions/browser/api/runtime/runtime_apitest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698