| Index: content/browser/devtools/protocol/devtools_protocol_browsertest.cc
|
| diff --git a/content/browser/devtools/protocol/devtools_protocol_browsertest.cc b/content/browser/devtools/protocol/devtools_protocol_browsertest.cc
|
| index 50358c27aec056e904acbfede116981082a82897..679edd4d6be3cd0ab08f349743b074f77e129580 100644
|
| --- a/content/browser/devtools/protocol/devtools_protocol_browsertest.cc
|
| +++ b/content/browser/devtools/protocol/devtools_protocol_browsertest.cc
|
| @@ -1412,6 +1412,62 @@ IN_PROC_BROWSER_TEST_F(DevToolsProtocolTest, ShowCertificateViewer) {
|
| EXPECT_EQ(transient_entry->GetSSL().certificate, last_shown_certificate());
|
| }
|
|
|
| +IN_PROC_BROWSER_TEST_F(DevToolsProtocolTest, CertificateError) {
|
| + net::EmbeddedTestServer https_server(net::EmbeddedTestServer::TYPE_HTTPS);
|
| + https_server.SetSSLConfig(net::EmbeddedTestServer::CERT_EXPIRED);
|
| + ASSERT_TRUE(https_server.Start());
|
| + GURL test_url = https_server.GetURL("/devtools/navigation.html");
|
| + std::unique_ptr<base::DictionaryValue> params;
|
| + std::unique_ptr<base::DictionaryValue> command_params;
|
| + int eventID;
|
| +
|
| + shell()->LoadURL(GURL("about://blank"));
|
| + WaitForLoadStop(shell()->web_contents());
|
| +
|
| + Attach();
|
| + SendCommand("Network.enable", nullptr, false);
|
| + SendCommand("Security.enable", nullptr, false);
|
| + command_params.reset(new base::DictionaryValue());
|
| + command_params->SetBoolean("override", true);
|
| + SendCommand("Security.setOverrideCertificateErrors",
|
| + std::move(command_params), true);
|
| +
|
| + // Test continue.
|
| + TestNavigationObserver continue_observer(shell()->web_contents(), 1);
|
| + shell()->LoadURL(test_url);
|
| + params = WaitForNotification("Security.certificateError", false);
|
| + EXPECT_TRUE(params->GetInteger("eventID", &eventID));
|
| + command_params.reset(new base::DictionaryValue());
|
| + command_params->SetInteger("eventID", eventID);
|
| + command_params->SetString("action", "continue");
|
| + SendCommand("Security.handleCertificateError", std::move(command_params),
|
| + false);
|
| + WaitForNotification("Network.loadingFinished", true);
|
| + continue_observer.Wait();
|
| +
|
| + // Test cancel.
|
| + shell()->LoadURL(test_url);
|
| + params = WaitForNotification("Security.certificateError", false);
|
| + EXPECT_TRUE(params->GetInteger("eventID", &eventID));
|
| + command_params.reset(new base::DictionaryValue());
|
| + command_params->SetInteger("eventID", eventID);
|
| + command_params->SetString("action", "cancel");
|
| + SendCommand("Security.handleCertificateError", std::move(command_params),
|
| + false);
|
| + WaitForNotification("Network.loadingFailed", true);
|
| +
|
| + // Test deny.
|
| + shell()->LoadURL(test_url);
|
| + params = WaitForNotification("Security.certificateError", false);
|
| + EXPECT_TRUE(params->GetInteger("eventID", &eventID));
|
| + command_params.reset(new base::DictionaryValue());
|
| + command_params->SetInteger("eventID", eventID);
|
| + command_params->SetString("action", "deny");
|
| + SendCommand("Security.handleCertificateError", std::move(command_params),
|
| + false);
|
| + WaitForNotification("Network.loadingFailed", true);
|
| +}
|
| +
|
| IN_PROC_BROWSER_TEST_F(DevToolsProtocolTest, TargetDiscovery) {
|
| std::string temp;
|
| std::set<std::string> ids;
|
|
|