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

Side by Side Diff: headless/lib/headless_web_contents_browsertest.cc

Issue 2853763004: added the allowcertificateerror method to the headless browser client so that it can handle certifi… (Closed)
Patch Set: added the allowcertificateerror method to the headless browser client so that it can handle certifi… Created 3 years, 7 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 unified diff | Download patch
« no previous file with comments | « headless/lib/browser/headless_content_browser_client.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 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 <memory> 5 #include <memory>
6 #include <string> 6 #include <string>
7 #include <vector> 7 #include <vector>
8 8
9 #include "base/base64.h" 9 #include "base/base64.h"
10 #include "content/public/test/browser_test.h" 10 #include "content/public/test/browser_test.h"
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after
93 ->GetValue() 93 ->GetValue()
94 ->GetAsBoolean(&result)); 94 ->GetAsBoolean(&result));
95 EXPECT_TRUE(result); 95 EXPECT_TRUE(result);
96 EXPECT_TRUE(EvaluateScript(web_contents2, "document.hasFocus()") 96 EXPECT_TRUE(EvaluateScript(web_contents2, "document.hasFocus()")
97 ->GetResult() 97 ->GetResult()
98 ->GetValue() 98 ->GetValue()
99 ->GetAsBoolean(&result)); 99 ->GetAsBoolean(&result));
100 EXPECT_TRUE(result); 100 EXPECT_TRUE(result);
101 } 101 }
102 102
103 IN_PROC_BROWSER_TEST_F(HeadlessWebContentsTest, HandleSSLError) {
104 net::EmbeddedTestServer https_server(net::EmbeddedTestServer::TYPE_HTTPS);
105 https_server.SetSSLConfig(net::EmbeddedTestServer::CERT_EXPIRED);
106 ASSERT_TRUE(https_server.Start());
107
108 HeadlessBrowserContext* browser_context =
109 browser()->CreateBrowserContextBuilder().Build();
110
111 HeadlessWebContents* web_contents =
112 browser_context->CreateWebContentsBuilder()
113 .SetInitialURL(https_server.GetURL("/hello.html"))
114 .Build();
115
116 EXPECT_FALSE(WaitForLoad(web_contents));
117 }
118
103 namespace { 119 namespace {
104 bool DecodePNG(std::string base64_data, SkBitmap* bitmap) { 120 bool DecodePNG(std::string base64_data, SkBitmap* bitmap) {
105 std::string png_data; 121 std::string png_data;
106 if (!base::Base64Decode(base64_data, &png_data)) 122 if (!base::Base64Decode(base64_data, &png_data))
107 return false; 123 return false;
108 return gfx::PNGCodec::Decode( 124 return gfx::PNGCodec::Decode(
109 reinterpret_cast<unsigned const char*>(png_data.data()), png_data.size(), 125 reinterpret_cast<unsigned const char*>(png_data.data()), png_data.size(),
110 bitmap); 126 bitmap);
111 } 127 }
112 } // namespace 128 } // namespace
(...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after
216 EXPECT_EQ("Embedder sent us: Hello", message); 232 EXPECT_EQ("Embedder sent us: Hello", message);
217 FinishAsynchronousTest(); 233 FinishAsynchronousTest();
218 } 234 }
219 235
220 bool GetCreateTabSocket() override { return true; } 236 bool GetCreateTabSocket() override { return true; }
221 }; 237 };
222 238
223 HEADLESS_ASYNC_DEVTOOLED_TEST_F(HeadlessTabSocketTest); 239 HEADLESS_ASYNC_DEVTOOLED_TEST_F(HeadlessTabSocketTest);
224 240
225 } // namespace headless 241 } // namespace headless
OLDNEW
« no previous file with comments | « headless/lib/browser/headless_content_browser_client.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698