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

Unified Diff: chrome/browser/extensions/extension_browsertests_misc.cc

Issue 271114: Add concept of an options page to Extensions.... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 11 years, 2 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 | chrome/browser/extensions/extensions_ui.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/extensions/extension_browsertests_misc.cc
===================================================================
--- chrome/browser/extensions/extension_browsertests_misc.cc (revision 29288)
+++ chrome/browser/extensions/extension_browsertests_misc.cc (working copy)
@@ -788,3 +788,41 @@
ASSERT_EQ("2.0", extensions->at(0)->VersionString());
}
+// Used to simulate a click on the first button named 'Options'.
+static const wchar_t* jscript_click_option_button =
+ L"(function() { "
+ L" var button = document.evaluate(\"//button[text()='Options']\","
+ L" document, null, XPathResult.UNORDERED_NODE_SNAPSHOT_TYPE,"
+ L" null).snapshotItem(0);"
+ L" button.click();"
+ L" window.domAutomationController.send(0);"
+ L"})();";
+
+// Test that an extension with an options page makes an 'Options' button appear
+// on chrome://extensions, and that clicking the button opens a new tab with the
+// extension's options page.
+IN_PROC_BROWSER_TEST_F(ExtensionBrowserTest, OptionsPage) {
+ // Install an extension with an options page.
+ ASSERT_TRUE(InstallExtension(test_data_dir_.AppendASCII("options.crx"), 1));
+ ExtensionsService* service = browser()->profile()->GetExtensionsService();
+ const ExtensionList* extensions = service->extensions();
+ ASSERT_EQ(1u, extensions->size());
+ Extension* extension = extensions->at(0);
+
+ // Go to the chrome://extensions page and click the Options button.
+ ui_test_utils::NavigateToURL(browser(), GURL(chrome::kChromeUIExtensionsURL));
+ TabStripModel* tab_strip = browser()->tabstrip_model();
+ TabContents* extensions_tab = browser()->GetSelectedTabContents();
+ ui_test_utils::ExecuteJavaScript(extensions_tab->render_view_host(), L"",
+ jscript_click_option_button);
+
+ // If the options page hasn't already come up, wait for it.
+ if (tab_strip->count() == 1) {
+ ui_test_utils::WaitForNewTab(browser());
+ }
+ ASSERT_EQ(2, tab_strip->count());
+
+ EXPECT_EQ(extension->GetResourceURL("options.html"),
+ tab_strip->GetTabContentsAt(1)->GetURL());
+}
+
« no previous file with comments | « no previous file | chrome/browser/extensions/extensions_ui.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698