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/ui/browser.h" | 5 #include "chrome/browser/ui/browser.h" |
| 6 #include "chrome/browser/ui/browser_tabstrip.h" |
6 #include "chrome/common/url_constants.h" | 7 #include "chrome/common/url_constants.h" |
7 #include "chrome/test/base/in_process_browser_test.h" | 8 #include "chrome/test/base/in_process_browser_test.h" |
8 #include "chrome/test/base/ui_test_utils.h" | 9 #include "chrome/test/base/ui_test_utils.h" |
9 #include "content/public/browser/navigation_details.h" | 10 #include "content/public/browser/navigation_details.h" |
10 #include "content/public/browser/web_contents.h" | 11 #include "content/public/browser/web_contents.h" |
11 | 12 |
12 using content::WebContents; | 13 using content::WebContents; |
13 | 14 |
14 namespace { | 15 namespace { |
15 | 16 |
(...skipping 18 matching lines...) Expand all Loading... |
34 ASSERT_TRUE(test_server()->Start()); | 35 ASSERT_TRUE(test_server()->Start()); |
35 GURL url = test_server()->GetURL(kSharedWorkerTestPage); | 36 GURL url = test_server()->GetURL(kSharedWorkerTestPage); |
36 ui_test_utils::NavigateToURL(browser(), url); | 37 ui_test_utils::NavigateToURL(browser(), url); |
37 | 38 |
38 ui_test_utils::NavigateToURLWithDisposition( | 39 ui_test_utils::NavigateToURLWithDisposition( |
39 browser(), | 40 browser(), |
40 GURL(chrome::kChromeUIInspectURL), | 41 GURL(chrome::kChromeUIInspectURL), |
41 NEW_FOREGROUND_TAB, | 42 NEW_FOREGROUND_TAB, |
42 ui_test_utils::BROWSER_TEST_WAIT_FOR_NAVIGATION); | 43 ui_test_utils::BROWSER_TEST_WAIT_FOR_NAVIGATION); |
43 | 44 |
44 WebContents* web_contents = browser()->GetActiveWebContents(); | 45 WebContents* web_contents = chrome::GetActiveWebContents(browser()); |
45 ASSERT_TRUE(web_contents != NULL); | 46 ASSERT_TRUE(web_contents != NULL); |
46 | 47 |
47 std::string result; | 48 std::string result; |
48 ASSERT_TRUE( | 49 ASSERT_TRUE( |
49 ui_test_utils::ExecuteJavaScriptAndExtractString( | 50 ui_test_utils::ExecuteJavaScriptAndExtractString( |
50 web_contents->GetRenderViewHost(), | 51 web_contents->GetRenderViewHost(), |
51 L"", | 52 L"", |
52 L"window.domAutomationController.send(" | 53 L"window.domAutomationController.send(" |
53 L"'' + document.body.textContent);", | 54 L"'' + document.body.textContent);", |
54 &result)); | 55 &result)); |
55 ASSERT_TRUE(result.find(kSharedWorkerJs) != std::string::npos); | 56 ASSERT_TRUE(result.find(kSharedWorkerJs) != std::string::npos); |
56 ASSERT_TRUE(result.find(kSharedWorkerTestPage) != std::string::npos); | 57 ASSERT_TRUE(result.find(kSharedWorkerTestPage) != std::string::npos); |
57 } | 58 } |
58 | 59 |
59 } // namespace | 60 } // namespace |
OLD | NEW |