summaryrefslogtreecommitdiff
path: root/chromium/content/browser/loader/resource_loader_unittest.cc
diff options
context:
space:
mode:
authorAllan Sandfeld Jensen <allan.jensen@qt.io>2018-01-29 16:35:13 +0100
committerAllan Sandfeld Jensen <allan.jensen@qt.io>2018-02-01 15:33:35 +0000
commitc8c2d1901aec01e934adf561a9fdf0cc776cdef8 (patch)
tree9157c3d9815e5870799e070b113813bec53e0535 /chromium/content/browser/loader/resource_loader_unittest.cc
parentabefd5095b41dac94ca451d784ab6e27372e981a (diff)
downloadqtwebengine-chromium-c8c2d1901aec01e934adf561a9fdf0cc776cdef8.tar.gz
BASELINE: Update Chromium to 64.0.3282.139
Change-Id: I1cae68fe9c94ff7608b26b8382fc19862cdb293a Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
Diffstat (limited to 'chromium/content/browser/loader/resource_loader_unittest.cc')
-rw-r--r--chromium/content/browser/loader/resource_loader_unittest.cc31
1 files changed, 27 insertions, 4 deletions
diff --git a/chromium/content/browser/loader/resource_loader_unittest.cc b/chromium/content/browser/loader/resource_loader_unittest.cc
index 99e5fd051bd..f8f3b770326 100644
--- a/chromium/content/browser/loader/resource_loader_unittest.cc
+++ b/chromium/content/browser/loader/resource_loader_unittest.cc
@@ -352,8 +352,8 @@ class ResourceLoaderTest : public testing::Test,
: thread_bundle_(content::TestBrowserThreadBundle::IO_MAINLOOP),
test_url_request_context_(true),
resource_context_(&test_url_request_context_),
- raw_ptr_resource_handler_(NULL),
- raw_ptr_to_request_(NULL) {
+ raw_ptr_resource_handler_(nullptr),
+ raw_ptr_to_request_(nullptr) {
test_url_request_context_.set_job_factory(&job_factory_);
test_url_request_context_.set_network_quality_estimator(
&network_quality_estimator_);
@@ -410,7 +410,8 @@ class ResourceLoaderTest : public testing::Test,
request.get(), resource_type, &resource_context_,
rfh->GetProcess()->GetID(), rfh->GetRenderViewHost()->GetRoutingID(),
rfh->GetRoutingID(), belongs_to_main_frame, true /* allow_download */,
- false /* is_async */, PREVIEWS_OFF /* previews_state */);
+ false /* is_async */, PREVIEWS_OFF /* previews_state */,
+ nullptr /* navigation_ui_data */);
std::unique_ptr<TestResourceHandler> resource_handler(
new TestResourceHandler(nullptr, nullptr));
raw_ptr_resource_handler_ = resource_handler.get();
@@ -460,7 +461,7 @@ class ResourceLoaderTest : public testing::Test,
ResourceDispatcherHostLoginDelegate* CreateLoginDelegate(
ResourceLoader* loader,
net::AuthChallengeInfo* auth_info) override {
- return NULL;
+ return nullptr;
}
bool HandleExternalProtocol(ResourceLoader* loader,
const GURL& url) override {
@@ -595,6 +596,15 @@ class HTTPSSecurityInfoResourceLoaderTest : public ResourceLoaderTest {
const GURL test_https_redirect_url_;
};
+TEST_F(HTTPSSecurityInfoResourceLoaderTest, CertStatusOnResponse) {
+ SetUpResourceLoaderForUrl(test_https_url());
+ loader_->StartRequest();
+ raw_ptr_resource_handler_->WaitUntilResponseComplete();
+ base::RunLoop().RunUntilIdle();
+ EXPECT_EQ(kTestCertError,
+ raw_ptr_resource_handler_->resource_response()->head.cert_status);
+}
+
// Tests that client certificates are requested with ClientCertStore lookup.
TEST_F(ClientCertResourceLoaderTest, WithStoreLookup) {
// Set up the test client cert store.
@@ -727,6 +737,19 @@ TEST_F(ClientCertResourceLoaderTest, StoreAsyncCancel) {
base::RunLoop().RunUntilIdle();
}
+// Tests that a RESOURCE_TYPE_PREFETCH request sets the LOAD_PREFETCH flag.
+TEST_F(ResourceLoaderTest, PrefetchFlag) {
+ std::unique_ptr<net::URLRequest> request(
+ resource_context_.GetRequestContext()->CreateRequest(
+ test_async_url(), net::DEFAULT_PRIORITY, nullptr /* delegate */,
+ TRAFFIC_ANNOTATION_FOR_TESTS));
+ SetUpResourceLoader(std::move(request), RESOURCE_TYPE_PREFETCH, true);
+
+ loader_->StartRequest();
+ raw_ptr_resource_handler_->WaitUntilResponseComplete();
+ EXPECT_EQ(test_data(), raw_ptr_resource_handler_->body());
+}
+
// Test the case the ResourceHandler defers nothing.
TEST_F(ResourceLoaderTest, SyncResourceHandler) {
loader_->StartRequest();