OLD | NEW |
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/ui/browser.h" | 7 #include "chrome/browser/ui/browser.h" |
| 8 #include "chrome/browser/ui/browser_tabstrip.h" |
8 #include "chrome/browser/ui/tab_contents/tab_contents.h" | 9 #include "chrome/browser/ui/tab_contents/tab_contents.h" |
9 #include "chrome/browser/ui/tabs/tab_strip_model.h" | 10 #include "chrome/browser/ui/tabs/tab_strip_model.h" |
10 #include "chrome/common/extensions/extension.h" | 11 #include "chrome/common/extensions/extension.h" |
11 #include "chrome/common/url_constants.h" | 12 #include "chrome/common/url_constants.h" |
12 #include "chrome/test/base/ui_test_utils.h" | 13 #include "chrome/test/base/ui_test_utils.h" |
13 | 14 |
14 using extensions::Extension; | 15 using extensions::Extension; |
15 | 16 |
16 // Used to simulate a click on the first button named 'Options'. | 17 // Used to simulate a click on the first button named 'Options'. |
17 static const wchar_t* jscript_click_option_button = | 18 static const wchar_t* jscript_click_option_button = |
(...skipping 13 matching lines...) Expand all Loading... |
31 const Extension* extension = | 32 const Extension* extension = |
32 InstallExtension(test_data_dir_.AppendASCII("options.crx"), 1); | 33 InstallExtension(test_data_dir_.AppendASCII("options.crx"), 1); |
33 ASSERT_TRUE(extension); | 34 ASSERT_TRUE(extension); |
34 ExtensionService* service = browser()->profile()->GetExtensionService(); | 35 ExtensionService* service = browser()->profile()->GetExtensionService(); |
35 ASSERT_EQ(1u, service->extensions()->size()); | 36 ASSERT_EQ(1u, service->extensions()->size()); |
36 | 37 |
37 // Go to the Extension Settings page and click the Options button. | 38 // Go to the Extension Settings page and click the Options button. |
38 ui_test_utils::NavigateToURL(browser(), GURL(chrome::kChromeUIExtensionsURL)); | 39 ui_test_utils::NavigateToURL(browser(), GURL(chrome::kChromeUIExtensionsURL)); |
39 TabStripModel* tab_strip = browser()->tab_strip_model(); | 40 TabStripModel* tab_strip = browser()->tab_strip_model(); |
40 ASSERT_TRUE(ui_test_utils::ExecuteJavaScript( | 41 ASSERT_TRUE(ui_test_utils::ExecuteJavaScript( |
41 browser()->GetActiveWebContents()->GetRenderViewHost(), L"", | 42 chrome::GetActiveWebContents(browser())->GetRenderViewHost(), L"", |
42 jscript_click_option_button)); | 43 jscript_click_option_button)); |
43 | 44 |
44 // If the options page hasn't already come up, wait for it. | 45 // If the options page hasn't already come up, wait for it. |
45 if (tab_strip->count() == 1) { | 46 if (tab_strip->count() == 1) { |
46 ui_test_utils::WaitForNewTab(browser()); | 47 ui_test_utils::WaitForNewTab(browser()); |
47 } | 48 } |
48 ASSERT_EQ(2, tab_strip->count()); | 49 ASSERT_EQ(2, tab_strip->count()); |
49 | 50 |
50 EXPECT_EQ(extension->GetResourceURL("options.html"), | 51 EXPECT_EQ(extension->GetResourceURL("options.html"), |
51 tab_strip->GetTabContentsAt(1)->web_contents()->GetURL()); | 52 tab_strip->GetTabContentsAt(1)->web_contents()->GetURL()); |
52 } | 53 } |
OLD | NEW |