| 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/browser/ui/browser_tabstrip.h" |
| 7 #include "chrome/common/url_constants.h" | 7 #include "chrome/common/url_constants.h" |
| 8 #include "chrome/test/base/in_process_browser_test.h" | 8 #include "chrome/test/base/in_process_browser_test.h" |
| 9 #include "chrome/test/base/ui_test_utils.h" | 9 #include "chrome/test/base/ui_test_utils.h" |
| 10 #include "content/public/browser/navigation_details.h" | 10 #include "content/public/browser/navigation_details.h" |
| 11 #include "content/public/browser/web_contents.h" | 11 #include "content/public/browser/web_contents.h" |
| 12 #include "content/public/test/browser_test_utils.h" |
| 12 | 13 |
| 13 using content::WebContents; | 14 using content::WebContents; |
| 14 | 15 |
| 15 namespace { | 16 namespace { |
| 16 | 17 |
| 17 const char kSharedWorkerTestPage[] = | 18 const char kSharedWorkerTestPage[] = |
| 18 "files/workers/workers_ui_shared_worker.html"; | 19 "files/workers/workers_ui_shared_worker.html"; |
| 19 const char kSharedWorkerJs[] = | 20 const char kSharedWorkerJs[] = |
| 20 "files/workers/workers_ui_shared_worker.js"; | 21 "files/workers/workers_ui_shared_worker.js"; |
| 21 | 22 |
| (...skipping 16 matching lines...) Expand all Loading... |
| 38 browser(), | 39 browser(), |
| 39 GURL(chrome::kChromeUIInspectURL), | 40 GURL(chrome::kChromeUIInspectURL), |
| 40 NEW_FOREGROUND_TAB, | 41 NEW_FOREGROUND_TAB, |
| 41 ui_test_utils::BROWSER_TEST_WAIT_FOR_NAVIGATION); | 42 ui_test_utils::BROWSER_TEST_WAIT_FOR_NAVIGATION); |
| 42 | 43 |
| 43 WebContents* web_contents = chrome::GetActiveWebContents(browser()); | 44 WebContents* web_contents = chrome::GetActiveWebContents(browser()); |
| 44 ASSERT_TRUE(web_contents != NULL); | 45 ASSERT_TRUE(web_contents != NULL); |
| 45 | 46 |
| 46 std::string result; | 47 std::string result; |
| 47 ASSERT_TRUE( | 48 ASSERT_TRUE( |
| 48 ui_test_utils::ExecuteJavaScriptAndExtractString( | 49 content::ExecuteJavaScriptAndExtractString( |
| 49 web_contents->GetRenderViewHost(), | 50 web_contents->GetRenderViewHost(), |
| 50 L"", | 51 L"", |
| 51 L"window.domAutomationController.send(" | 52 L"window.domAutomationController.send(" |
| 52 L"'' + document.body.textContent);", | 53 L"'' + document.body.textContent);", |
| 53 &result)); | 54 &result)); |
| 54 ASSERT_TRUE(result.find(kSharedWorkerJs) != std::string::npos); | 55 ASSERT_TRUE(result.find(kSharedWorkerJs) != std::string::npos); |
| 55 ASSERT_TRUE(result.find(kSharedWorkerTestPage) != std::string::npos); | 56 ASSERT_TRUE(result.find(kSharedWorkerTestPage) != std::string::npos); |
| 56 } | 57 } |
| 57 | 58 |
| 58 } // namespace | 59 } // namespace |
| OLD | NEW |