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

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

Issue 2771823002: Implement updateViaCache flag and no-cache by default for main service worker scripts
Patch Set: fix tests Created 3 years, 8 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 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_url_request_job.h" 5 #include "content/browser/service_worker/service_worker_url_request_job.h"
6 6
7 #include <stdint.h> 7 #include <stdint.h>
8 8
9 #include <memory> 9 #include <memory>
10 #include <utility> 10 #include <utility>
(...skipping 143 matching lines...) Expand 10 before | Expand all | Expand 10 after
154 browser_context_.reset(new TestBrowserContext); 154 browser_context_.reset(new TestBrowserContext);
155 InitializeResourceContext(browser_context_.get()); 155 InitializeResourceContext(browser_context_.get());
156 SetUpWithHelper(new EmbeddedWorkerTestHelper(base::FilePath())); 156 SetUpWithHelper(new EmbeddedWorkerTestHelper(base::FilePath()));
157 } 157 }
158 158
159 void SetUpWithHelper(EmbeddedWorkerTestHelper* helper, 159 void SetUpWithHelper(EmbeddedWorkerTestHelper* helper,
160 bool set_main_script_http_response_info = true) { 160 bool set_main_script_http_response_info = true) {
161 helper_.reset(helper); 161 helper_.reset(helper);
162 162
163 registration_ = new ServiceWorkerRegistration( 163 registration_ = new ServiceWorkerRegistration(
164 GURL("https://example.com/"), 1L, helper_->context()->AsWeakPtr()); 164 GURL("https://example.com/"), false /* use_cache */, 1L,
165 helper_->context()->AsWeakPtr());
165 version_ = new ServiceWorkerVersion( 166 version_ = new ServiceWorkerVersion(
166 registration_.get(), GURL("https://example.com/service_worker.js"), 1L, 167 registration_.get(), GURL("https://example.com/service_worker.js"), 1L,
167 helper_->context()->AsWeakPtr()); 168 helper_->context()->AsWeakPtr());
168 std::vector<ServiceWorkerDatabase::ResourceRecord> records; 169 std::vector<ServiceWorkerDatabase::ResourceRecord> records;
169 records.push_back( 170 records.push_back(
170 ServiceWorkerDatabase::ResourceRecord(10, version_->script_url(), 100)); 171 ServiceWorkerDatabase::ResourceRecord(10, version_->script_url(), 100));
171 version_->script_cache_map()->SetResources(records); 172 version_->script_cache_map()->SetResources(records);
172 version_->set_fetch_handler_existence( 173 version_->set_fetch_handler_existence(
173 ServiceWorkerVersion::FetchHandlerExistence::EXISTS); 174 ServiceWorkerVersion::FetchHandlerExistence::EXISTS);
174 175
(...skipping 919 matching lines...) Expand 10 before | Expand all | Expand 10 after
1094 base::RunLoop().RunUntilIdle(); 1095 base::RunLoop().RunUntilIdle();
1095 1096
1096 // The fetch event request should no longer be in-flight. 1097 // The fetch event request should no longer be in-flight.
1097 EXPECT_FALSE(version_->HasWork()); 1098 EXPECT_FALSE(version_->HasWork());
1098 } 1099 }
1099 1100
1100 // TODO(kinuko): Add more tests with different response data and also for 1101 // TODO(kinuko): Add more tests with different response data and also for
1101 // FallbackToNetwork case. 1102 // FallbackToNetwork case.
1102 1103
1103 } // namespace content 1104 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698