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

Unified Diff: content/browser/site_per_process_browsertest.cc

Issue 2327433002: Stop using CertStore which is not compatible with PlzNavigate. (Closed)
Patch Set: remove cert_store on ios Created 4 years, 3 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 | « content/browser/loader/resource_loader_unittest.cc ('k') | content/browser/ssl/ssl_manager.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/browser/site_per_process_browsertest.cc
diff --git a/content/browser/site_per_process_browsertest.cc b/content/browser/site_per_process_browsertest.cc
index 786dbb2fca21f18d1218de4a9d9605228d28ebb2..ea4bb0da5c3fc3c61f87442773244420a49bf876 100644
--- a/content/browser/site_per_process_browsertest.cc
+++ b/content/browser/site_per_process_browsertest.cc
@@ -39,7 +39,6 @@
#include "content/common/input/synthetic_tap_gesture_params.h"
#include "content/common/input_messages.h"
#include "content/common/view_messages.h"
-#include "content/public/browser/cert_store.h"
#include "content/public/browser/interstitial_page_delegate.h"
#include "content/public/browser/notification_observer.h"
#include "content/public/browser/notification_service.h"
@@ -527,33 +526,6 @@ class RenderWidgetHostVisibilityObserver : public NotificationObserver {
DISALLOW_COPY_AND_ASSIGN(RenderWidgetHostVisibilityObserver);
};
-// A mock CertStore that always assigns the render process host id as
-// the certificate id. Certificates are never removed.
-class MockCertStore : public CertStore {
- public:
- MockCertStore() {}
- ~MockCertStore() override {}
-
- int StoreCert(net::X509Certificate* cert,
- int render_process_host_id) override {
- certs_[render_process_host_id] = cert;
- return render_process_host_id;
- }
-
- bool RetrieveCert(int cert_id,
- scoped_refptr<net::X509Certificate>* cert) override {
- if (certs_.find(cert_id) == certs_.end())
- return false;
- *cert = certs_[cert_id];
- return true;
- }
-
- private:
- std::map<int, scoped_refptr<net::X509Certificate>> certs_;
-
- DISALLOW_COPY_AND_ASSIGN(MockCertStore);
-};
-
class TestInterstitialDelegate : public InterstitialPageDelegate {
private:
// InterstitialPageDelegate:
@@ -6786,59 +6758,6 @@ IN_PROC_BROWSER_TEST_F(SitePerProcessBrowserTest, ScreenCoordinates) {
}
}
-// Tests that the certificate store is updated during a cross-site
-// redirect navigation. (See https://crbug.com/561754.) Ignores
-// certificate errors so that it can use the cross-site redirector to
-// redirect from HTTPS to HTTPS.
-IN_PROC_BROWSER_TEST_F(SitePerProcessIgnoreCertErrorsBrowserTest,
- CrossSiteRedirectCertificateStore) {
- net::EmbeddedTestServer https_server(net::EmbeddedTestServer::TYPE_HTTPS);
- https_server.ServeFilesFromSourceDirectory("content/test/data");
- ASSERT_TRUE(https_server.Start());
- SetupCrossSiteRedirector(&https_server);
-
- ResourceDispatcherHostImpl* rdh = ResourceDispatcherHostImpl::Get();
- ASSERT_TRUE(rdh);
- MockCertStore mock_cert_store;
- rdh->cert_store_for_testing_ = &mock_cert_store;
-
- // First, navigate to an |https_server| URL to ensure that the site
- // instance is assigned a site. This will force a renderer transfer to
- // happen on the following navigation that redirects to a different
- // site.
- GURL url(https_server.GetURL("/title1.html"));
- EXPECT_TRUE(NavigateToURL(shell(), url));
- int original_process_id =
- shell()->web_contents()->GetRenderProcessHost()->GetID();
-
- url = https_server.GetURL("/cross-site/a.test/title1.html");
- // NavigateToURL() returns false because the committed URL doesn't
- // match |url| (because it redirected).
- EXPECT_FALSE(NavigateToURL(shell(), url));
- EXPECT_TRUE(IsLastCommittedEntryOfPageType(shell()->web_contents(),
- PAGE_TYPE_NORMAL));
- int new_process_id = shell()->web_contents()->GetRenderProcessHost()->GetID();
-
- // Test that the mock certificate store saw the certificate associated with
- // the new renderer process.
- EXPECT_NE(original_process_id, new_process_id);
- scoped_refptr<net::X509Certificate> original_cert;
- scoped_refptr<net::X509Certificate> transfer_cert;
- ASSERT_TRUE(
- mock_cert_store.RetrieveCert(original_process_id, &original_cert));
- ASSERT_TRUE(mock_cert_store.RetrieveCert(new_process_id, &transfer_cert));
- EXPECT_TRUE(https_server.GetCertificate()->Equals(original_cert.get()));
- EXPECT_TRUE(https_server.GetCertificate()->Equals(transfer_cert.get()));
- // Test that the final cert id stored in the navigation entry is the
- // cert id corresponding to the second renderer process.
- EXPECT_EQ(new_process_id, shell()
- ->web_contents()
- ->GetController()
- .GetVisibleEntry()
- ->GetSSL()
- .cert_id);
-}
-
// Tests that the swapped out state on RenderViewHost is properly reset when
// the main frame is navigated to the same SiteInstance as one of its child
// frames.
« no previous file with comments | « content/browser/loader/resource_loader_unittest.cc ('k') | content/browser/ssl/ssl_manager.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698