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

Unified Diff: content/browser/loader/resource_loader_unittest.cc

Issue 2315443003: Stop sending serialized SSLStatus to the renderer. (Closed)
Patch Set: self review fix and merge fix 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.cc ('k') | content/browser/loader/stream_resource_handler.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/browser/loader/resource_loader_unittest.cc
diff --git a/content/browser/loader/resource_loader_unittest.cc b/content/browser/loader/resource_loader_unittest.cc
index 9bb2394d6897892c380f34ec4d7b7c3a3abe01a6..525f5c4a18e36c0a0f23192cab16006113c80064 100644
--- a/content/browser/loader/resource_loader_unittest.cc
+++ b/content/browser/loader/resource_loader_unittest.cc
@@ -22,7 +22,6 @@
#include "content/browser/browser_thread_impl.h"
#include "content/browser/loader/redirect_to_file_resource_handler.h"
#include "content/browser/loader/resource_loader_delegate.h"
-#include "content/common/ssl_status_serialization.h"
#include "content/public/browser/cert_store.h"
#include "content/public/browser/client_certificate_delegate.h"
#include "content/public/browser/resource_request_info.h"
@@ -388,7 +387,6 @@ class ResourceHandlerStub : public ResourceHandler {
}
void OnResponseCompleted(const net::URLRequestStatus& status,
- const std::string& security_info,
bool* defer) override {
EXPECT_FALSE(received_response_completed_);
if (status.is_success() && expect_reads_)
@@ -1111,84 +1109,6 @@ TEST_F(ResourceLoaderRedirectToFileTest, DownstreamDeferStart) {
EXPECT_EQ(test_data(), contents);
}
-// Test that an HTTPS resource has the expected security info attached
-// to it.
-TEST_F(HTTPSSecurityInfoResourceLoaderTest, SecurityInfoOnHTTPSResource) {
- // Start the request and wait for it to finish.
- std::unique_ptr<net::URLRequest> request(
- resource_context_.GetRequestContext()->CreateRequest(
- test_https_url(), net::DEFAULT_PRIORITY, nullptr /* delegate */));
- SetUpResourceLoader(std::move(request), RESOURCE_TYPE_MAIN_FRAME, true);
-
- // Send the request and wait until it completes.
- loader_->StartRequest();
- raw_ptr_resource_handler_->WaitForResponseComplete();
- ASSERT_EQ(net::URLRequestStatus::SUCCESS,
- raw_ptr_to_request_->status().status());
-
- ResourceResponse* response = raw_ptr_resource_handler_->response();
- ASSERT_TRUE(response);
-
- // Deserialize the security info from the response and check that it
- // is as expected.
- SSLStatus deserialized;
- ASSERT_TRUE(
- DeserializeSecurityInfo(response->head.security_info, &deserialized));
-
- // Expect a BROKEN security style because the cert status has errors.
- EXPECT_EQ(content::SECURITY_STYLE_AUTHENTICATION_BROKEN,
- deserialized.security_style);
- scoped_refptr<net::X509Certificate> cert;
- ASSERT_TRUE(
- CertStore::GetInstance()->RetrieveCert(deserialized.cert_id, &cert));
- EXPECT_TRUE(cert->Equals(GetTestCert().get()));
-
- EXPECT_EQ(kTestCertError, deserialized.cert_status);
- EXPECT_EQ(kTestConnectionStatus, deserialized.connection_status);
- EXPECT_EQ(kTestSecurityBits, deserialized.security_bits);
-}
-
-// Test that an HTTPS redirect response has the expected security info
-// attached to it.
-TEST_F(HTTPSSecurityInfoResourceLoaderTest,
- SecurityInfoOnHTTPSRedirectResource) {
- // Start the request and wait for it to finish.
- std::unique_ptr<net::URLRequest> request(
- resource_context_.GetRequestContext()->CreateRequest(
- test_https_redirect_url(), net::DEFAULT_PRIORITY,
- nullptr /* delegate */));
- SetUpResourceLoader(std::move(request), RESOURCE_TYPE_MAIN_FRAME, true);
-
- // Send the request and wait until it completes.
- loader_->StartRequest();
- raw_ptr_resource_handler_->WaitForResponseComplete();
- ASSERT_EQ(net::URLRequestStatus::SUCCESS,
- raw_ptr_to_request_->status().status());
- ASSERT_TRUE(raw_ptr_resource_handler_->received_request_redirected());
-
- ResourceResponse* redirect_response =
- raw_ptr_resource_handler_->redirect_response();
- ASSERT_TRUE(redirect_response);
-
- // Deserialize the security info from the redirect response and check
- // that it is as expected.
- SSLStatus deserialized;
- ASSERT_TRUE(DeserializeSecurityInfo(redirect_response->head.security_info,
- &deserialized));
-
- // Expect a BROKEN security style because the cert status has errors.
- EXPECT_EQ(content::SECURITY_STYLE_AUTHENTICATION_BROKEN,
- deserialized.security_style);
- scoped_refptr<net::X509Certificate> cert;
- ASSERT_TRUE(
- CertStore::GetInstance()->RetrieveCert(deserialized.cert_id, &cert));
- EXPECT_TRUE(cert->Equals(GetTestCert().get()));
-
- EXPECT_EQ(kTestCertError, deserialized.cert_status);
- EXPECT_EQ(kTestConnectionStatus, deserialized.connection_status);
- EXPECT_EQ(kTestSecurityBits, deserialized.security_bits);
-}
-
class EffectiveConnectionTypeResourceLoaderTest : public ResourceLoaderTest {
public:
void VerifyEffectiveConnectionType(
« no previous file with comments | « content/browser/loader/resource_loader.cc ('k') | content/browser/loader/stream_resource_handler.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698