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

Side by Side Diff: chrome/browser/extensions/api/certificate_provider/certificate_provider_apitest.cc

Issue 1632053002: Fix flaky CertificateProviderApiTest.Basic test. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 11 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 | « no previous file | 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 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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 <openssl/evp.h> 5 #include <openssl/evp.h>
6 #include <openssl/rsa.h> 6 #include <openssl/rsa.h>
7 #include <stddef.h> 7 #include <stddef.h>
8 #include <stdint.h> 8 #include <stdint.h>
9 #include <stdlib.h> 9 #include <stdlib.h>
10 10
(...skipping 141 matching lines...) Expand 10 before | Expand all | Expand 10 after
152 152
153 content::RunAllPendingInMessageLoop(); 153 content::RunAllPendingInMessageLoop();
154 } 154 }
155 155
156 protected: 156 protected:
157 policy::MockConfigurationPolicyProvider provider_; 157 policy::MockConfigurationPolicyProvider provider_;
158 }; 158 };
159 159
160 } // namespace 160 } // namespace
161 161
162 // See crbug.com/576364 for details 162 IN_PROC_BROWSER_TEST_F(CertificateProviderApiTest, Basic) {
163 #if defined(OS_CHROMEOS)
164 #define MAYBE_Basic DISABLED_Basic
165 #else
166 #define MAYBE_Basic Basic
167 #endif
168 IN_PROC_BROWSER_TEST_F(CertificateProviderApiTest, MAYBE_Basic) {
169 // Start an HTTPS test server that requests a client certificate. 163 // Start an HTTPS test server that requests a client certificate.
170 net::SpawnedTestServer::SSLOptions ssl_options; 164 net::SpawnedTestServer::SSLOptions ssl_options;
171 ssl_options.request_client_certificate = true; 165 ssl_options.request_client_certificate = true;
172 net::SpawnedTestServer https_server(net::SpawnedTestServer::TYPE_HTTPS, 166 net::SpawnedTestServer https_server(net::SpawnedTestServer::TYPE_HTTPS,
173 ssl_options, base::FilePath()); 167 ssl_options, base::FilePath());
174 ASSERT_TRUE(https_server.Start()); 168 ASSERT_TRUE(https_server.Start());
175 169
176 extensions::ResultCatcher catcher; 170 extensions::ResultCatcher catcher;
177 171
178 const base::FilePath extension_path = 172 const base::FilePath extension_path =
(...skipping 11 matching lines...) Expand all
190 content::TestNavigationObserver navigation_observer( 184 content::TestNavigationObserver navigation_observer(
191 nullptr /* no WebContents */); 185 nullptr /* no WebContents */);
192 navigation_observer.StartWatchingNewWebContents(); 186 navigation_observer.StartWatchingNewWebContents();
193 ui_test_utils::NavigateToURLWithDisposition( 187 ui_test_utils::NavigateToURLWithDisposition(
194 browser(), https_server.GetURL("client-cert"), NEW_FOREGROUND_TAB, 188 browser(), https_server.GetURL("client-cert"), NEW_FOREGROUND_TAB,
195 ui_test_utils::BROWSER_TEST_NONE); 189 ui_test_utils::BROWSER_TEST_NONE);
196 190
197 content::WebContents* const https_contents = 191 content::WebContents* const https_contents =
198 browser()->tab_strip_model()->GetActiveWebContents(); 192 browser()->tab_strip_model()->GetActiveWebContents();
199 193
194 VLOG(1) << "Wait for the extension to respond to the certificates request.";
195 ASSERT_TRUE(catcher.GetNextResult()) << catcher.message();
196
200 VLOG(1) << "Wait for the extension to receive the sign request."; 197 VLOG(1) << "Wait for the extension to receive the sign request.";
201 ASSERT_TRUE(catcher.GetNextResult()) << catcher.message(); 198 ASSERT_TRUE(catcher.GetNextResult()) << catcher.message();
202 199
203 VLOG(1) << "Fetch the digest from the sign request."; 200 VLOG(1) << "Fetch the digest from the sign request.";
204 std::vector<uint8_t> request_digest; 201 std::vector<uint8_t> request_digest;
205 { 202 {
206 base::RunLoop run_loop; 203 base::RunLoop run_loop;
207 extension_contents->GetMainFrame()->ExecuteJavaScriptForTests( 204 extension_contents->GetMainFrame()->ExecuteJavaScriptForTests(
208 base::ASCIIToUTF16("signDigestRequest.digest;"), 205 base::ASCIIToUTF16("signDigestRequest.digest;"),
209 base::Bind(&StoreDigest, &request_digest, run_loop.QuitClosure())); 206 base::Bind(&StoreDigest, &request_digest, run_loop.QuitClosure()));
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after
263 base::RunLoop run_loop; 260 base::RunLoop run_loop;
264 const std::string code = "replyWithSignatureSecondTime();"; 261 const std::string code = "replyWithSignatureSecondTime();";
265 bool result = false; 262 bool result = false;
266 extension_contents->GetMainFrame()->ExecuteJavaScriptForTests( 263 extension_contents->GetMainFrame()->ExecuteJavaScriptForTests(
267 base::ASCIIToUTF16(code), 264 base::ASCIIToUTF16(code),
268 base::Bind(&StoreBool, &result, run_loop.QuitClosure())); 265 base::Bind(&StoreBool, &result, run_loop.QuitClosure()));
269 run_loop.Run(); 266 run_loop.Run();
270 EXPECT_TRUE(result); 267 EXPECT_TRUE(result);
271 } 268 }
272 } 269 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698