OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 <stddef.h> | 5 #include <stddef.h> |
6 #include <utility> | 6 #include <utility> |
7 | 7 |
8 #include "base/base64.h" | 8 #include "base/base64.h" |
9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
10 #include "base/json/json_reader.h" | 10 #include "base/json/json_reader.h" |
(...skipping 297 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
308 } else { | 308 } else { |
309 requested_notification_params_.reset(); | 309 requested_notification_params_.reset(); |
310 } | 310 } |
311 waiting_for_notification_ = std::string(); | 311 waiting_for_notification_ = std::string(); |
312 base::MessageLoop::current()->QuitNow(); | 312 base::MessageLoop::current()->QuitNow(); |
313 } | 313 } |
314 } | 314 } |
315 } | 315 } |
316 | 316 |
317 void AgentHostClosed(DevToolsAgentHost* agent_host, bool replaced) override { | 317 void AgentHostClosed(DevToolsAgentHost* agent_host, bool replaced) override { |
318 EXPECT_TRUE(false); | 318 DCHECK(false); |
319 } | 319 } |
320 | 320 |
321 std::string waiting_for_notification_; | 321 std::string waiting_for_notification_; |
322 int waiting_for_command_result_id_; | 322 int waiting_for_command_result_id_; |
323 bool in_dispatch_; | 323 bool in_dispatch_; |
324 }; | 324 }; |
325 | 325 |
326 class SyntheticKeyEventTest : public DevToolsProtocolTest { | 326 class SyntheticKeyEventTest : public DevToolsProtocolTest { |
327 protected: | 327 protected: |
328 void SendKeyEvent(const std::string& type, | 328 void SendKeyEvent(const std::string& type, |
(...skipping 301 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
630 // Ensure that the A.com process is still alive by executing a script in the | 630 // Ensure that the A.com process is still alive by executing a script in the |
631 // original tab. | 631 // original tab. |
632 success = false; | 632 success = false; |
633 EXPECT_TRUE(ExecuteScriptAndExtractBool(shell(), | 633 EXPECT_TRUE(ExecuteScriptAndExtractBool(shell(), |
634 "window.domAutomationController.send(" | 634 "window.domAutomationController.send(" |
635 " !!window.open('', 'foo'));", | 635 " !!window.open('', 'foo'));", |
636 &success)); | 636 &success)); |
637 EXPECT_TRUE(success); | 637 EXPECT_TRUE(success); |
638 } | 638 } |
639 | 639 |
| 640 // CrashTab() works differently on Windows, leading to RFH removal before |
| 641 // RenderProcessGone is called. TODO(dgozman): figure out the problem. |
| 642 #if defined(OS_WIN) |
| 643 #define MAYBE_DoubleCrash DISABLED_DoubleCrash |
| 644 #else |
| 645 #define MAYBE_DoubleCrash DoubleCrash |
| 646 #endif |
| 647 IN_PROC_BROWSER_TEST_F(DevToolsProtocolTest, MAYBE_DoubleCrash) { |
| 648 ASSERT_TRUE(embedded_test_server()->Start()); |
| 649 GURL test_url = embedded_test_server()->GetURL("/devtools/navigation.html"); |
| 650 NavigateToURLBlockUntilNavigationsComplete(shell(), GURL("about:blank"), 1); |
| 651 Attach(); |
| 652 SendCommand("ServiceWorker.enable", nullptr); |
| 653 NavigateToURLBlockUntilNavigationsComplete(shell(), test_url, 1); |
| 654 CrashTab(shell()->web_contents()); |
| 655 NavigateToURLBlockUntilNavigationsComplete(shell(), test_url, 1); |
| 656 CrashTab(shell()->web_contents()); |
| 657 NavigateToURLBlockUntilNavigationsComplete(shell(), GURL("about:blank"), 1); |
| 658 // Should not crash at this point. |
| 659 } |
| 660 |
640 IN_PROC_BROWSER_TEST_F(DevToolsProtocolTest, ReloadBlankPage) { | 661 IN_PROC_BROWSER_TEST_F(DevToolsProtocolTest, ReloadBlankPage) { |
641 Shell* window = Shell::CreateNewWindow( | 662 Shell* window = Shell::CreateNewWindow( |
642 shell()->web_contents()->GetBrowserContext(), | 663 shell()->web_contents()->GetBrowserContext(), |
643 GURL("javascript:x=1"), | 664 GURL("javascript:x=1"), |
644 nullptr, | 665 nullptr, |
645 gfx::Size()); | 666 gfx::Size()); |
646 WaitForLoadStop(window->web_contents()); | 667 WaitForLoadStop(window->web_contents()); |
647 Attach(); | 668 Attach(); |
648 SendCommand("Page.reload", nullptr, false); | 669 SendCommand("Page.reload", nullptr, false); |
649 // Should not crash at this point. | 670 // Should not crash at this point. |
(...skipping 281 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
931 params->SetString("policy", "advance"); | 952 params->SetString("policy", "advance"); |
932 params->SetInteger("budget", 1000); | 953 params->SetInteger("budget", 1000); |
933 SendCommand("Emulation.setVirtualTimePolicy", std::move(params), true); | 954 SendCommand("Emulation.setVirtualTimePolicy", std::move(params), true); |
934 | 955 |
935 WaitForNotification("Emulation.virtualTimeBudgetExpired"); | 956 WaitForNotification("Emulation.virtualTimeBudgetExpired"); |
936 | 957 |
937 EXPECT_THAT(console_messages_, ElementsAre("before", "done", "after")); | 958 EXPECT_THAT(console_messages_, ElementsAre("before", "done", "after")); |
938 } | 959 } |
939 | 960 |
940 } // namespace content | 961 } // namespace content |
OLD | NEW |