Commit a256f1c9 authored by Jay Civelli's avatar Jay Civelli Committed by Commit Bot

Fixing CredentialManagerBrowserTests tests with the network service.

Making the CredentialManagerBrowserTests work with the network service.
They were failing because the certificate verifier was not set up for
the network service and an interstitial would be shown when navigating
to an HTTPS page.

Bug: 807739
Cq-Include-Trybots: master.tryserver.chromium.linux:linux_mojo
Change-Id: I11500770f119c677b4a5b62f929b3e09dafd5047
Reviewed-on: https://chromium-review.googlesource.com/896869Reviewed-by: default avatarJohn Abd-El-Malek <jam@chromium.org>
Commit-Queue: Jay Civelli <jcivelli@chromium.org>
Cr-Commit-Position: refs/heads/master@{#533778}
parent 1aa8a5eb
...@@ -47,6 +47,8 @@ class CredentialManagerBrowserTest : public PasswordManagerBrowserTestBase { ...@@ -47,6 +47,8 @@ class CredentialManagerBrowserTest : public PasswordManagerBrowserTestBase {
} }
void SetUpCommandLine(base::CommandLine* command_line) override { void SetUpCommandLine(base::CommandLine* command_line) override {
PasswordManagerBrowserTestBase::SetUpCommandLine(command_line);
// To permit using webauthentication features. // To permit using webauthentication features.
command_line->AppendSwitch( command_line->AppendSwitch(
switches::kEnableExperimentalWebPlatformFeatures); switches::kEnableExperimentalWebPlatformFeatures);
......
...@@ -76,6 +76,8 @@ class PasswordManagerBrowserTestWarning ...@@ -76,6 +76,8 @@ class PasswordManagerBrowserTestWarning
PasswordManagerBrowserTestWarning() {} PasswordManagerBrowserTestWarning() {}
void SetUpCommandLine(base::CommandLine* command_line) override { void SetUpCommandLine(base::CommandLine* command_line) override {
PasswordManagerBrowserTestBase::SetUpCommandLine(command_line);
// We need to set the feature state before the render process is created, // We need to set the feature state before the render process is created,
// in order for it to inherit the feature state from the browser process. // in order for it to inherit the feature state from the browser process.
// SetUp() runs too early, and SetUpOnMainThread() runs too late. // SetUp() runs too early, and SetUpOnMainThread() runs too late.
...@@ -3622,6 +3624,7 @@ class SitePerProcessPasswordManagerBrowserTest ...@@ -3622,6 +3624,7 @@ class SitePerProcessPasswordManagerBrowserTest
SitePerProcessPasswordManagerBrowserTest() {} SitePerProcessPasswordManagerBrowserTest() {}
void SetUpCommandLine(base::CommandLine* command_line) override { void SetUpCommandLine(base::CommandLine* command_line) override {
PasswordManagerBrowserTestBase::SetUpCommandLine(command_line);
content::IsolateAllSitesForTesting(command_line); content::IsolateAllSitesForTesting(command_line);
} }
......
...@@ -423,7 +423,7 @@ void PasswordManagerBrowserTestBase::SetUpOnMainThread() { ...@@ -423,7 +423,7 @@ void PasswordManagerBrowserTestBase::SetUpOnMainThread() {
verify_result.cert_status = 0; verify_result.cert_status = 0;
verify_result.is_issued_by_known_root = true; verify_result.is_issued_by_known_root = true;
verify_result.verified_cert = cert; verify_result.verified_cert = cert;
mock_cert_verifier().AddResultForCert(cert.get(), verify_result, net::OK); mock_cert_verifier()->AddResultForCert(cert.get(), verify_result, net::OK);
// Add a tab with a customized ManagePasswordsUIController. Thus, we can // Add a tab with a customized ManagePasswordsUIController. Thus, we can
// intercept useful UI events. // intercept useful UI events.
...@@ -455,23 +455,21 @@ void PasswordManagerBrowserTestBase::TearDownOnMainThread() { ...@@ -455,23 +455,21 @@ void PasswordManagerBrowserTestBase::TearDownOnMainThread() {
ASSERT_TRUE(embedded_test_server()->ShutdownAndWaitUntilComplete()); ASSERT_TRUE(embedded_test_server()->ShutdownAndWaitUntilComplete());
} }
void PasswordManagerBrowserTestBase::SetUpInProcessBrowserTestFixture() {
ProfileIOData::SetCertVerifierForTesting(&mock_cert_verifier_);
}
void PasswordManagerBrowserTestBase::TearDownInProcessBrowserTestFixture() { void PasswordManagerBrowserTestBase::TearDownInProcessBrowserTestFixture() {
ProfileIOData::SetCertVerifierForTesting(nullptr); ProfileIOData::SetCertVerifierForTesting(nullptr);
} }
content::WebContents* PasswordManagerBrowserTestBase::WebContents() { content::WebContents* PasswordManagerBrowserTestBase::WebContents() const {
return web_contents_; return web_contents_;
} }
content::RenderViewHost* PasswordManagerBrowserTestBase::RenderViewHost() { content::RenderViewHost* PasswordManagerBrowserTestBase::RenderViewHost()
const {
return WebContents()->GetRenderViewHost(); return WebContents()->GetRenderViewHost();
} }
content::RenderFrameHost* PasswordManagerBrowserTestBase::RenderFrameHost() { content::RenderFrameHost* PasswordManagerBrowserTestBase::RenderFrameHost()
const {
return WebContents()->GetMainFrame(); return WebContents()->GetMainFrame();
} }
......
...@@ -9,10 +9,10 @@ ...@@ -9,10 +9,10 @@
#include "base/macros.h" #include "base/macros.h"
#include "base/run_loop.h" #include "base/run_loop.h"
#include "chrome/browser/ssl/cert_verifier_browser_test.h"
#include "chrome/test/base/in_process_browser_test.h" #include "chrome/test/base/in_process_browser_test.h"
#include "components/password_manager/core/browser/password_store_consumer.h" #include "components/password_manager/core/browser/password_store_consumer.h"
#include "content/public/browser/web_contents_observer.h" #include "content/public/browser/web_contents_observer.h"
#include "net/cert/mock_cert_verifier.h"
#include "net/test/embedded_test_server/embedded_test_server.h" #include "net/test/embedded_test_server/embedded_test_server.h"
namespace autofill { namespace autofill {
...@@ -127,7 +127,7 @@ class BubbleObserver { ...@@ -127,7 +127,7 @@ class BubbleObserver {
DISALLOW_COPY_AND_ASSIGN(BubbleObserver); DISALLOW_COPY_AND_ASSIGN(BubbleObserver);
}; };
class PasswordManagerBrowserTestBase : public InProcessBrowserTest { class PasswordManagerBrowserTestBase : public CertVerifierBrowserTest {
public: public:
PasswordManagerBrowserTestBase(); PasswordManagerBrowserTestBase();
~PasswordManagerBrowserTestBase() override; ~PasswordManagerBrowserTestBase() override;
...@@ -135,7 +135,6 @@ class PasswordManagerBrowserTestBase : public InProcessBrowserTest { ...@@ -135,7 +135,6 @@ class PasswordManagerBrowserTestBase : public InProcessBrowserTest {
// InProcessBrowserTest: // InProcessBrowserTest:
void SetUpOnMainThread() override; void SetUpOnMainThread() override;
void TearDownOnMainThread() override; void TearDownOnMainThread() override;
void SetUpInProcessBrowserTestFixture() override;
void TearDownInProcessBrowserTestFixture() override; void TearDownInProcessBrowserTestFixture() override;
protected: protected:
...@@ -198,15 +197,13 @@ class PasswordManagerBrowserTestBase : public InProcessBrowserTest { ...@@ -198,15 +197,13 @@ class PasswordManagerBrowserTestBase : public InProcessBrowserTest {
// Accessors // Accessors
// Return the first created tab with a custom ManagePasswordsUIController. // Return the first created tab with a custom ManagePasswordsUIController.
content::WebContents* WebContents(); content::WebContents* WebContents() const;
content::RenderViewHost* RenderViewHost(); content::RenderViewHost* RenderViewHost() const;
content::RenderFrameHost* RenderFrameHost(); content::RenderFrameHost* RenderFrameHost() const;
net::EmbeddedTestServer& https_test_server() { return https_test_server_; } net::EmbeddedTestServer& https_test_server() { return https_test_server_; }
net::MockCertVerifier& mock_cert_verifier() { return mock_cert_verifier_; }
private: private:
net::EmbeddedTestServer https_test_server_; net::EmbeddedTestServer https_test_server_;
net::MockCertVerifier mock_cert_verifier_;
// A tab with some hooks injected. // A tab with some hooks injected.
content::WebContents* web_contents_; content::WebContents* web_contents_;
DISALLOW_COPY_AND_ASSIGN(PasswordManagerBrowserTestBase); DISALLOW_COPY_AND_ASSIGN(PasswordManagerBrowserTestBase);
......
...@@ -695,8 +695,6 @@ test("browser_tests") { ...@@ -695,8 +695,6 @@ test("browser_tests") {
"../browser/speech/speech_recognizer_browsertest.cc", "../browser/speech/speech_recognizer_browsertest.cc",
"../browser/spellchecker/spellcheck_mac_view_browsertest.mm", "../browser/spellchecker/spellcheck_mac_view_browsertest.mm",
"../browser/spellchecker/spellcheck_service_browsertest.cc", "../browser/spellchecker/spellcheck_service_browsertest.cc",
"../browser/ssl/cert_verifier_browser_test.cc",
"../browser/ssl/cert_verifier_browser_test.h",
"../browser/ssl/certificate_reporting_test_utils.cc", "../browser/ssl/certificate_reporting_test_utils.cc",
"../browser/ssl/certificate_reporting_test_utils.h", "../browser/ssl/certificate_reporting_test_utils.h",
"../browser/ssl/chrome_expect_ct_reporter_browsertest.cc", "../browser/ssl/chrome_expect_ct_reporter_browsertest.cc",
...@@ -4333,6 +4331,8 @@ if (!is_android) { ...@@ -4333,6 +4331,8 @@ if (!is_android) {
sources = [ sources = [
"../browser/permissions/permission_request_manager_test_api.cc", "../browser/permissions/permission_request_manager_test_api.cc",
"../browser/permissions/permission_request_manager_test_api.h", "../browser/permissions/permission_request_manager_test_api.h",
"../browser/ssl/cert_verifier_browser_test.cc",
"../browser/ssl/cert_verifier_browser_test.h",
"base/in_process_browser_test.cc", "base/in_process_browser_test.cc",
"base/in_process_browser_test.h", "base/in_process_browser_test.h",
"base/in_process_browser_test_mac.cc", "base/in_process_browser_test_mac.cc",
......
...@@ -13,15 +13,6 @@ ...@@ -13,15 +13,6 @@
-BrowsingDataRemoverBrowserTest.CookieDeletion -BrowsingDataRemoverBrowserTest.CookieDeletion
-ChromeSecurityExploitBrowserTest.CreateFilesystemURLInExtensionOrigin -ChromeSecurityExploitBrowserTest.CreateFilesystemURLInExtensionOrigin
-ChromeSitePerProcessTest.LaunchExternalProtocolFromSubframe -ChromeSitePerProcessTest.LaunchExternalProtocolFromSubframe
-CredentialManagerBrowserTest.CreatePublicKeyCredentialAlgorithmNotSupported
-CredentialManagerBrowserTest.CreatePublicKeyCredentialInvalidRp
-CredentialManagerBrowserTest.MojoConnectionRecreatedAfterNavigation
-CredentialManagerBrowserTest.StoreInUnloadHandler_CrossSite_OnDemandMojoPipe
-CredentialManagerBrowserTest.StoreInUnloadHandler_CrossSite_PreestablishedPipe
-CredentialManagerBrowserTest.StoreInUnloadHandler_SameSite_OnDemandMojoPipe
-CredentialManagerBrowserTest.StoreInUnloadHandler_SameSite_PreestablishedPipe
-CredentialManagerBrowserTest.StoreSavesPSLMatchedCredential
-CredentialManagerBrowserTest.UpdatingPSLMatchedCredentialCreatesSecondEntry
# DeclarativeContentApiTest.EnabledForSplitIncognito is flaky. # DeclarativeContentApiTest.EnabledForSplitIncognito is flaky.
-DeclarativeContentApiTest.EnabledForSplitIncognito -DeclarativeContentApiTest.EnabledForSplitIncognito
-DeclarativeContentApiTest.UninstallWhileActivePageAction -DeclarativeContentApiTest.UninstallWhileActivePageAction
......
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