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

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

Issue 2771823002: Implement updateViaCache flag and no-cache by default for main service worker scripts
Patch Set: change useCache to updateViaCache Created 3 years, 6 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 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/public/browser/service_worker_context.h" 5 #include "content/public/browser/service_worker_context.h"
6 6
7 #include <stdint.h> 7 #include <stdint.h>
8 8
9 #include "base/files/scoped_temp_dir.h" 9 #include "base/files/scoped_temp_dir.h"
10 #include "base/logging.h" 10 #include "base/logging.h"
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after
72 EXPECT_TRUE(registration->waiting_version()); 72 EXPECT_TRUE(registration->waiting_version());
73 } else { 73 } else {
74 EXPECT_FALSE(registration->waiting_version()); 74 EXPECT_FALSE(registration->waiting_version());
75 } 75 }
76 76
77 if (expect_active) { 77 if (expect_active) {
78 EXPECT_TRUE(registration->active_version()); 78 EXPECT_TRUE(registration->active_version());
79 } else { 79 } else {
80 EXPECT_FALSE(registration->active_version()); 80 EXPECT_FALSE(registration->active_version());
81 } 81 }
82
83 EXPECT_EQ(blink::WebServiceWorkerUpdateViaCache::kImports,
84 registration->update_via_cache());
82 } 85 }
83 86
84 class RejectInstallTestHelper : public EmbeddedWorkerTestHelper { 87 class RejectInstallTestHelper : public EmbeddedWorkerTestHelper {
85 public: 88 public:
86 RejectInstallTestHelper() : EmbeddedWorkerTestHelper(base::FilePath()) {} 89 RejectInstallTestHelper() : EmbeddedWorkerTestHelper(base::FilePath()) {}
87 90
88 void OnInstallEvent( 91 void OnInstallEvent(
89 mojom::ServiceWorkerInstallEventMethodsAssociatedPtrInfo client, 92 mojom::ServiceWorkerInstallEventMethodsAssociatedPtrInfo client,
90 mojom::ServiceWorkerEventDispatcher::DispatchInstallEventCallback 93 mojom::ServiceWorkerEventDispatcher::DispatchInstallEventCallback
91 callback) override { 94 callback) override {
(...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after
203 GURL pattern("http://www.example.com/"); 206 GURL pattern("http://www.example.com/");
204 GURL script_url("http://www.example.com/service_worker.js"); 207 GURL script_url("http://www.example.com/service_worker.js");
205 208
206 RecordableEmbeddedWorkerInstanceClient* client = nullptr; 209 RecordableEmbeddedWorkerInstanceClient* client = nullptr;
207 client = helper_->CreateAndRegisterMockInstanceClient< 210 client = helper_->CreateAndRegisterMockInstanceClient<
208 RecordableEmbeddedWorkerInstanceClient>(helper_->AsWeakPtr()); 211 RecordableEmbeddedWorkerInstanceClient>(helper_->AsWeakPtr());
209 212
210 int64_t registration_id = kInvalidServiceWorkerRegistrationId; 213 int64_t registration_id = kInvalidServiceWorkerRegistrationId;
211 bool called = false; 214 bool called = false;
212 context()->RegisterServiceWorker( 215 context()->RegisterServiceWorker(
213 pattern, 216 script_url, ServiceWorkerRegistrationOptions(pattern), NULL,
214 script_url,
215 NULL,
216 MakeRegisteredCallback(&called, &registration_id)); 217 MakeRegisteredCallback(&called, &registration_id));
217 218
218 ASSERT_FALSE(called); 219 ASSERT_FALSE(called);
219 base::RunLoop().RunUntilIdle(); 220 base::RunLoop().RunUntilIdle();
220 EXPECT_TRUE(called); 221 EXPECT_TRUE(called);
221 222
222 ASSERT_EQ(2UL, helper_->dispatched_events()->size()); 223 ASSERT_EQ(2UL, helper_->dispatched_events()->size());
223 ASSERT_EQ(2UL, client->events().size()); 224 ASSERT_EQ(2UL, client->events().size());
224 EXPECT_EQ(RecordableEmbeddedWorkerInstanceClient::Message::StartWorker, 225 EXPECT_EQ(RecordableEmbeddedWorkerInstanceClient::Message::StartWorker,
225 client->events()[0]); 226 client->events()[0]);
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
258 helper_.reset(new RejectInstallTestHelper); 259 helper_.reset(new RejectInstallTestHelper);
259 helper_->context_wrapper()->AddObserver(this); 260 helper_->context_wrapper()->AddObserver(this);
260 261
261 RecordableEmbeddedWorkerInstanceClient* client = nullptr; 262 RecordableEmbeddedWorkerInstanceClient* client = nullptr;
262 client = helper_->CreateAndRegisterMockInstanceClient< 263 client = helper_->CreateAndRegisterMockInstanceClient<
263 RecordableEmbeddedWorkerInstanceClient>(helper_->AsWeakPtr()); 264 RecordableEmbeddedWorkerInstanceClient>(helper_->AsWeakPtr());
264 265
265 int64_t registration_id = kInvalidServiceWorkerRegistrationId; 266 int64_t registration_id = kInvalidServiceWorkerRegistrationId;
266 bool called = false; 267 bool called = false;
267 context()->RegisterServiceWorker( 268 context()->RegisterServiceWorker(
268 pattern, 269 script_url, ServiceWorkerRegistrationOptions(pattern), NULL,
269 script_url,
270 NULL,
271 MakeRegisteredCallback(&called, &registration_id)); 270 MakeRegisteredCallback(&called, &registration_id));
272 271
273 ASSERT_FALSE(called); 272 ASSERT_FALSE(called);
274 base::RunLoop().RunUntilIdle(); 273 base::RunLoop().RunUntilIdle();
275 EXPECT_TRUE(called); 274 EXPECT_TRUE(called);
276 275
277 ASSERT_EQ(1UL, helper_->dispatched_events()->size()); 276 ASSERT_EQ(1UL, helper_->dispatched_events()->size());
278 ASSERT_EQ(2UL, client->events().size()); 277 ASSERT_EQ(2UL, client->events().size());
279 EXPECT_EQ(RecordableEmbeddedWorkerInstanceClient::Message::StartWorker, 278 EXPECT_EQ(RecordableEmbeddedWorkerInstanceClient::Message::StartWorker,
280 client->events()[0]); 279 client->events()[0]);
(...skipping 29 matching lines...) Expand all
310 helper_.reset(new RejectActivateTestHelper); 309 helper_.reset(new RejectActivateTestHelper);
311 helper_->context_wrapper()->AddObserver(this); 310 helper_->context_wrapper()->AddObserver(this);
312 311
313 RecordableEmbeddedWorkerInstanceClient* client = nullptr; 312 RecordableEmbeddedWorkerInstanceClient* client = nullptr;
314 client = helper_->CreateAndRegisterMockInstanceClient< 313 client = helper_->CreateAndRegisterMockInstanceClient<
315 RecordableEmbeddedWorkerInstanceClient>(helper_->AsWeakPtr()); 314 RecordableEmbeddedWorkerInstanceClient>(helper_->AsWeakPtr());
316 315
317 int64_t registration_id = kInvalidServiceWorkerRegistrationId; 316 int64_t registration_id = kInvalidServiceWorkerRegistrationId;
318 bool called = false; 317 bool called = false;
319 context()->RegisterServiceWorker( 318 context()->RegisterServiceWorker(
320 pattern, script_url, NULL, 319 script_url, ServiceWorkerRegistrationOptions(pattern), NULL,
321 MakeRegisteredCallback(&called, &registration_id)); 320 MakeRegisteredCallback(&called, &registration_id));
322 321
323 ASSERT_FALSE(called); 322 ASSERT_FALSE(called);
324 base::RunLoop().RunUntilIdle(); 323 base::RunLoop().RunUntilIdle();
325 EXPECT_TRUE(called); 324 EXPECT_TRUE(called);
326 325
327 ASSERT_EQ(2UL, helper_->dispatched_events()->size()); 326 ASSERT_EQ(2UL, helper_->dispatched_events()->size());
328 ASSERT_EQ(2UL, client->events().size()); 327 ASSERT_EQ(2UL, client->events().size());
329 EXPECT_EQ(RecordableEmbeddedWorkerInstanceClient::Message::StartWorker, 328 EXPECT_EQ(RecordableEmbeddedWorkerInstanceClient::Message::StartWorker,
330 client->events()[0]); 329 client->events()[0]);
(...skipping 18 matching lines...) Expand all
349 base::RunLoop().RunUntilIdle(); 348 base::RunLoop().RunUntilIdle();
350 } 349 }
351 350
352 // Make sure registrations are cleaned up when they are unregistered. 351 // Make sure registrations are cleaned up when they are unregistered.
353 TEST_F(ServiceWorkerContextTest, Unregister) { 352 TEST_F(ServiceWorkerContextTest, Unregister) {
354 GURL pattern("http://www.example.com/"); 353 GURL pattern("http://www.example.com/");
355 354
356 bool called = false; 355 bool called = false;
357 int64_t registration_id = kInvalidServiceWorkerRegistrationId; 356 int64_t registration_id = kInvalidServiceWorkerRegistrationId;
358 context()->RegisterServiceWorker( 357 context()->RegisterServiceWorker(
359 pattern,
360 GURL("http://www.example.com/service_worker.js"), 358 GURL("http://www.example.com/service_worker.js"),
361 NULL, 359 ServiceWorkerRegistrationOptions(pattern), NULL,
362 MakeRegisteredCallback(&called, &registration_id)); 360 MakeRegisteredCallback(&called, &registration_id));
363 361
364 ASSERT_FALSE(called); 362 ASSERT_FALSE(called);
365 base::RunLoop().RunUntilIdle(); 363 base::RunLoop().RunUntilIdle();
366 ASSERT_TRUE(called); 364 ASSERT_TRUE(called);
367 EXPECT_NE(kInvalidServiceWorkerRegistrationId, registration_id); 365 EXPECT_NE(kInvalidServiceWorkerRegistrationId, registration_id);
368 366
369 called = false; 367 called = false;
370 context()->UnregisterServiceWorker(pattern, 368 context()->UnregisterServiceWorker(pattern,
371 MakeUnregisteredCallback(&called)); 369 MakeUnregisteredCallback(&called));
(...skipping 26 matching lines...) Expand all
398 GURL origin1_p2("http://www.example.com/hello"); 396 GURL origin1_p2("http://www.example.com/hello");
399 GURL origin2_p1("http://www.example.com:8080/again"); 397 GURL origin2_p1("http://www.example.com:8080/again");
400 GURL origin3_p1("http://www.other.com/"); 398 GURL origin3_p1("http://www.other.com/");
401 399
402 bool called = false; 400 bool called = false;
403 int64_t registration_id1 = kInvalidServiceWorkerRegistrationId; 401 int64_t registration_id1 = kInvalidServiceWorkerRegistrationId;
404 int64_t registration_id2 = kInvalidServiceWorkerRegistrationId; 402 int64_t registration_id2 = kInvalidServiceWorkerRegistrationId;
405 int64_t registration_id3 = kInvalidServiceWorkerRegistrationId; 403 int64_t registration_id3 = kInvalidServiceWorkerRegistrationId;
406 int64_t registration_id4 = kInvalidServiceWorkerRegistrationId; 404 int64_t registration_id4 = kInvalidServiceWorkerRegistrationId;
407 context()->RegisterServiceWorker( 405 context()->RegisterServiceWorker(
408 origin1_p1,
409 GURL("http://www.example.com/service_worker.js"), 406 GURL("http://www.example.com/service_worker.js"),
410 NULL, 407 ServiceWorkerRegistrationOptions(origin1_p1), NULL,
411 MakeRegisteredCallback(&called, &registration_id1)); 408 MakeRegisteredCallback(&called, &registration_id1));
412 context()->RegisterServiceWorker( 409 context()->RegisterServiceWorker(
413 origin1_p2,
414 GURL("http://www.example.com/service_worker2.js"), 410 GURL("http://www.example.com/service_worker2.js"),
415 NULL, 411 ServiceWorkerRegistrationOptions(origin1_p2), NULL,
416 MakeRegisteredCallback(&called, &registration_id2)); 412 MakeRegisteredCallback(&called, &registration_id2));
417 context()->RegisterServiceWorker( 413 context()->RegisterServiceWorker(
418 origin2_p1,
419 GURL("http://www.example.com:8080/service_worker3.js"), 414 GURL("http://www.example.com:8080/service_worker3.js"),
420 NULL, 415 ServiceWorkerRegistrationOptions(origin2_p1), NULL,
421 MakeRegisteredCallback(&called, &registration_id3)); 416 MakeRegisteredCallback(&called, &registration_id3));
422 context()->RegisterServiceWorker( 417 context()->RegisterServiceWorker(
423 origin3_p1,
424 GURL("http://www.other.com/service_worker4.js"), 418 GURL("http://www.other.com/service_worker4.js"),
425 NULL, 419 ServiceWorkerRegistrationOptions(origin3_p1), NULL,
426 MakeRegisteredCallback(&called, &registration_id4)); 420 MakeRegisteredCallback(&called, &registration_id4));
427 421
428 ASSERT_FALSE(called); 422 ASSERT_FALSE(called);
429 base::RunLoop().RunUntilIdle(); 423 base::RunLoop().RunUntilIdle();
430 ASSERT_TRUE(called); 424 ASSERT_TRUE(called);
431 425
432 EXPECT_NE(kInvalidServiceWorkerRegistrationId, registration_id1); 426 EXPECT_NE(kInvalidServiceWorkerRegistrationId, registration_id1);
433 EXPECT_NE(kInvalidServiceWorkerRegistrationId, registration_id2); 427 EXPECT_NE(kInvalidServiceWorkerRegistrationId, registration_id2);
434 EXPECT_NE(kInvalidServiceWorkerRegistrationId, registration_id3); 428 EXPECT_NE(kInvalidServiceWorkerRegistrationId, registration_id3);
435 EXPECT_NE(kInvalidServiceWorkerRegistrationId, registration_id4); 429 EXPECT_NE(kInvalidServiceWorkerRegistrationId, registration_id4);
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after
495 EXPECT_EQ(registration_id1, notifications_[5].registration_id); 489 EXPECT_EQ(registration_id1, notifications_[5].registration_id);
496 } 490 }
497 491
498 // Make sure registering a new script shares an existing registration. 492 // Make sure registering a new script shares an existing registration.
499 TEST_F(ServiceWorkerContextTest, RegisterNewScript) { 493 TEST_F(ServiceWorkerContextTest, RegisterNewScript) {
500 GURL pattern("http://www.example.com/"); 494 GURL pattern("http://www.example.com/");
501 495
502 bool called = false; 496 bool called = false;
503 int64_t old_registration_id = kInvalidServiceWorkerRegistrationId; 497 int64_t old_registration_id = kInvalidServiceWorkerRegistrationId;
504 context()->RegisterServiceWorker( 498 context()->RegisterServiceWorker(
505 pattern,
506 GURL("http://www.example.com/service_worker.js"), 499 GURL("http://www.example.com/service_worker.js"),
507 NULL, 500 ServiceWorkerRegistrationOptions(pattern), NULL,
508 MakeRegisteredCallback(&called, &old_registration_id)); 501 MakeRegisteredCallback(&called, &old_registration_id));
509 502
510 ASSERT_FALSE(called); 503 ASSERT_FALSE(called);
511 base::RunLoop().RunUntilIdle(); 504 base::RunLoop().RunUntilIdle();
512 ASSERT_TRUE(called); 505 ASSERT_TRUE(called);
513 EXPECT_NE(kInvalidServiceWorkerRegistrationId, old_registration_id); 506 EXPECT_NE(kInvalidServiceWorkerRegistrationId, old_registration_id);
514 507
515 called = false; 508 called = false;
516 int64_t new_registration_id = kInvalidServiceWorkerRegistrationId; 509 int64_t new_registration_id = kInvalidServiceWorkerRegistrationId;
517 context()->RegisterServiceWorker( 510 context()->RegisterServiceWorker(
518 pattern,
519 GURL("http://www.example.com/service_worker_new.js"), 511 GURL("http://www.example.com/service_worker_new.js"),
520 NULL, 512 ServiceWorkerRegistrationOptions(pattern), NULL,
521 MakeRegisteredCallback(&called, &new_registration_id)); 513 MakeRegisteredCallback(&called, &new_registration_id));
522 514
523 ASSERT_FALSE(called); 515 ASSERT_FALSE(called);
524 base::RunLoop().RunUntilIdle(); 516 base::RunLoop().RunUntilIdle();
525 ASSERT_TRUE(called); 517 ASSERT_TRUE(called);
526 518
527 EXPECT_NE(kInvalidServiceWorkerRegistrationId, new_registration_id); 519 EXPECT_NE(kInvalidServiceWorkerRegistrationId, new_registration_id);
528 EXPECT_EQ(old_registration_id, new_registration_id); 520 EXPECT_EQ(old_registration_id, new_registration_id);
529 521
530 ASSERT_EQ(2u, notifications_.size()); 522 ASSERT_EQ(2u, notifications_.size());
531 EXPECT_EQ(REGISTRATION_STORED, notifications_[0].type); 523 EXPECT_EQ(REGISTRATION_STORED, notifications_[0].type);
532 EXPECT_EQ(pattern, notifications_[0].pattern); 524 EXPECT_EQ(pattern, notifications_[0].pattern);
533 EXPECT_EQ(old_registration_id, notifications_[0].registration_id); 525 EXPECT_EQ(old_registration_id, notifications_[0].registration_id);
534 EXPECT_EQ(REGISTRATION_STORED, notifications_[1].type); 526 EXPECT_EQ(REGISTRATION_STORED, notifications_[1].type);
535 EXPECT_EQ(pattern, notifications_[1].pattern); 527 EXPECT_EQ(pattern, notifications_[1].pattern);
536 EXPECT_EQ(new_registration_id, notifications_[1].registration_id); 528 EXPECT_EQ(new_registration_id, notifications_[1].registration_id);
537 } 529 }
538 530
539 // Make sure that when registering a duplicate pattern+script_url 531 // Make sure that when registering a duplicate pattern+script_url
540 // combination, that the same registration is used. 532 // combination, that the same registration is used.
541 TEST_F(ServiceWorkerContextTest, RegisterDuplicateScript) { 533 TEST_F(ServiceWorkerContextTest, RegisterDuplicateScript) {
542 GURL pattern("http://www.example.com/"); 534 GURL pattern("http://www.example.com/");
543 GURL script_url("http://www.example.com/service_worker.js"); 535 GURL script_url("http://www.example.com/service_worker.js");
544 536
545 bool called = false; 537 bool called = false;
546 int64_t old_registration_id = kInvalidServiceWorkerRegistrationId; 538 int64_t old_registration_id = kInvalidServiceWorkerRegistrationId;
547 context()->RegisterServiceWorker( 539 context()->RegisterServiceWorker(
548 pattern, 540 script_url, ServiceWorkerRegistrationOptions(pattern), NULL,
549 script_url,
550 NULL,
551 MakeRegisteredCallback(&called, &old_registration_id)); 541 MakeRegisteredCallback(&called, &old_registration_id));
552 542
553 ASSERT_FALSE(called); 543 ASSERT_FALSE(called);
554 base::RunLoop().RunUntilIdle(); 544 base::RunLoop().RunUntilIdle();
555 ASSERT_TRUE(called); 545 ASSERT_TRUE(called);
556 EXPECT_NE(kInvalidServiceWorkerRegistrationId, old_registration_id); 546 EXPECT_NE(kInvalidServiceWorkerRegistrationId, old_registration_id);
557 547
558 called = false; 548 called = false;
559 int64_t new_registration_id = kInvalidServiceWorkerRegistrationId; 549 int64_t new_registration_id = kInvalidServiceWorkerRegistrationId;
560 context()->RegisterServiceWorker( 550 context()->RegisterServiceWorker(
561 pattern, 551 script_url, ServiceWorkerRegistrationOptions(pattern), NULL,
562 script_url,
563 NULL,
564 MakeRegisteredCallback(&called, &new_registration_id)); 552 MakeRegisteredCallback(&called, &new_registration_id));
565 553
566 ASSERT_FALSE(called); 554 ASSERT_FALSE(called);
567 base::RunLoop().RunUntilIdle(); 555 base::RunLoop().RunUntilIdle();
568 ASSERT_TRUE(called); 556 ASSERT_TRUE(called);
569 EXPECT_EQ(old_registration_id, new_registration_id); 557 EXPECT_EQ(old_registration_id, new_registration_id);
570 558
571 ASSERT_EQ(2u, notifications_.size()); 559 ASSERT_EQ(2u, notifications_.size());
572 EXPECT_EQ(REGISTRATION_STORED, notifications_[0].type); 560 EXPECT_EQ(REGISTRATION_STORED, notifications_[0].type);
573 EXPECT_EQ(pattern, notifications_[0].pattern); 561 EXPECT_EQ(pattern, notifications_[0].pattern);
(...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after
683 // Reinitialize the helper to test on-disk storage. 671 // Reinitialize the helper to test on-disk storage.
684 base::ScopedTempDir user_data_directory; 672 base::ScopedTempDir user_data_directory;
685 ASSERT_TRUE(user_data_directory.CreateUniqueTempDir()); 673 ASSERT_TRUE(user_data_directory.CreateUniqueTempDir());
686 helper_.reset(new EmbeddedWorkerTestHelper(user_data_directory.GetPath())); 674 helper_.reset(new EmbeddedWorkerTestHelper(user_data_directory.GetPath()));
687 helper_->context_wrapper()->AddObserver(this); 675 helper_->context_wrapper()->AddObserver(this);
688 } 676 }
689 677
690 int64_t registration_id = kInvalidServiceWorkerRegistrationId; 678 int64_t registration_id = kInvalidServiceWorkerRegistrationId;
691 bool called = false; 679 bool called = false;
692 context()->RegisterServiceWorker( 680 context()->RegisterServiceWorker(
693 pattern, 681 script_url, ServiceWorkerRegistrationOptions(pattern), NULL,
694 script_url,
695 NULL,
696 MakeRegisteredCallback(&called, &registration_id)); 682 MakeRegisteredCallback(&called, &registration_id));
697 683
698 ASSERT_FALSE(called); 684 ASSERT_FALSE(called);
699 base::RunLoop().RunUntilIdle(); 685 base::RunLoop().RunUntilIdle();
700 EXPECT_TRUE(called); 686 EXPECT_TRUE(called);
701 687
702 context()->storage()->FindRegistrationForId( 688 context()->storage()->FindRegistrationForId(
703 registration_id, 689 registration_id,
704 pattern.GetOrigin(), 690 pattern.GetOrigin(),
705 base::Bind(&ExpectRegisteredWorkers, 691 base::Bind(&ExpectRegisteredWorkers,
(...skipping 22 matching lines...) Expand all
728 registration_id, 714 registration_id,
729 pattern.GetOrigin(), 715 pattern.GetOrigin(),
730 base::Bind(&ExpectRegisteredWorkers, 716 base::Bind(&ExpectRegisteredWorkers,
731 SERVICE_WORKER_ERROR_NOT_FOUND, 717 SERVICE_WORKER_ERROR_NOT_FOUND,
732 false /* expect_waiting */, 718 false /* expect_waiting */,
733 true /* expect_active */)); 719 true /* expect_active */));
734 base::RunLoop().RunUntilIdle(); 720 base::RunLoop().RunUntilIdle();
735 721
736 called = false; 722 called = false;
737 context()->RegisterServiceWorker( 723 context()->RegisterServiceWorker(
738 pattern, 724 script_url, ServiceWorkerRegistrationOptions(pattern), NULL,
739 script_url,
740 NULL,
741 MakeRegisteredCallback(&called, &registration_id)); 725 MakeRegisteredCallback(&called, &registration_id));
742 726
743 ASSERT_FALSE(called); 727 ASSERT_FALSE(called);
744 base::RunLoop().RunUntilIdle(); 728 base::RunLoop().RunUntilIdle();
745 EXPECT_TRUE(called); 729 EXPECT_TRUE(called);
746 730
747 context()->storage()->FindRegistrationForId( 731 context()->storage()->FindRegistrationForId(
748 registration_id, 732 registration_id,
749 pattern.GetOrigin(), 733 pattern.GetOrigin(),
750 base::Bind(&ExpectRegisteredWorkers, 734 base::Bind(&ExpectRegisteredWorkers,
(...skipping 14 matching lines...) Expand all
765 EXPECT_EQ(REGISTRATION_STORED, notifications_[2].type); 749 EXPECT_EQ(REGISTRATION_STORED, notifications_[2].type);
766 EXPECT_EQ(pattern, notifications_[2].pattern); 750 EXPECT_EQ(pattern, notifications_[2].pattern);
767 EXPECT_EQ(registration_id, notifications_[2].registration_id); 751 EXPECT_EQ(registration_id, notifications_[2].registration_id);
768 } 752 }
769 753
770 INSTANTIATE_TEST_CASE_P(ServiceWorkerContextRecoveryTest, 754 INSTANTIATE_TEST_CASE_P(ServiceWorkerContextRecoveryTest,
771 ServiceWorkerContextRecoveryTest, 755 ServiceWorkerContextRecoveryTest,
772 testing::Bool()); 756 testing::Bool());
773 757
774 } // namespace content 758 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698