Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(404)

Unified Diff: content/browser/devtools/protocol/devtools_protocol_browsertest.cc

Issue 2639203003: Add certificate error handling to devtools. (Closed)
Patch Set: Add certificate error command tests Created 3 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | content/browser/devtools/protocol/security_handler.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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..cd580119225bab306a49d600050ccb36e2ed5378 100644
--- a/content/browser/devtools/protocol/devtools_protocol_browsertest.cc
+++ b/content/browser/devtools/protocol/devtools_protocol_browsertest.cc
@@ -1412,6 +1412,56 @@ 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;
+
+ Attach();
Eric Seckler 2017/02/08 02:40:35 Looks like loading a blank page first and reshuffl
irisu 2017/02/08 03:53:24 Awesome, Thanks!! Done.
+ SendCommand("Network.enable", nullptr, false);
+ SendCommand("Security.enableCertificateErrorHandling", nullptr, true);
+
+ // Test continue.
+ WaitForLoadStop(shell()->web_contents());
+ 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;
« no previous file with comments | « no previous file | content/browser/devtools/protocol/security_handler.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698