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

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

Issue 1815363002: Add RetainedRef uses where needed. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 9 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 <stdint.h> 5 #include <stdint.h>
6 6
7 #include "base/macros.h" 7 #include "base/macros.h"
8 #include "base/run_loop.h" 8 #include "base/run_loop.h"
9 #include "content/browser/message_port_service.h" 9 #include "content/browser/message_port_service.h"
10 #include "content/browser/service_worker/embedded_worker_registry.h" 10 #include "content/browser/service_worker/embedded_worker_registry.h"
(...skipping 552 matching lines...) Expand 10 before | Expand all | Expand 10 after
563 // Version's status must not have changed during activation. 563 // Version's status must not have changed during activation.
564 EXPECT_FALSE(status_change_called); 564 EXPECT_FALSE(status_change_called);
565 EXPECT_EQ(ServiceWorkerVersion::ACTIVATING, version_->status()); 565 EXPECT_EQ(ServiceWorkerVersion::ACTIVATING, version_->status());
566 } 566 }
567 567
568 TEST_F(ServiceWorkerVersionTest, RepeatedlyObserveStatusChanges) { 568 TEST_F(ServiceWorkerVersionTest, RepeatedlyObserveStatusChanges) {
569 EXPECT_EQ(ServiceWorkerVersion::NEW, version_->status()); 569 EXPECT_EQ(ServiceWorkerVersion::NEW, version_->status());
570 570
571 // Repeatedly observe status changes (the callback re-registers itself). 571 // Repeatedly observe status changes (the callback re-registers itself).
572 std::vector<ServiceWorkerVersion::Status> statuses; 572 std::vector<ServiceWorkerVersion::Status> statuses;
573 version_->RegisterStatusChangeCallback( 573 version_->RegisterStatusChangeCallback(base::Bind(
574 base::Bind(&ObserveStatusChanges, version_, &statuses)); 574 &ObserveStatusChanges, base::RetainedRef(version_), &statuses));
575 575
576 version_->SetStatus(ServiceWorkerVersion::INSTALLING); 576 version_->SetStatus(ServiceWorkerVersion::INSTALLING);
577 version_->SetStatus(ServiceWorkerVersion::INSTALLED); 577 version_->SetStatus(ServiceWorkerVersion::INSTALLED);
578 version_->SetStatus(ServiceWorkerVersion::ACTIVATING); 578 version_->SetStatus(ServiceWorkerVersion::ACTIVATING);
579 version_->SetStatus(ServiceWorkerVersion::ACTIVATED); 579 version_->SetStatus(ServiceWorkerVersion::ACTIVATED);
580 version_->SetStatus(ServiceWorkerVersion::REDUNDANT); 580 version_->SetStatus(ServiceWorkerVersion::REDUNDANT);
581 581
582 // Verify that we could successfully observe repeated status changes. 582 // Verify that we could successfully observe repeated status changes.
583 ASSERT_EQ(5U, statuses.size()); 583 ASSERT_EQ(5U, statuses.size());
584 ASSERT_EQ(ServiceWorkerVersion::INSTALLING, statuses[0]); 584 ASSERT_EQ(ServiceWorkerVersion::INSTALLING, statuses[0]);
(...skipping 906 matching lines...) Expand 10 before | Expand all | Expand 10 after
1491 helper_->SimulateSendSimpleEventResult( 1491 helper_->SimulateSendSimpleEventResult(
1492 version_->embedded_worker()->embedded_worker_id(), request_id, 1492 version_->embedded_worker()->embedded_worker_id(), request_id,
1493 blink::WebServiceWorkerEventResultRejected); 1493 blink::WebServiceWorkerEventResultRejected);
1494 runner->Run(); 1494 runner->Run();
1495 1495
1496 // Verify callback was called with correct status. 1496 // Verify callback was called with correct status.
1497 EXPECT_EQ(SERVICE_WORKER_ERROR_EVENT_WAITUNTIL_REJECTED, status); 1497 EXPECT_EQ(SERVICE_WORKER_ERROR_EVENT_WAITUNTIL_REJECTED, status);
1498 } 1498 }
1499 1499
1500 } // namespace content 1500 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/service_worker/service_worker_register_job.cc ('k') | content/browser/speech/speech_recognizer_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698