| 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" |
| (...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 118 registration_.get(), script_url_, 1L, context()->AsWeakPtr()); | 118 registration_.get(), script_url_, 1L, context()->AsWeakPtr()); |
| 119 | 119 |
| 120 std::vector<ServiceWorkerDatabase::ResourceRecord> records; | 120 std::vector<ServiceWorkerDatabase::ResourceRecord> records; |
| 121 records.push_back( | 121 records.push_back( |
| 122 ServiceWorkerDatabase::ResourceRecord(10, version_->script_url(), 100)); | 122 ServiceWorkerDatabase::ResourceRecord(10, version_->script_url(), 100)); |
| 123 version_->script_cache_map()->SetResources(records); | 123 version_->script_cache_map()->SetResources(records); |
| 124 version_->SetMainScriptHttpResponseInfo( | 124 version_->SetMainScriptHttpResponseInfo( |
| 125 EmbeddedWorkerTestHelper::CreateHttpResponseInfo()); | 125 EmbeddedWorkerTestHelper::CreateHttpResponseInfo()); |
| 126 | 126 |
| 127 // An empty host. | 127 // An empty host. |
| 128 std::unique_ptr<ServiceWorkerProviderHost> host( | 128 std::unique_ptr<ServiceWorkerProviderHost> host = |
| 129 new ServiceWorkerProviderHost( | 129 CreateProviderHostForWindow( |
| 130 helper_->mock_render_process_id(), MSG_ROUTING_NONE, | 130 helper_->mock_render_process_id(), kMockProviderId, |
| 131 kMockProviderId, SERVICE_WORKER_PROVIDER_FOR_WINDOW, | 131 true /* is_parent_frame_secure */, helper_->context()->AsWeakPtr()); |
| 132 ServiceWorkerProviderHost::FrameSecurityLevel::SECURE, | |
| 133 context()->AsWeakPtr(), NULL)); | |
| 134 provider_host_ = host->AsWeakPtr(); | 132 provider_host_ = host->AsWeakPtr(); |
| 135 context()->AddProviderHost(std::move(host)); | 133 context()->AddProviderHost(std::move(host)); |
| 136 | 134 |
| 137 context()->storage()->LazyInitialize(base::Bind(&base::DoNothing)); | 135 context()->storage()->LazyInitialize(base::Bind(&base::DoNothing)); |
| 138 base::RunLoop().RunUntilIdle(); | 136 base::RunLoop().RunUntilIdle(); |
| 139 } | 137 } |
| 140 | 138 |
| 141 void TearDown() override { | 139 void TearDown() override { |
| 142 version_ = NULL; | 140 version_ = NULL; |
| 143 registration_ = NULL; | 141 registration_ = NULL; |
| (...skipping 241 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 385 EXPECT_FALSE(sub_cors_job->ShouldFallbackToNetwork()); | 383 EXPECT_FALSE(sub_cors_job->ShouldFallbackToNetwork()); |
| 386 EXPECT_FALSE(sub_cors_job->ShouldForwardToServiceWorker()); | 384 EXPECT_FALSE(sub_cors_job->ShouldForwardToServiceWorker()); |
| 387 | 385 |
| 388 base::RunLoop().RunUntilIdle(); | 386 base::RunLoop().RunUntilIdle(); |
| 389 | 387 |
| 390 EXPECT_FALSE(sub_cors_job->ShouldFallbackToNetwork()); | 388 EXPECT_FALSE(sub_cors_job->ShouldFallbackToNetwork()); |
| 391 EXPECT_FALSE(sub_cors_job->ShouldForwardToServiceWorker()); | 389 EXPECT_FALSE(sub_cors_job->ShouldForwardToServiceWorker()); |
| 392 } | 390 } |
| 393 | 391 |
| 394 } // namespace content | 392 } // namespace content |
| OLD | NEW |