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

Side by Side Diff: content/browser/service_worker/link_header_support_unittest.cc

Issue 2484633004: Change Lo-Fi bool to bitmask to support multiple Previews types (Closed)
Patch Set: fix ContentResourceProviderTest Created 3 years, 11 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 unified diff | Download patch
OLDNEW
1 // Copyright 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "content/browser/service_worker/link_header_support.h" 5 #include "content/browser/service_worker/link_header_support.h"
6 6
7 #include "base/command_line.h" 7 #include "base/command_line.h"
8 #include "base/logging.h" 8 #include "base/logging.h"
9 #include "base/run_loop.h" 9 #include "base/run_loop.h"
10 #include "content/browser/loader/resource_request_info_impl.h" 10 #include "content/browser/loader/resource_request_info_impl.h"
11 #include "content/browser/service_worker/embedded_worker_test_helper.h" 11 #include "content/browser/service_worker/embedded_worker_test_helper.h"
12 #include "content/browser/service_worker/service_worker_context_wrapper.h" 12 #include "content/browser/service_worker/service_worker_context_wrapper.h"
13 #include "content/browser/service_worker/service_worker_registration.h" 13 #include "content/browser/service_worker/service_worker_registration.h"
14 #include "content/browser/service_worker/service_worker_request_handler.h" 14 #include "content/browser/service_worker/service_worker_request_handler.h"
15 #include "content/browser/service_worker/service_worker_test_utils.h" 15 #include "content/browser/service_worker/service_worker_test_utils.h"
16 #include "content/common/service_worker/service_worker_utils.h" 16 #include "content/common/service_worker/service_worker_utils.h"
17 #include "content/public/common/content_switches.h" 17 #include "content/public/common/content_switches.h"
18 #include "content/public/common/previews_state.h"
18 #include "content/public/test/mock_resource_context.h" 19 #include "content/public/test/mock_resource_context.h"
19 #include "content/public/test/test_browser_thread_bundle.h" 20 #include "content/public/test/test_browser_thread_bundle.h"
20 #include "net/http/http_response_headers.h" 21 #include "net/http/http_response_headers.h"
21 #include "net/url_request/url_request_test_job.h" 22 #include "net/url_request/url_request_test_job.h"
22 #include "net/url_request/url_request_test_util.h" 23 #include "net/url_request/url_request_test_util.h"
23 #include "storage/browser/blob/blob_storage_context.h" 24 #include "storage/browser/blob/blob_storage_context.h"
24 #include "testing/gtest/include/gtest/gtest.h" 25 #include "testing/gtest/include/gtest/gtest.h"
25 26
26 namespace content { 27 namespace content {
27 28
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after
108 109
109 std::unique_ptr<net::URLRequest> CreateRequest(const GURL& request_url, 110 std::unique_ptr<net::URLRequest> CreateRequest(const GURL& request_url,
110 ResourceType resource_type) { 111 ResourceType resource_type) {
111 std::unique_ptr<net::URLRequest> request = request_context_.CreateRequest( 112 std::unique_ptr<net::URLRequest> request = request_context_.CreateRequest(
112 request_url, net::DEFAULT_PRIORITY, &request_delegate_); 113 request_url, net::DEFAULT_PRIORITY, &request_delegate_);
113 ResourceRequestInfo::AllocateForTesting( 114 ResourceRequestInfo::AllocateForTesting(
114 request.get(), resource_type, &resource_context_, 115 request.get(), resource_type, &resource_context_,
115 -1 /* render_process_id */, -1 /* render_view_id */, 116 -1 /* render_process_id */, -1 /* render_view_id */,
116 -1 /* render_frame_id */, resource_type == RESOURCE_TYPE_MAIN_FRAME, 117 -1 /* render_frame_id */, resource_type == RESOURCE_TYPE_MAIN_FRAME,
117 false /* parent_is_main_frame */, true /* allow_download */, 118 false /* parent_is_main_frame */, true /* allow_download */,
118 true /* is_async */, false /* is_using_lofi */); 119 true /* is_async */, PREVIEWS_OFF /* previews_state */);
119 ResourceRequestInfoImpl::ForRequest(request.get()) 120 ResourceRequestInfoImpl::ForRequest(request.get())
120 ->set_initiated_in_secure_context_for_testing(true); 121 ->set_initiated_in_secure_context_for_testing(true);
121 122
122 ServiceWorkerRequestHandler::InitializeHandler( 123 ServiceWorkerRequestHandler::InitializeHandler(
123 request.get(), context_wrapper(), &blob_storage_context_, 124 request.get(), context_wrapper(), &blob_storage_context_,
124 render_process_id(), kMockProviderId, false /* skip_service_worker */, 125 render_process_id(), kMockProviderId, false /* skip_service_worker */,
125 FETCH_REQUEST_MODE_NO_CORS, FETCH_CREDENTIALS_MODE_OMIT, 126 FETCH_REQUEST_MODE_NO_CORS, FETCH_CREDENTIALS_MODE_OMIT,
126 FetchRedirectMode::FOLLOW_MODE, resource_type, 127 FetchRedirectMode::FOLLOW_MODE, resource_type,
127 REQUEST_CONTEXT_TYPE_HYPERLINK, REQUEST_CONTEXT_FRAME_TYPE_TOP_LEVEL, 128 REQUEST_CONTEXT_TYPE_HYPERLINK, REQUEST_CONTEXT_FRAME_TYPE_TOP_LEVEL,
128 nullptr); 129 nullptr);
(...skipping 252 matching lines...) Expand 10 before | Expand all | Expand 10 after
381 ProcessLinkHeaderForRequest( 382 ProcessLinkHeaderForRequest(
382 CreateSubresourceRequest(GURL("https://example.com/foo/bar/")).get(), 383 CreateSubresourceRequest(GURL("https://example.com/foo/bar/")).get(),
383 "<../foo.js>; rel=serviceworker", context_wrapper()); 384 "<../foo.js>; rel=serviceworker", context_wrapper());
384 base::RunLoop().RunUntilIdle(); 385 base::RunLoop().RunUntilIdle();
385 386
386 std::vector<ServiceWorkerRegistrationInfo> registrations = GetRegistrations(); 387 std::vector<ServiceWorkerRegistrationInfo> registrations = GetRegistrations();
387 ASSERT_EQ(1u, registrations.size()); 388 ASSERT_EQ(1u, registrations.size());
388 } 389 }
389 390
390 } // namespace content 391 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/loader/resource_request_info_impl.cc ('k') | content/child/web_url_loader_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698