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/ui/browser.h" | 6 #include "chrome/browser/ui/browser.h" |
| 7 #include "chrome/browser/ui/browser_tabstrip.h" |
7 #include "chrome/test/base/ui_test_utils.h" | 8 #include "chrome/test/base/ui_test_utils.h" |
8 | 9 |
9 // Tests that we can load extension pages into the tab area and they can call | 10 // Tests that we can load extension pages into the tab area and they can call |
10 // extension APIs. | 11 // extension APIs. |
11 IN_PROC_BROWSER_TEST_F(ExtensionBrowserTest, WebContents) { | 12 IN_PROC_BROWSER_TEST_F(ExtensionBrowserTest, WebContents) { |
12 ASSERT_TRUE(LoadExtension( | 13 ASSERT_TRUE(LoadExtension( |
13 test_data_dir_.AppendASCII("good").AppendASCII("Extensions") | 14 test_data_dir_.AppendASCII("good").AppendASCII("Extensions") |
14 .AppendASCII("behllobkkfkfnphdnhnkndlbkcpglgmj") | 15 .AppendASCII("behllobkkfkfnphdnhnkndlbkcpglgmj") |
15 .AppendASCII("1.0.0.0"))); | 16 .AppendASCII("1.0.0.0"))); |
16 | 17 |
17 ui_test_utils::NavigateToURL( | 18 ui_test_utils::NavigateToURL( |
18 browser(), | 19 browser(), |
19 GURL("chrome-extension://behllobkkfkfnphdnhnkndlbkcpglgmj/page.html")); | 20 GURL("chrome-extension://behllobkkfkfnphdnhnkndlbkcpglgmj/page.html")); |
20 | 21 |
21 bool result = false; | 22 bool result = false; |
22 ASSERT_TRUE(ui_test_utils::ExecuteJavaScriptAndExtractBool( | 23 ASSERT_TRUE(ui_test_utils::ExecuteJavaScriptAndExtractBool( |
23 browser()->GetActiveWebContents()->GetRenderViewHost(), L"", | 24 chrome::GetActiveWebContents(browser())->GetRenderViewHost(), L"", |
24 L"testTabsAPI()", &result)); | 25 L"testTabsAPI()", &result)); |
25 EXPECT_TRUE(result); | 26 EXPECT_TRUE(result); |
26 | 27 |
27 // There was a bug where we would crash if we navigated to a page in the same | 28 // There was a bug where we would crash if we navigated to a page in the same |
28 // extension because no new render view was getting created, so we would not | 29 // extension because no new render view was getting created, so we would not |
29 // do some setup. | 30 // do some setup. |
30 ui_test_utils::NavigateToURL( | 31 ui_test_utils::NavigateToURL( |
31 browser(), | 32 browser(), |
32 GURL("chrome-extension://behllobkkfkfnphdnhnkndlbkcpglgmj/page.html")); | 33 GURL("chrome-extension://behllobkkfkfnphdnhnkndlbkcpglgmj/page.html")); |
33 result = false; | 34 result = false; |
34 ASSERT_TRUE(ui_test_utils::ExecuteJavaScriptAndExtractBool( | 35 ASSERT_TRUE(ui_test_utils::ExecuteJavaScriptAndExtractBool( |
35 browser()->GetActiveWebContents()->GetRenderViewHost(), L"", | 36 chrome::GetActiveWebContents(browser())->GetRenderViewHost(), L"", |
36 L"testTabsAPI()", &result)); | 37 L"testTabsAPI()", &result)); |
37 EXPECT_TRUE(result); | 38 EXPECT_TRUE(result); |
38 } | 39 } |
OLD | NEW |