Commit 7afe71d1 authored by emaxx's avatar emaxx Committed by Commit bot

Fix flaky CertificateProviderApiTest.Basic test.

The flakiness was caused by waiting for a wrong number of JavaScript
test results, which resulted in inconsistency between events that were
expected to happen and the events that have actually happened. In a
detailed manner, the reportCertificates callback in file basic.js is
wrapped through chrome.test.callbackPass method, which itself calls
chrome.test.succeed method; meanwhile the C++ code in
certificate_provider_apitest.cc didn't expect this chrome.test.succeed
call, and it behaved as if the
chrome.certificateProvider.onSignDigestRequested event handler was
already executed - which is not always true and causes flakiness.

BUG=576364

Review URL: https://codereview.chromium.org/1632053002

Cr-Commit-Position: refs/heads/master@{#371501}
parent b03ed672
...@@ -159,13 +159,7 @@ class CertificateProviderApiTest : public ExtensionApiTest { ...@@ -159,13 +159,7 @@ class CertificateProviderApiTest : public ExtensionApiTest {
} // namespace } // namespace
// See crbug.com/576364 for details IN_PROC_BROWSER_TEST_F(CertificateProviderApiTest, Basic) {
#if defined(OS_CHROMEOS)
#define MAYBE_Basic DISABLED_Basic
#else
#define MAYBE_Basic Basic
#endif
IN_PROC_BROWSER_TEST_F(CertificateProviderApiTest, MAYBE_Basic) {
// Start an HTTPS test server that requests a client certificate. // Start an HTTPS test server that requests a client certificate.
net::SpawnedTestServer::SSLOptions ssl_options; net::SpawnedTestServer::SSLOptions ssl_options;
ssl_options.request_client_certificate = true; ssl_options.request_client_certificate = true;
...@@ -197,6 +191,9 @@ IN_PROC_BROWSER_TEST_F(CertificateProviderApiTest, MAYBE_Basic) { ...@@ -197,6 +191,9 @@ IN_PROC_BROWSER_TEST_F(CertificateProviderApiTest, MAYBE_Basic) {
content::WebContents* const https_contents = content::WebContents* const https_contents =
browser()->tab_strip_model()->GetActiveWebContents(); browser()->tab_strip_model()->GetActiveWebContents();
VLOG(1) << "Wait for the extension to respond to the certificates request.";
ASSERT_TRUE(catcher.GetNextResult()) << catcher.message();
VLOG(1) << "Wait for the extension to receive the sign request."; VLOG(1) << "Wait for the extension to receive the sign request.";
ASSERT_TRUE(catcher.GetNextResult()) << catcher.message(); ASSERT_TRUE(catcher.GetNextResult()) << catcher.message();
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment