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

Side by Side 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | chrome/browser/extensions/extensions_ui.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2009 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "base/ref_counted.h" 5 #include "base/ref_counted.h"
6 #include "chrome/browser/browser.h" 6 #include "chrome/browser/browser.h"
7 #include "chrome/browser/browser_list.h" 7 #include "chrome/browser/browser_list.h"
8 #include "chrome/browser/renderer_host/render_view_host.h" 8 #include "chrome/browser/renderer_host/render_view_host.h"
9 #include "chrome/browser/extensions/autoupdate_interceptor.h" 9 #include "chrome/browser/extensions/autoupdate_interceptor.h"
10 #include "chrome/browser/extensions/extension_browsertest.h" 10 #include "chrome/browser/extensions/extension_browsertest.h"
(...skipping 770 matching lines...) Expand 10 before | Expand all | Expand 10 after
781 service->updater()->CheckNow(); 781 service->updater()->CheckNow();
782 ASSERT_TRUE(WaitForExtensionInstallError()); 782 ASSERT_TRUE(WaitForExtensionInstallError());
783 783
784 // Make sure the extension state is the same as before. 784 // Make sure the extension state is the same as before.
785 extensions = service->extensions(); 785 extensions = service->extensions();
786 ASSERT_EQ(1u, extensions->size()); 786 ASSERT_EQ(1u, extensions->size());
787 ASSERT_EQ("ogjcoiohnmldgjemafoockdghcjciccf", extensions->at(0)->id()); 787 ASSERT_EQ("ogjcoiohnmldgjemafoockdghcjciccf", extensions->at(0)->id());
788 ASSERT_EQ("2.0", extensions->at(0)->VersionString()); 788 ASSERT_EQ("2.0", extensions->at(0)->VersionString());
789 } 789 }
790 790
791 // Used to simulate a click on the first button named 'Options'.
792 static const wchar_t* jscript_click_option_button =
793 L"(function() { "
794 L" var button = document.evaluate(\"//button[text()='Options']\","
795 L" document, null, XPathResult.UNORDERED_NODE_SNAPSHOT_TYPE,"
796 L" null).snapshotItem(0);"
797 L" button.click();"
798 L" window.domAutomationController.send(0);"
799 L"})();";
800
801 // Test that an extension with an options page makes an 'Options' button appear
802 // on chrome://extensions, and that clicking the button opens a new tab with the
803 // extension's options page.
804 IN_PROC_BROWSER_TEST_F(ExtensionBrowserTest, OptionsPage) {
805 // Install an extension with an options page.
806 ASSERT_TRUE(InstallExtension(test_data_dir_.AppendASCII("options.crx"), 1));
807 ExtensionsService* service = browser()->profile()->GetExtensionsService();
808 const ExtensionList* extensions = service->extensions();
809 ASSERT_EQ(1u, extensions->size());
810 Extension* extension = extensions->at(0);
811
812 // Go to the chrome://extensions page and click the Options button.
813 ui_test_utils::NavigateToURL(browser(), GURL(chrome::kChromeUIExtensionsURL));
814 TabStripModel* tab_strip = browser()->tabstrip_model();
815 TabContents* extensions_tab = browser()->GetSelectedTabContents();
816 ui_test_utils::ExecuteJavaScript(extensions_tab->render_view_host(), L"",
817 jscript_click_option_button);
818
819 // If the options page hasn't already come up, wait for it.
820 if (tab_strip->count() == 1) {
821 ui_test_utils::WaitForNewTab(browser());
822 }
823 ASSERT_EQ(2, tab_strip->count());
824
825 EXPECT_EQ(extension->GetResourceURL("options.html"),
826 tab_strip->GetTabContentsAt(1)->GetURL());
827 }
828
OLDNEW
« 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