| 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/bind.h" | 9 #include "base/bind.h" |
| 10 #include "base/bind_helpers.h" | 10 #include "base/bind_helpers.h" |
| (...skipping 340 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 351 } else { | 351 } else { |
| 352 requested_notification_params_.reset(); | 352 requested_notification_params_.reset(); |
| 353 } | 353 } |
| 354 waiting_for_notification_ = std::string(); | 354 waiting_for_notification_ = std::string(); |
| 355 base::MessageLoop::current()->QuitNow(); | 355 base::MessageLoop::current()->QuitNow(); |
| 356 } | 356 } |
| 357 } | 357 } |
| 358 } | 358 } |
| 359 | 359 |
| 360 void AgentHostClosed(DevToolsAgentHost* agent_host, bool replaced) override { | 360 void AgentHostClosed(DevToolsAgentHost* agent_host, bool replaced) override { |
| 361 EXPECT_TRUE(false); | 361 DCHECK(false); |
| 362 } | 362 } |
| 363 | 363 |
| 364 std::string waiting_for_notification_; | 364 std::string waiting_for_notification_; |
| 365 int waiting_for_command_result_id_; | 365 int waiting_for_command_result_id_; |
| 366 bool in_dispatch_; | 366 bool in_dispatch_; |
| 367 scoped_refptr<net::X509Certificate> last_shown_certificate_; | 367 scoped_refptr<net::X509Certificate> last_shown_certificate_; |
| 368 scoped_refptr<net::X509Certificate> ok_cert_; | 368 scoped_refptr<net::X509Certificate> ok_cert_; |
| 369 scoped_refptr<net::X509Certificate> expired_cert_; | 369 scoped_refptr<net::X509Certificate> expired_cert_; |
| 370 }; | 370 }; |
| 371 | 371 |
| (...skipping 459 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 831 // Ensure that the A.com process is still alive by executing a script in the | 831 // Ensure that the A.com process is still alive by executing a script in the |
| 832 // original tab. | 832 // original tab. |
| 833 success = false; | 833 success = false; |
| 834 EXPECT_TRUE(ExecuteScriptAndExtractBool(shell(), | 834 EXPECT_TRUE(ExecuteScriptAndExtractBool(shell(), |
| 835 "window.domAutomationController.send(" | 835 "window.domAutomationController.send(" |
| 836 " !!window.open('', 'foo'));", | 836 " !!window.open('', 'foo'));", |
| 837 &success)); | 837 &success)); |
| 838 EXPECT_TRUE(success); | 838 EXPECT_TRUE(success); |
| 839 } | 839 } |
| 840 | 840 |
| 841 // CrashTab() works differently on Windows, leading to RFH removal before |
| 842 // RenderProcessGone is called. TODO(dgozman): figure out the problem. |
| 843 #if defined(OS_WIN) |
| 844 #define MAYBE_DoubleCrash DISABLED_DoubleCrash |
| 845 #else |
| 846 #define MAYBE_DoubleCrash DoubleCrash |
| 847 #endif |
| 848 IN_PROC_BROWSER_TEST_F(DevToolsProtocolTest, MAYBE_DoubleCrash) { |
| 849 ASSERT_TRUE(embedded_test_server()->Start()); |
| 850 GURL test_url = embedded_test_server()->GetURL("/devtools/navigation.html"); |
| 851 NavigateToURLBlockUntilNavigationsComplete(shell(), GURL("about:blank"), 1); |
| 852 Attach(); |
| 853 SendCommand("ServiceWorker.enable", nullptr); |
| 854 NavigateToURLBlockUntilNavigationsComplete(shell(), test_url, 1); |
| 855 CrashTab(shell()->web_contents()); |
| 856 NavigateToURLBlockUntilNavigationsComplete(shell(), test_url, 1); |
| 857 CrashTab(shell()->web_contents()); |
| 858 NavigateToURLBlockUntilNavigationsComplete(shell(), GURL("about:blank"), 1); |
| 859 // Should not crash at this point. |
| 860 } |
| 861 |
| 841 IN_PROC_BROWSER_TEST_F(DevToolsProtocolTest, ReloadBlankPage) { | 862 IN_PROC_BROWSER_TEST_F(DevToolsProtocolTest, ReloadBlankPage) { |
| 842 Shell* window = Shell::CreateNewWindow( | 863 Shell* window = Shell::CreateNewWindow( |
| 843 shell()->web_contents()->GetBrowserContext(), | 864 shell()->web_contents()->GetBrowserContext(), |
| 844 GURL("javascript:x=1"), | 865 GURL("javascript:x=1"), |
| 845 nullptr, | 866 nullptr, |
| 846 gfx::Size()); | 867 gfx::Size()); |
| 847 WaitForLoadStop(window->web_contents()); | 868 WaitForLoadStop(window->web_contents()); |
| 848 Attach(); | 869 Attach(); |
| 849 SendCommand("Page.reload", nullptr, false); | 870 SendCommand("Page.reload", nullptr, false); |
| 850 // Should not crash at this point. | 871 // Should not crash at this point. |
| (...skipping 334 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1185 ASSERT_TRUE(transient_entry); | 1206 ASSERT_TRUE(transient_entry); |
| 1186 transient_entry->GetSSL().certificate = expired_cert(); | 1207 transient_entry->GetSSL().certificate = expired_cert(); |
| 1187 ASSERT_TRUE(transient_entry->GetSSL().certificate); | 1208 ASSERT_TRUE(transient_entry->GetSSL().certificate); |
| 1188 | 1209 |
| 1189 std::unique_ptr<base::DictionaryValue> params2(new base::DictionaryValue()); | 1210 std::unique_ptr<base::DictionaryValue> params2(new base::DictionaryValue()); |
| 1190 SendCommand("Security.showCertificateViewer", std::move(params2), true); | 1211 SendCommand("Security.showCertificateViewer", std::move(params2), true); |
| 1191 EXPECT_EQ(transient_entry->GetSSL().certificate, last_shown_certificate()); | 1212 EXPECT_EQ(transient_entry->GetSSL().certificate, last_shown_certificate()); |
| 1192 } | 1213 } |
| 1193 | 1214 |
| 1194 } // namespace content | 1215 } // namespace content |
| OLD | NEW |