OLD | NEW |
(Empty) | |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #include "chrome/test/in_process_browser_test.h" |
| 6 #include "chrome/test/ui_test_utils.h" |
| 7 #include "chrome/browser/ui/browser.h" |
| 8 #include "chrome/common/url_constants.h" |
| 9 #include "content/browser/tab_contents/navigation_details.h" |
| 10 #include "content/browser/tab_contents/tab_contents.h" |
| 11 |
| 12 namespace { |
| 13 |
| 14 const char kSharedWorkerTestPage[] = |
| 15 "files/workers/workers_ui_shared_worker.html"; |
| 16 const char kSharedWorkerJs[] = |
| 17 "files/workers/workers_ui_shared_worker.js"; |
| 18 |
| 19 class WorkersUITest : public InProcessBrowserTest { |
| 20 public: |
| 21 WorkersUITest() { |
| 22 set_show_window(true); |
| 23 EnableDOMAutomation(); |
| 24 } |
| 25 |
| 26 private: |
| 27 DISALLOW_COPY_AND_ASSIGN(WorkersUITest); |
| 28 }; |
| 29 |
| 30 IN_PROC_BROWSER_TEST_F(WorkersUITest, SharedWorkersList) { |
| 31 ASSERT_TRUE(test_server()->Start()); |
| 32 GURL url = test_server()->GetURL(kSharedWorkerTestPage); |
| 33 ui_test_utils::NavigateToURL(browser(), url); |
| 34 |
| 35 ui_test_utils::NavigateToURLWithDisposition( |
| 36 browser(), |
| 37 GURL(chrome::kChromeUIWorkersURL), |
| 38 NEW_FOREGROUND_TAB, |
| 39 ui_test_utils::BROWSER_TEST_WAIT_FOR_NAVIGATION); |
| 40 |
| 41 TabContents* tab_contents = browser()->GetSelectedTabContents(); |
| 42 ASSERT_TRUE(tab_contents != NULL); |
| 43 |
| 44 std::string result; |
| 45 ASSERT_TRUE( |
| 46 ui_test_utils::ExecuteJavaScriptAndExtractString( |
| 47 tab_contents->render_view_host(), |
| 48 L"", |
| 49 L"window.domAutomationController.send(" |
| 50 L"'' + document.getElementsByTagName('td')[1].textContent);", |
| 51 &result)); |
| 52 ASSERT_TRUE(result.find(kSharedWorkerJs) != std::string::npos); |
| 53 } |
| 54 |
| 55 } // namespace |
| 56 |
OLD | NEW |