| OLD | NEW |
| 1 // Copyright (c) 2011 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/common/url_constants.h" | 6 #include "chrome/common/url_constants.h" |
| 7 #include "chrome/test/base/in_process_browser_test.h" | 7 #include "chrome/test/base/in_process_browser_test.h" |
| 8 #include "chrome/test/base/ui_test_utils.h" | 8 #include "chrome/test/base/ui_test_utils.h" |
| 9 #include "content/public/browser/navigation_details.h" | 9 #include "content/public/browser/navigation_details.h" |
| 10 #include "content/public/browser/web_contents.h" | 10 #include "content/public/browser/web_contents.h" |
| 11 | 11 |
| 12 using content::WebContents; | 12 using content::WebContents; |
| 13 | 13 |
| 14 namespace { | 14 namespace { |
| 15 | 15 |
| 16 const char kSharedWorkerTestPage[] = | 16 const char kSharedWorkerTestPage[] = |
| 17 "files/workers/workers_ui_shared_worker.html"; | 17 "files/workers/workers_ui_shared_worker.html"; |
| 18 const char kSharedWorkerJs[] = | 18 const char kSharedWorkerJs[] = |
| 19 "files/workers/workers_ui_shared_worker.js"; | 19 "files/workers/workers_ui_shared_worker.js"; |
| 20 | 20 |
| 21 class WorkersUITest : public InProcessBrowserTest { | 21 class InspectUITest : public InProcessBrowserTest { |
| 22 public: | 22 public: |
| 23 WorkersUITest() { | 23 InspectUITest() { |
| 24 set_show_window(true); | 24 set_show_window(true); |
| 25 EnableDOMAutomation(); | 25 EnableDOMAutomation(); |
| 26 } | 26 } |
| 27 | 27 |
| 28 private: | 28 private: |
| 29 DISALLOW_COPY_AND_ASSIGN(WorkersUITest); | 29 DISALLOW_COPY_AND_ASSIGN(InspectUITest); |
| 30 }; | 30 }; |
| 31 | 31 |
| 32 // The test fails on Mac OS X, see crbug.com/89583 | 32 // The test fails on Mac OS X and Windows, see crbug.com/89583 |
| 33 IN_PROC_BROWSER_TEST_F(WorkersUITest, DISABLED_SharedWorkersList) { | 33 #if defined(OS_LINUX) |
| 34 #define MAYBE_SharedWorkersList SharedWorkersList |
| 35 #else |
| 36 #define MAYBE_SharedWorkersList DISABLED_SharedWorkersList |
| 37 #endif |
| 38 IN_PROC_BROWSER_TEST_F(InspectUITest, MAYBE_SharedWorkersList) { |
| 34 ASSERT_TRUE(test_server()->Start()); | 39 ASSERT_TRUE(test_server()->Start()); |
| 35 GURL url = test_server()->GetURL(kSharedWorkerTestPage); | 40 GURL url = test_server()->GetURL(kSharedWorkerTestPage); |
| 36 ui_test_utils::NavigateToURL(browser(), url); | 41 ui_test_utils::NavigateToURL(browser(), url); |
| 37 | 42 |
| 38 ui_test_utils::NavigateToURLWithDisposition( | 43 ui_test_utils::NavigateToURLWithDisposition( |
| 39 browser(), | 44 browser(), |
| 40 GURL(chrome::kChromeUIWorkersURL), | 45 GURL(chrome::kChromeUIInspectURL), |
| 41 NEW_FOREGROUND_TAB, | 46 NEW_FOREGROUND_TAB, |
| 42 ui_test_utils::BROWSER_TEST_WAIT_FOR_NAVIGATION); | 47 ui_test_utils::BROWSER_TEST_WAIT_FOR_NAVIGATION); |
| 43 | 48 |
| 44 WebContents* web_contents = browser()->GetSelectedWebContents(); | 49 WebContents* web_contents = browser()->GetSelectedWebContents(); |
| 45 ASSERT_TRUE(web_contents != NULL); | 50 ASSERT_TRUE(web_contents != NULL); |
| 46 | 51 |
| 47 std::string result; | 52 std::string result; |
| 48 ASSERT_TRUE( | 53 ASSERT_TRUE( |
| 49 ui_test_utils::ExecuteJavaScriptAndExtractString( | 54 ui_test_utils::ExecuteJavaScriptAndExtractString( |
| 50 web_contents->GetRenderViewHost(), | 55 web_contents->GetRenderViewHost(), |
| 51 L"", | 56 L"", |
| 52 L"window.domAutomationController.send(" | 57 L"window.domAutomationController.send(" |
| 53 L"'' + document.getElementsByTagName('td')[1].textContent);", | 58 L"'' + document.body.textContent);", |
| 54 &result)); | 59 &result)); |
| 55 ASSERT_TRUE(result.find(kSharedWorkerJs) != std::string::npos); | 60 ASSERT_TRUE(result.find(kSharedWorkerJs) != std::string::npos); |
| 61 ASSERT_TRUE(result.find(kSharedWorkerTestPage) != std::string::npos); |
| 56 } | 62 } |
| 57 | 63 |
| 58 } // namespace | 64 } // namespace |
| OLD | NEW |