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 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
91 SetUpWithHelper(new EmbeddedWorkerTestHelper(base::FilePath())); | 91 SetUpWithHelper(new EmbeddedWorkerTestHelper(base::FilePath())); |
92 } | 92 } |
93 | 93 |
94 void SetUpWithHelper(EmbeddedWorkerTestHelper* helper) { | 94 void SetUpWithHelper(EmbeddedWorkerTestHelper* helper) { |
95 helper_.reset(helper); | 95 helper_.reset(helper); |
96 | 96 |
97 // A new unstored registration/version. | 97 // A new unstored registration/version. |
98 scope_ = GURL("https://host/scope/"); | 98 scope_ = GURL("https://host/scope/"); |
99 script_url_ = GURL("https://host/script.js"); | 99 script_url_ = GURL("https://host/script.js"); |
100 registration_ = new ServiceWorkerRegistration( | 100 registration_ = new ServiceWorkerRegistration( |
101 scope_, 1L, context()->AsWeakPtr()); | 101 ServiceWorkerRegistrationOptions(scope_), 1L, context()->AsWeakPtr()); |
102 version_ = new ServiceWorkerVersion( | 102 version_ = new ServiceWorkerVersion( |
103 registration_.get(), script_url_, 1L, context()->AsWeakPtr()); | 103 registration_.get(), script_url_, 1L, context()->AsWeakPtr()); |
104 | 104 |
105 std::vector<ServiceWorkerDatabase::ResourceRecord> records; | 105 std::vector<ServiceWorkerDatabase::ResourceRecord> records; |
106 records.push_back( | 106 records.push_back( |
107 ServiceWorkerDatabase::ResourceRecord(10, version_->script_url(), 100)); | 107 ServiceWorkerDatabase::ResourceRecord(10, version_->script_url(), 100)); |
108 version_->script_cache_map()->SetResources(records); | 108 version_->script_cache_map()->SetResources(records); |
109 version_->SetMainScriptHttpResponseInfo( | 109 version_->SetMainScriptHttpResponseInfo( |
110 EmbeddedWorkerTestHelper::CreateHttpResponseInfo()); | 110 EmbeddedWorkerTestHelper::CreateHttpResponseInfo()); |
111 | 111 |
(...skipping 259 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
371 EXPECT_FALSE(sub_cors_job->ShouldFallbackToNetwork()); | 371 EXPECT_FALSE(sub_cors_job->ShouldFallbackToNetwork()); |
372 EXPECT_FALSE(sub_cors_job->ShouldForwardToServiceWorker()); | 372 EXPECT_FALSE(sub_cors_job->ShouldForwardToServiceWorker()); |
373 | 373 |
374 base::RunLoop().RunUntilIdle(); | 374 base::RunLoop().RunUntilIdle(); |
375 | 375 |
376 EXPECT_FALSE(sub_cors_job->ShouldFallbackToNetwork()); | 376 EXPECT_FALSE(sub_cors_job->ShouldFallbackToNetwork()); |
377 EXPECT_FALSE(sub_cors_job->ShouldForwardToServiceWorker()); | 377 EXPECT_FALSE(sub_cors_job->ShouldForwardToServiceWorker()); |
378 } | 378 } |
379 | 379 |
380 } // namespace content | 380 } // namespace content |
OLD | NEW |