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

Side by Side Diff: chrome/browser/extensions/options_page_apitest.cc

Issue 11734018: Revert 174880 due to compilation error in pdf_browsertest.cc (Closed) Base URL: svn://svn.chromium.org/chrome/branches/1374/src/
Patch Set: Created 7 years, 11 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
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 "chrome/browser/extensions/extension_browsertest.h" 5 #include "chrome/browser/extensions/extension_browsertest.h"
6 #include "chrome/browser/extensions/extension_service.h" 6 #include "chrome/browser/extensions/extension_service.h"
7 #include "chrome/browser/extensions/extension_system.h" 7 #include "chrome/browser/extensions/extension_system.h"
8 #include "chrome/browser/ui/browser.h" 8 #include "chrome/browser/ui/browser.h"
9 #include "chrome/browser/ui/browser_tabstrip.h" 9 #include "chrome/browser/ui/browser_tabstrip.h"
10 #include "chrome/browser/ui/tabs/tab_strip_model.h" 10 #include "chrome/browser/ui/tabs/tab_strip_model.h"
11 #include "chrome/common/extensions/extension.h" 11 #include "chrome/common/extensions/extension.h"
12 #include "chrome/common/url_constants.h" 12 #include "chrome/common/url_constants.h"
13 #include "chrome/test/base/ui_test_utils.h" 13 #include "chrome/test/base/ui_test_utils.h"
14 #include "content/public/test/browser_test_utils.h" 14 #include "content/public/test/browser_test_utils.h"
15 15
16 using extensions::Extension; 16 using extensions::Extension;
17 17
18 // Used to simulate a click on the first button named 'Options'. 18 // Used to simulate a click on the first button named 'Options'.
19 static const char kScriptClickOptionButton[] = 19 static const wchar_t* jscript_click_option_button =
20 "(function() { " 20 L"(function() { "
21 " var button = document.evaluate(\"//button[text()='Options']\"," 21 L" var button = document.evaluate(\"//button[text()='Options']\","
22 " document, null, XPathResult.UNORDERED_NODE_SNAPSHOT_TYPE," 22 L" document, null, XPathResult.UNORDERED_NODE_SNAPSHOT_TYPE,"
23 " null).snapshotItem(0);" 23 L" null).snapshotItem(0);"
24 " button.click();" 24 L" button.click();"
25 "})();"; 25 L"})();";
26 26
27 // Test that an extension with an options page makes an 'Options' button appear 27 // Test that an extension with an options page makes an 'Options' button appear
28 // on chrome://extensions, and that clicking the button opens a new tab with the 28 // on chrome://extensions, and that clicking the button opens a new tab with the
29 // extension's options page. 29 // extension's options page.
30 // Disabled. See http://crbug.com/26948 for details. 30 // Disabled. See http://crbug.com/26948 for details.
31 IN_PROC_BROWSER_TEST_F(ExtensionBrowserTest, DISABLED_OptionsPage) { 31 IN_PROC_BROWSER_TEST_F(ExtensionBrowserTest, DISABLED_OptionsPage) {
32 // Install an extension with an options page. 32 // Install an extension with an options page.
33 const Extension* extension = 33 const Extension* extension =
34 InstallExtension(test_data_dir_.AppendASCII("options.crx"), 1); 34 InstallExtension(test_data_dir_.AppendASCII("options.crx"), 1);
35 ASSERT_TRUE(extension); 35 ASSERT_TRUE(extension);
36 ExtensionService* service = extensions::ExtensionSystem::Get( 36 ExtensionService* service = extensions::ExtensionSystem::Get(
37 browser()->profile())->extension_service(); 37 browser()->profile())->extension_service();
38 ASSERT_EQ(1u, service->extensions()->size()); 38 ASSERT_EQ(1u, service->extensions()->size());
39 39
40 // Go to the Extension Settings page and click the Options button. 40 // Go to the Extension Settings page and click the Options button.
41 ui_test_utils::NavigateToURL(browser(), GURL(chrome::kChromeUIExtensionsURL)); 41 ui_test_utils::NavigateToURL(browser(), GURL(chrome::kChromeUIExtensionsURL));
42 TabStripModel* tab_strip = browser()->tab_strip_model(); 42 TabStripModel* tab_strip = browser()->tab_strip_model();
43 ASSERT_TRUE(content::ExecuteJavaScript( 43 ASSERT_TRUE(content::ExecuteJavaScript(
44 tab_strip->GetActiveWebContents()->GetRenderViewHost(), 44 tab_strip->GetActiveWebContents()->GetRenderViewHost(), L"",
45 "", 45 jscript_click_option_button));
46 kScriptClickOptionButton));
47 46
48 // If the options page hasn't already come up, wait for it. 47 // If the options page hasn't already come up, wait for it.
49 if (tab_strip->count() == 1) { 48 if (tab_strip->count() == 1) {
50 ui_test_utils::WaitForNewTab(browser()); 49 ui_test_utils::WaitForNewTab(browser());
51 } 50 }
52 ASSERT_EQ(2, tab_strip->count()); 51 ASSERT_EQ(2, tab_strip->count());
53 52
54 EXPECT_EQ(extension->GetResourceURL("options.html"), 53 EXPECT_EQ(extension->GetResourceURL("options.html"),
55 tab_strip->GetWebContentsAt(1)->GetURL()); 54 tab_strip->GetWebContentsAt(1)->GetURL());
56 } 55 }
OLDNEW
« no previous file with comments | « chrome/browser/extensions/lazy_background_page_apitest.cc ('k') | chrome/browser/extensions/plugin_apitest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698