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 174 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
185 | 185 |
186 void DevToolsWindowBeforeUnloadObserver::BeforeUnloadFired( | 186 void DevToolsWindowBeforeUnloadObserver::BeforeUnloadFired( |
187 const base::TimeTicks& proceed_time) { | 187 const base::TimeTicks& proceed_time) { |
188 m_fired = true; | 188 m_fired = true; |
189 if (message_loop_runner_.get()) | 189 if (message_loop_runner_.get()) |
190 message_loop_runner_->Quit(); | 190 message_loop_runner_->Quit(); |
191 } | 191 } |
192 | 192 |
193 class DevToolsBeforeUnloadTest: public DevToolsSanityTest { | 193 class DevToolsBeforeUnloadTest: public DevToolsSanityTest { |
194 public: | 194 public: |
195 void SetUpCommandLine(CommandLine* command_line) override { | 195 void SetUpCommandLine(base::CommandLine* command_line) override { |
196 command_line->AppendSwitch( | 196 command_line->AppendSwitch( |
197 switches::kDisableHangMonitor); | 197 switches::kDisableHangMonitor); |
198 } | 198 } |
199 | 199 |
200 void CloseInspectedTab() { | 200 void CloseInspectedTab() { |
201 browser()->tab_strip_model()->CloseWebContentsAt(0, | 201 browser()->tab_strip_model()->CloseWebContentsAt(0, |
202 TabStripModel::CLOSE_NONE); | 202 TabStripModel::CLOSE_NONE); |
203 } | 203 } |
204 | 204 |
205 void CloseDevToolsWindowAsync() { | 205 void CloseDevToolsWindowAsync() { |
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
282 JavaScriptAppModalDialog* js_dialog = | 282 JavaScriptAppModalDialog* js_dialog = |
283 static_cast<JavaScriptAppModalDialog*>(dialog); | 283 static_cast<JavaScriptAppModalDialog*>(dialog); |
284 NativeAppModalDialog* native_dialog = js_dialog->native_dialog(); | 284 NativeAppModalDialog* native_dialog = js_dialog->native_dialog(); |
285 EXPECT_TRUE(native_dialog); | 285 EXPECT_TRUE(native_dialog); |
286 return native_dialog; | 286 return native_dialog; |
287 } | 287 } |
288 }; | 288 }; |
289 | 289 |
290 class DevToolsUnresponsiveBeforeUnloadTest: public DevToolsBeforeUnloadTest { | 290 class DevToolsUnresponsiveBeforeUnloadTest: public DevToolsBeforeUnloadTest { |
291 public: | 291 public: |
292 void SetUpCommandLine(CommandLine* command_line) override {} | 292 void SetUpCommandLine(base::CommandLine* command_line) override {} |
293 }; | 293 }; |
294 | 294 |
295 void TimeoutCallback(const std::string& timeout_message) { | 295 void TimeoutCallback(const std::string& timeout_message) { |
296 ADD_FAILURE() << timeout_message; | 296 ADD_FAILURE() << timeout_message; |
297 base::MessageLoop::current()->Quit(); | 297 base::MessageLoop::current()->Quit(); |
298 } | 298 } |
299 | 299 |
300 // Base class for DevTools tests that test devtools functionality for | 300 // Base class for DevTools tests that test devtools functionality for |
301 // extensions and content scripts. | 301 // extensions and content scripts. |
302 class DevToolsExtensionTest : public DevToolsSanityTest, | 302 class DevToolsExtensionTest : public DevToolsSanityTest, |
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
384 NOTREACHED(); | 384 NOTREACHED(); |
385 break; | 385 break; |
386 } | 386 } |
387 } | 387 } |
388 | 388 |
389 base::FilePath test_extensions_dir_; | 389 base::FilePath test_extensions_dir_; |
390 }; | 390 }; |
391 | 391 |
392 class DevToolsExperimentalExtensionTest : public DevToolsExtensionTest { | 392 class DevToolsExperimentalExtensionTest : public DevToolsExtensionTest { |
393 public: | 393 public: |
394 void SetUpCommandLine(CommandLine* command_line) override { | 394 void SetUpCommandLine(base::CommandLine* command_line) override { |
395 command_line->AppendSwitch( | 395 command_line->AppendSwitch( |
396 extensions::switches::kEnableExperimentalExtensionApis); | 396 extensions::switches::kEnableExperimentalExtensionApis); |
397 } | 397 } |
398 }; | 398 }; |
399 | 399 |
400 class WorkerDevToolsSanityTest : public InProcessBrowserTest { | 400 class WorkerDevToolsSanityTest : public InProcessBrowserTest { |
401 public: | 401 public: |
402 WorkerDevToolsSanityTest() : window_(NULL) {} | 402 WorkerDevToolsSanityTest() : window_(NULL) {} |
403 | 403 |
404 protected: | 404 protected: |
(...skipping 463 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
868 "window.domAutomationController.send(" | 868 "window.domAutomationController.send(" |
869 " '' + (window.uiTests && (typeof uiTests.runTest)));", | 869 " '' + (window.uiTests && (typeof uiTests.runTest)));", |
870 &result)); | 870 &result)); |
871 ASSERT_EQ("function", result) << "DevTools front-end is broken."; | 871 ASSERT_EQ("function", result) << "DevTools front-end is broken."; |
872 CloseDevToolsWindow(); | 872 CloseDevToolsWindow(); |
873 } | 873 } |
874 | 874 |
875 IN_PROC_BROWSER_TEST_F(WorkerDevToolsSanityTest, InspectSharedWorker) { | 875 IN_PROC_BROWSER_TEST_F(WorkerDevToolsSanityTest, InspectSharedWorker) { |
876 #if defined(OS_WIN) && defined(USE_ASH) | 876 #if defined(OS_WIN) && defined(USE_ASH) |
877 // Disable this test in Metro+Ash for now (http://crbug.com/262796). | 877 // Disable this test in Metro+Ash for now (http://crbug.com/262796). |
878 if (CommandLine::ForCurrentProcess()->HasSwitch(switches::kAshBrowserTests)) | 878 if (base::CommandLine::ForCurrentProcess()->HasSwitch( |
| 879 switches::kAshBrowserTests)) |
879 return; | 880 return; |
880 #endif | 881 #endif |
881 | 882 |
882 RunTest("testSharedWorker", kSharedWorkerTestPage, kSharedWorkerTestWorker); | 883 RunTest("testSharedWorker", kSharedWorkerTestPage, kSharedWorkerTestWorker); |
883 } | 884 } |
884 | 885 |
885 // Disabled, crashes under Dr.Memory and ASan, http://crbug.com/432444. | 886 // Disabled, crashes under Dr.Memory and ASan, http://crbug.com/432444. |
886 IN_PROC_BROWSER_TEST_F(WorkerDevToolsSanityTest, | 887 IN_PROC_BROWSER_TEST_F(WorkerDevToolsSanityTest, |
887 DISABLED_PauseInSharedWorkerInitialization) { | 888 DISABLED_PauseInSharedWorkerInitialization) { |
888 ASSERT_TRUE(test_server()->Start()); | 889 ASSERT_TRUE(test_server()->Start()); |
(...skipping 29 matching lines...) Expand all Loading... |
918 const std::string agent_id = agent_raw->GetId(); | 919 const std::string agent_id = agent_raw->GetId(); |
919 ASSERT_EQ(agent_raw, DevToolsAgentHost::GetForId(agent_id).get()) | 920 ASSERT_EQ(agent_raw, DevToolsAgentHost::GetForId(agent_id).get()) |
920 << "DevToolsAgentHost cannot be found by id"; | 921 << "DevToolsAgentHost cannot be found by id"; |
921 browser()->tab_strip_model()-> | 922 browser()->tab_strip_model()-> |
922 CloseWebContentsAt(0, TabStripModel::CLOSE_NONE); | 923 CloseWebContentsAt(0, TabStripModel::CLOSE_NONE); |
923 ASSERT_FALSE(DevToolsAgentHost::GetForId(agent_id).get()) | 924 ASSERT_FALSE(DevToolsAgentHost::GetForId(agent_id).get()) |
924 << "DevToolsAgentHost is not released when the tab is closed"; | 925 << "DevToolsAgentHost is not released when the tab is closed"; |
925 } | 926 } |
926 | 927 |
927 class RemoteDebuggingTest: public ExtensionApiTest { | 928 class RemoteDebuggingTest: public ExtensionApiTest { |
928 void SetUpCommandLine(CommandLine* command_line) override { | 929 void SetUpCommandLine(base::CommandLine* command_line) override { |
929 ExtensionApiTest::SetUpCommandLine(command_line); | 930 ExtensionApiTest::SetUpCommandLine(command_line); |
930 command_line->AppendSwitchASCII(switches::kRemoteDebuggingPort, "9222"); | 931 command_line->AppendSwitchASCII(switches::kRemoteDebuggingPort, "9222"); |
931 | 932 |
932 // Override the extension root path. | 933 // Override the extension root path. |
933 PathService::Get(chrome::DIR_TEST_DATA, &test_data_dir_); | 934 PathService::Get(chrome::DIR_TEST_DATA, &test_data_dir_); |
934 test_data_dir_ = test_data_dir_.AppendASCII("devtools"); | 935 test_data_dir_ = test_data_dir_.AppendASCII("devtools"); |
935 } | 936 } |
936 }; | 937 }; |
937 | 938 |
938 // Fails on CrOS. crbug.com/431399 | 939 // Fails on CrOS. crbug.com/431399 |
939 #if defined(OS_CHROMEOS) | 940 #if defined(OS_CHROMEOS) |
940 #define MAYBE_RemoteDebugger DISABLED_RemoteDebugger | 941 #define MAYBE_RemoteDebugger DISABLED_RemoteDebugger |
941 #else | 942 #else |
942 #define MAYBE_RemoteDebugger RemoteDebugger | 943 #define MAYBE_RemoteDebugger RemoteDebugger |
943 #endif | 944 #endif |
944 IN_PROC_BROWSER_TEST_F(RemoteDebuggingTest, MAYBE_RemoteDebugger) { | 945 IN_PROC_BROWSER_TEST_F(RemoteDebuggingTest, MAYBE_RemoteDebugger) { |
945 #if defined(OS_WIN) && defined(USE_ASH) | 946 #if defined(OS_WIN) && defined(USE_ASH) |
946 // Disable this test in Metro+Ash for now (http://crbug.com/262796). | 947 // Disable this test in Metro+Ash for now (http://crbug.com/262796). |
947 if (CommandLine::ForCurrentProcess()->HasSwitch(switches::kAshBrowserTests)) | 948 if (base::CommandLine::ForCurrentProcess()->HasSwitch( |
| 949 switches::kAshBrowserTests)) |
948 return; | 950 return; |
949 #endif | 951 #endif |
950 | 952 |
951 ASSERT_TRUE(RunExtensionTest("target_list")) << message_; | 953 ASSERT_TRUE(RunExtensionTest("target_list")) << message_; |
952 } | 954 } |
OLD | NEW |