OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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/service_worker_controllee_request_handl
er.h" | 5 #include "content/browser/service_worker/service_worker_controllee_request_handl
er.h" |
6 | 6 |
7 #include <utility> | 7 #include <utility> |
8 #include <vector> | 8 #include <vector> |
9 | 9 |
10 #include "base/callback_helpers.h" | 10 #include "base/callback_helpers.h" |
11 #include "base/files/scoped_temp_dir.h" | 11 #include "base/files/scoped_temp_dir.h" |
12 #include "base/logging.h" | 12 #include "base/logging.h" |
13 #include "base/run_loop.h" | 13 #include "base/run_loop.h" |
14 #include "content/browser/browser_thread_impl.h" | 14 #include "content/browser/browser_thread_impl.h" |
15 #include "content/browser/fileapi/mock_url_request_delegate.h" | 15 #include "content/browser/fileapi/mock_url_request_delegate.h" |
16 #include "content/browser/service_worker/embedded_worker_test_helper.h" | 16 #include "content/browser/service_worker/embedded_worker_test_helper.h" |
17 #include "content/browser/service_worker/service_worker_context_core.h" | 17 #include "content/browser/service_worker/service_worker_context_core.h" |
18 #include "content/browser/service_worker/service_worker_provider_host.h" | 18 #include "content/browser/service_worker/service_worker_provider_host.h" |
19 #include "content/browser/service_worker/service_worker_registration.h" | 19 #include "content/browser/service_worker/service_worker_registration.h" |
20 #include "content/browser/service_worker/service_worker_url_request_job.h" | 20 #include "content/browser/service_worker/service_worker_url_request_job.h" |
21 #include "content/common/resource_request_body_impl.h" | 21 #include "content/common/resource_request_body_impl.h" |
| 22 #include "content/common/service_worker/service_worker_types.h" |
22 #include "content/common/service_worker/service_worker_utils.h" | 23 #include "content/common/service_worker/service_worker_utils.h" |
23 #include "content/public/browser/resource_context.h" | 24 #include "content/public/browser/resource_context.h" |
24 #include "content/public/common/request_context_frame_type.h" | 25 #include "content/public/common/request_context_frame_type.h" |
25 #include "content/public/common/request_context_type.h" | 26 #include "content/public/common/request_context_type.h" |
26 #include "content/public/common/resource_type.h" | 27 #include "content/public/common/resource_type.h" |
27 #include "content/public/test/mock_resource_context.h" | 28 #include "content/public/test/mock_resource_context.h" |
28 #include "content/public/test/test_browser_thread_bundle.h" | 29 #include "content/public/test/test_browser_thread_bundle.h" |
29 #include "content/test/test_content_browser_client.h" | 30 #include "content/test/test_content_browser_client.h" |
30 #include "net/url_request/url_request_context.h" | 31 #include "net/url_request/url_request_context.h" |
31 #include "testing/gtest/include/gtest/gtest.h" | 32 #include "testing/gtest/include/gtest/gtest.h" |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
70 handler_(new ServiceWorkerControlleeRequestHandler( | 71 handler_(new ServiceWorkerControlleeRequestHandler( |
71 test->context()->AsWeakPtr(), | 72 test->context()->AsWeakPtr(), |
72 test->provider_host_, | 73 test->provider_host_, |
73 base::WeakPtr<storage::BlobStorageContext>(), | 74 base::WeakPtr<storage::BlobStorageContext>(), |
74 fetch_type, | 75 fetch_type, |
75 FETCH_CREDENTIALS_MODE_OMIT, | 76 FETCH_CREDENTIALS_MODE_OMIT, |
76 FetchRedirectMode::FOLLOW_MODE, | 77 FetchRedirectMode::FOLLOW_MODE, |
77 type, | 78 type, |
78 REQUEST_CONTEXT_TYPE_HYPERLINK, | 79 REQUEST_CONTEXT_TYPE_HYPERLINK, |
79 REQUEST_CONTEXT_FRAME_TYPE_TOP_LEVEL, | 80 REQUEST_CONTEXT_FRAME_TYPE_TOP_LEVEL, |
80 scoped_refptr<ResourceRequestBodyImpl>())), | 81 scoped_refptr<ResourceRequestBodyImpl>(), |
| 82 MojoURLLoaderFactoryGetter())), |
81 job_(nullptr) {} | 83 job_(nullptr) {} |
82 | 84 |
83 ServiceWorkerURLRequestJob* MaybeCreateJob() { | 85 ServiceWorkerURLRequestJob* MaybeCreateJob() { |
84 job_.reset(handler_->MaybeCreateJob(request_.get(), nullptr, | 86 job_.reset(handler_->MaybeCreateJob(request_.get(), nullptr, |
85 &test_->mock_resource_context_)); | 87 &test_->mock_resource_context_)); |
86 return static_cast<ServiceWorkerURLRequestJob*>(job_.get()); | 88 return static_cast<ServiceWorkerURLRequestJob*>(job_.get()); |
87 } | 89 } |
88 | 90 |
89 void ResetHandler() { handler_.reset(nullptr); } | 91 void ResetHandler() { handler_.reset(nullptr); } |
90 | 92 |
(...skipping 246 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
337 EXPECT_FALSE(sub_cors_job->ShouldFallbackToNetwork()); | 339 EXPECT_FALSE(sub_cors_job->ShouldFallbackToNetwork()); |
338 EXPECT_FALSE(sub_cors_job->ShouldForwardToServiceWorker()); | 340 EXPECT_FALSE(sub_cors_job->ShouldForwardToServiceWorker()); |
339 | 341 |
340 base::RunLoop().RunUntilIdle(); | 342 base::RunLoop().RunUntilIdle(); |
341 | 343 |
342 EXPECT_FALSE(sub_cors_job->ShouldFallbackToNetwork()); | 344 EXPECT_FALSE(sub_cors_job->ShouldFallbackToNetwork()); |
343 EXPECT_FALSE(sub_cors_job->ShouldForwardToServiceWorker()); | 345 EXPECT_FALSE(sub_cors_job->ShouldForwardToServiceWorker()); |
344 } | 346 } |
345 | 347 |
346 } // namespace content | 348 } // namespace content |
OLD | NEW |