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

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

Issue 2251633002: Use tri-state enum for the existence of Fetch Handler in ServiceWorkerVersion. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: s/status/existence/ Created 4 years, 4 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 139 matching lines...) Expand 10 before | Expand all | Expand 10 after
150 150
151 registration_ = new ServiceWorkerRegistration( 151 registration_ = new ServiceWorkerRegistration(
152 GURL("https://example.com/"), 1L, helper_->context()->AsWeakPtr()); 152 GURL("https://example.com/"), 1L, helper_->context()->AsWeakPtr());
153 version_ = new ServiceWorkerVersion( 153 version_ = new ServiceWorkerVersion(
154 registration_.get(), GURL("https://example.com/service_worker.js"), 1L, 154 registration_.get(), GURL("https://example.com/service_worker.js"), 1L,
155 helper_->context()->AsWeakPtr()); 155 helper_->context()->AsWeakPtr());
156 std::vector<ServiceWorkerDatabase::ResourceRecord> records; 156 std::vector<ServiceWorkerDatabase::ResourceRecord> records;
157 records.push_back( 157 records.push_back(
158 ServiceWorkerDatabase::ResourceRecord(10, version_->script_url(), 100)); 158 ServiceWorkerDatabase::ResourceRecord(10, version_->script_url(), 100));
159 version_->script_cache_map()->SetResources(records); 159 version_->script_cache_map()->SetResources(records);
160 version_->set_fetch_handler_existence(
161 ServiceWorkerVersion::FetchHandlerExistence::EXISTS);
160 162
161 // Make the registration findable via storage functions. 163 // Make the registration findable via storage functions.
162 helper_->context()->storage()->LazyInitialize(base::Bind(&base::DoNothing)); 164 helper_->context()->storage()->LazyInitialize(base::Bind(&base::DoNothing));
163 base::RunLoop().RunUntilIdle(); 165 base::RunLoop().RunUntilIdle();
164 ServiceWorkerStatusCode status = SERVICE_WORKER_ERROR_FAILED; 166 ServiceWorkerStatusCode status = SERVICE_WORKER_ERROR_FAILED;
165 helper_->context()->storage()->StoreRegistration( 167 helper_->context()->storage()->StoreRegistration(
166 registration_.get(), 168 registration_.get(),
167 version_.get(), 169 version_.get(),
168 CreateReceiverOnCurrentThread(&status)); 170 CreateReceiverOnCurrentThread(&status));
169 base::RunLoop().RunUntilIdle(); 171 base::RunLoop().RunUntilIdle();
(...skipping 900 matching lines...) Expand 10 before | Expand all | Expand 10 after
1070 base::RunLoop().RunUntilIdle(); 1072 base::RunLoop().RunUntilIdle();
1071 1073
1072 // The fetch event request should no longer be in-flight. 1074 // The fetch event request should no longer be in-flight.
1073 EXPECT_FALSE(version_->HasWork()); 1075 EXPECT_FALSE(version_->HasWork());
1074 } 1076 }
1075 1077
1076 // TODO(kinuko): Add more tests with different response data and also for 1078 // TODO(kinuko): Add more tests with different response data and also for
1077 // FallbackToNetwork case. 1079 // FallbackToNetwork case.
1078 1080
1079 } // namespace content 1081 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698