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 "base/bind.h" | 5 #include "base/bind.h" |
6 #include "base/cancelable_callback.h" | 6 #include "base/cancelable_callback.h" |
7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
8 #include "base/compiler_specific.h" | 8 #include "base/compiler_specific.h" |
9 #include "base/memory/ref_counted.h" | 9 #include "base/memory/ref_counted.h" |
10 #include "base/path_service.h" | 10 #include "base/path_service.h" |
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
82 "files/workers/debug_shared_worker_initialization.html"; | 82 "files/workers/debug_shared_worker_initialization.html"; |
83 | 83 |
84 void RunTestFunction(DevToolsWindow* window, const char* test_name) { | 84 void RunTestFunction(DevToolsWindow* window, const char* test_name) { |
85 std::string result; | 85 std::string result; |
86 | 86 |
87 // At first check that JavaScript part of the front-end is loaded by | 87 // At first check that JavaScript part of the front-end is loaded by |
88 // checking that global variable uiTests exists(it's created after all js | 88 // checking that global variable uiTests exists(it's created after all js |
89 // files have been loaded) and has runTest method. | 89 // files have been loaded) and has runTest method. |
90 ASSERT_TRUE( | 90 ASSERT_TRUE( |
91 content::ExecuteScriptAndExtractString( | 91 content::ExecuteScriptAndExtractString( |
92 window->GetRenderViewHost(), | 92 window->web_contents()->GetRenderViewHost(), |
93 "window.domAutomationController.send(" | 93 "window.domAutomationController.send(" |
94 " '' + (window.uiTests && (typeof uiTests.runTest)));", | 94 " '' + (window.uiTests && (typeof uiTests.runTest)));", |
95 &result)); | 95 &result)); |
96 | 96 |
97 ASSERT_EQ("function", result) << "DevTools front-end is broken."; | 97 ASSERT_EQ("function", result) << "DevTools front-end is broken."; |
98 ASSERT_TRUE(content::ExecuteScriptAndExtractString( | 98 ASSERT_TRUE(content::ExecuteScriptAndExtractString( |
99 window->GetRenderViewHost(), | 99 window->web_contents()->GetRenderViewHost(), |
100 base::StringPrintf("uiTests.runTest('%s')", test_name), | 100 base::StringPrintf("uiTests.runTest('%s')", test_name), |
101 &result)); | 101 &result)); |
102 EXPECT_EQ("[OK]", result); | 102 EXPECT_EQ("[OK]", result); |
103 } | 103 } |
104 | 104 |
105 } // namespace | 105 } // namespace |
106 | 106 |
107 class DevToolsSanityTest : public InProcessBrowserTest { | 107 class DevToolsSanityTest : public InProcessBrowserTest { |
108 public: | 108 public: |
109 DevToolsSanityTest() | 109 DevToolsSanityTest() |
(...skipping 422 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
532 return worker_data; | 532 return worker_data; |
533 } | 533 } |
534 | 534 |
535 void OpenDevToolsWindowForSharedWorker(WorkerData* worker_data) { | 535 void OpenDevToolsWindowForSharedWorker(WorkerData* worker_data) { |
536 Profile* profile = browser()->profile(); | 536 Profile* profile = browser()->profile(); |
537 scoped_refptr<DevToolsAgentHost> agent_host( | 537 scoped_refptr<DevToolsAgentHost> agent_host( |
538 DevToolsAgentHost::GetForWorker( | 538 DevToolsAgentHost::GetForWorker( |
539 worker_data->worker_process_id, | 539 worker_data->worker_process_id, |
540 worker_data->worker_route_id)); | 540 worker_data->worker_route_id)); |
541 window_ = DevToolsWindow::OpenDevToolsWindowForWorker(profile, agent_host); | 541 window_ = DevToolsWindow::OpenDevToolsWindowForWorker(profile, agent_host); |
542 RenderViewHost* client_rvh = window_->GetRenderViewHost(); | 542 RenderViewHost* client_rvh = window_->web_contents()->GetRenderViewHost(); |
543 WebContents* client_contents = WebContents::FromRenderViewHost(client_rvh); | 543 WebContents* client_contents = WebContents::FromRenderViewHost(client_rvh); |
544 content::WaitForLoadStop(client_contents); | 544 content::WaitForLoadStop(client_contents); |
545 } | 545 } |
546 | 546 |
547 void CloseDevToolsWindow() { | 547 void CloseDevToolsWindow() { |
548 Browser* browser = window_->browser(); | 548 Browser* browser = window_->browser(); |
549 content::WindowedNotificationObserver close_observer( | 549 content::WindowedNotificationObserver close_observer( |
550 content::NOTIFICATION_WEB_CONTENTS_DESTROYED, | 550 content::NOTIFICATION_WEB_CONTENTS_DESTROYED, |
551 content::Source<content::WebContents>(window_->web_contents())); | 551 content::Source<content::WebContents>(window_->web_contents())); |
552 browser->tab_strip_model()->CloseAllTabs(); | 552 browser->tab_strip_model()->CloseAllTabs(); |
(...skipping 311 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
864 // after a crash. See http://crbug.com/101952 | 864 // after a crash. See http://crbug.com/101952 |
865 IN_PROC_BROWSER_TEST_F(DevToolsSanityTest, TestReattachAfterCrash) { | 865 IN_PROC_BROWSER_TEST_F(DevToolsSanityTest, TestReattachAfterCrash) { |
866 RunTest("testReattachAfterCrash", std::string()); | 866 RunTest("testReattachAfterCrash", std::string()); |
867 } | 867 } |
868 | 868 |
869 IN_PROC_BROWSER_TEST_F(DevToolsSanityTest, TestPageWithNoJavaScript) { | 869 IN_PROC_BROWSER_TEST_F(DevToolsSanityTest, TestPageWithNoJavaScript) { |
870 OpenDevToolsWindow("about:blank", false); | 870 OpenDevToolsWindow("about:blank", false); |
871 std::string result; | 871 std::string result; |
872 ASSERT_TRUE( | 872 ASSERT_TRUE( |
873 content::ExecuteScriptAndExtractString( | 873 content::ExecuteScriptAndExtractString( |
874 window_->GetRenderViewHost(), | 874 window_->web_contents()->GetRenderViewHost(), |
875 "window.domAutomationController.send(" | 875 "window.domAutomationController.send(" |
876 " '' + (window.uiTests && (typeof uiTests.runTest)));", | 876 " '' + (window.uiTests && (typeof uiTests.runTest)));", |
877 &result)); | 877 &result)); |
878 ASSERT_EQ("function", result) << "DevTools front-end is broken."; | 878 ASSERT_EQ("function", result) << "DevTools front-end is broken."; |
879 CloseDevToolsWindow(); | 879 CloseDevToolsWindow(); |
880 } | 880 } |
881 | 881 |
882 #if defined(OS_MACOSX) | 882 #if defined(OS_MACOSX) |
883 #define MAYBE_InspectSharedWorker DISABLED_InspectSharedWorker | 883 #define MAYBE_InspectSharedWorker DISABLED_InspectSharedWorker |
884 #else | 884 #else |
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
954 | 954 |
955 IN_PROC_BROWSER_TEST_F(RemoteDebuggingTest, RemoteDebugger) { | 955 IN_PROC_BROWSER_TEST_F(RemoteDebuggingTest, RemoteDebugger) { |
956 #if defined(OS_WIN) && defined(USE_ASH) | 956 #if defined(OS_WIN) && defined(USE_ASH) |
957 // Disable this test in Metro+Ash for now (http://crbug.com/262796). | 957 // Disable this test in Metro+Ash for now (http://crbug.com/262796). |
958 if (CommandLine::ForCurrentProcess()->HasSwitch(switches::kAshBrowserTests)) | 958 if (CommandLine::ForCurrentProcess()->HasSwitch(switches::kAshBrowserTests)) |
959 return; | 959 return; |
960 #endif | 960 #endif |
961 | 961 |
962 ASSERT_TRUE(RunExtensionTest("target_list")) << message_; | 962 ASSERT_TRUE(RunExtensionTest("target_list")) << message_; |
963 } | 963 } |
OLD | NEW |