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

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

Issue 2451373003: service worker: Implement NavigationPreloadManager.setHeaderValue (Closed)
Patch Set: rebase Created 4 years, 1 month 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 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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_registration.h" 5 #include "content/browser/service_worker/service_worker_registration.h"
6 6
7 #include <stdint.h> 7 #include <stdint.h>
8 #include <utility> 8 #include <utility>
9 9
10 #include "base/files/scoped_temp_dir.h" 10 #include "base/files/scoped_temp_dir.h"
(...skipping 189 matching lines...) Expand 10 before | Expand all | Expand 10 after
200 version_1->SetStatus(ServiceWorkerVersion::ACTIVATED); 200 version_1->SetStatus(ServiceWorkerVersion::ACTIVATED);
201 scoped_refptr<ServiceWorkerVersion> version_2 = new ServiceWorkerVersion( 201 scoped_refptr<ServiceWorkerVersion> version_2 = new ServiceWorkerVersion(
202 registration.get(), kScript, storage()->NewVersionId(), 202 registration.get(), kScript, storage()->NewVersionId(),
203 context()->AsWeakPtr()); 203 context()->AsWeakPtr());
204 version_2->set_fetch_handler_existence( 204 version_2->set_fetch_handler_existence(
205 ServiceWorkerVersion::FetchHandlerExistence::EXISTS); 205 ServiceWorkerVersion::FetchHandlerExistence::EXISTS);
206 registration->SetWaitingVersion(version_2); 206 registration->SetWaitingVersion(version_2);
207 version_2->SetStatus(ServiceWorkerVersion::INSTALLED); 207 version_2->SetStatus(ServiceWorkerVersion::INSTALLED);
208 208
209 // Navigation preload is disabled by default. 209 // Navigation preload is disabled by default.
210 EXPECT_FALSE(version_1->navigation_preload_enabled()); 210 EXPECT_FALSE(version_1->navigation_preload_state().enabled);
211 // Enabling it sets the flag on the active version. 211 // Enabling it sets the flag on the active version.
212 registration->EnableNavigationPreload(true); 212 registration->EnableNavigationPreload(true);
213 EXPECT_TRUE(version_1->navigation_preload_enabled()); 213 EXPECT_TRUE(version_1->navigation_preload_state().enabled);
214 // A new active version gets the flag. 214 // A new active version gets the flag.
215 registration->SetActiveVersion(version_2); 215 registration->SetActiveVersion(version_2);
216 version_2->SetStatus(ServiceWorkerVersion::ACTIVATING); 216 version_2->SetStatus(ServiceWorkerVersion::ACTIVATING);
217 EXPECT_TRUE(version_2->navigation_preload_enabled()); 217 EXPECT_TRUE(version_2->navigation_preload_state().enabled);
218 // Disabling it unsets the flag on the active version. 218 // Disabling it unsets the flag on the active version.
219 registration->EnableNavigationPreload(false); 219 registration->EnableNavigationPreload(false);
220 EXPECT_FALSE(version_2->navigation_preload_enabled()); 220 EXPECT_FALSE(version_2->navigation_preload_state().enabled);
221 } 221 }
222 222
223 // Sets up a registration with a waiting worker, and an active worker 223 // Sets up a registration with a waiting worker, and an active worker
224 // with a controllee and an inflight request. 224 // with a controllee and an inflight request.
225 class ServiceWorkerActivationTest : public ServiceWorkerRegistrationTestP { 225 class ServiceWorkerActivationTest : public ServiceWorkerRegistrationTestP {
226 public: 226 public:
227 ServiceWorkerActivationTest() : ServiceWorkerRegistrationTestP() {} 227 ServiceWorkerActivationTest() : ServiceWorkerRegistrationTestP() {}
228 228
229 void SetUp() override { 229 void SetUp() override {
230 ServiceWorkerRegistrationTest::SetUp(); 230 ServiceWorkerRegistrationTest::SetUp();
(...skipping 146 matching lines...) Expand 10 before | Expand all | Expand 10 after
377 377
378 INSTANTIATE_TEST_CASE_P(ServiceWorkerRegistrationTest, 378 INSTANTIATE_TEST_CASE_P(ServiceWorkerRegistrationTest,
379 ServiceWorkerRegistrationTestP, 379 ServiceWorkerRegistrationTestP,
380 testing::Bool()); 380 testing::Bool());
381 381
382 INSTANTIATE_TEST_CASE_P(ServiceWorkerActivationTest, 382 INSTANTIATE_TEST_CASE_P(ServiceWorkerActivationTest,
383 ServiceWorkerActivationTest, 383 ServiceWorkerActivationTest,
384 testing::Bool()); 384 testing::Bool());
385 385
386 } // namespace content 386 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/service_worker/service_worker_registration.cc ('k') | content/browser/service_worker/service_worker_version.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698