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

Side by Side Diff: chrome/browser/chromeos/policy/affiliated_invalidation_service_provider_impl_unittest.cc

Issue 2257103002: Re-write many calls to WrapUnique() with MakeUnique() (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: 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 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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 "chrome/browser/chromeos/policy/affiliated_invalidation_service_provide r_impl.h" 5 #include "chrome/browser/chromeos/policy/affiliated_invalidation_service_provide r_impl.h"
6 6
7 #include <memory> 7 #include <memory>
8 #include <string> 8 #include <string>
9 #include <utility> 9 #include <utility>
10 10
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
44 const char kAffiliatedUserID1[] = "test_1@example.com"; 44 const char kAffiliatedUserID1[] = "test_1@example.com";
45 const char kAffiliatedUserID2[] = "test_2@example.com"; 45 const char kAffiliatedUserID2[] = "test_2@example.com";
46 const char kUnaffiliatedUserID[] = "test@other_domain.test"; 46 const char kUnaffiliatedUserID[] = "test@other_domain.test";
47 47
48 std::unique_ptr<KeyedService> BuildProfileInvalidationProvider( 48 std::unique_ptr<KeyedService> BuildProfileInvalidationProvider(
49 content::BrowserContext* context) { 49 content::BrowserContext* context) {
50 std::unique_ptr<invalidation::FakeInvalidationService> invalidation_service( 50 std::unique_ptr<invalidation::FakeInvalidationService> invalidation_service(
51 new invalidation::FakeInvalidationService); 51 new invalidation::FakeInvalidationService);
52 invalidation_service->SetInvalidatorState( 52 invalidation_service->SetInvalidatorState(
53 syncer::TRANSIENT_INVALIDATION_ERROR); 53 syncer::TRANSIENT_INVALIDATION_ERROR);
54 return base::WrapUnique(new invalidation::ProfileInvalidationProvider( 54 return base::MakeUnique<invalidation::ProfileInvalidationProvider>(
55 std::move(invalidation_service))); 55 std::move(invalidation_service));
56 } 56 }
57 57
58 } // namespace 58 } // namespace
59 59
60 // A simple AffiliatedInvalidationServiceProvider::Consumer that registers a 60 // A simple AffiliatedInvalidationServiceProvider::Consumer that registers a
61 // syncer::FakeInvalidationHandler with the invalidation::InvalidationService 61 // syncer::FakeInvalidationHandler with the invalidation::InvalidationService
62 // that is currently being made available. 62 // that is currently being made available.
63 class FakeConsumer : public AffiliatedInvalidationServiceProvider::Consumer { 63 class FakeConsumer : public AffiliatedInvalidationServiceProvider::Consumer {
64 public: 64 public:
65 explicit FakeConsumer(AffiliatedInvalidationServiceProviderImpl* provider); 65 explicit FakeConsumer(AffiliatedInvalidationServiceProviderImpl* provider);
(...skipping 608 matching lines...) Expand 10 before | Expand all | Expand 10 after
674 EXPECT_EQ(0, consumer_->GetAndClearInvalidationServiceSetCount()); 674 EXPECT_EQ(0, consumer_->GetAndClearInvalidationServiceSetCount());
675 provider_->Shutdown(); 675 provider_->Shutdown();
676 EXPECT_EQ(1, consumer_->GetAndClearInvalidationServiceSetCount()); 676 EXPECT_EQ(1, consumer_->GetAndClearInvalidationServiceSetCount());
677 EXPECT_EQ(nullptr, consumer_->GetInvalidationService()); 677 EXPECT_EQ(nullptr, consumer_->GetInvalidationService());
678 678
679 // Verify that the device-global invalidation service has been destroyed. 679 // Verify that the device-global invalidation service has been destroyed.
680 EXPECT_FALSE(provider_->GetDeviceInvalidationServiceForTest()); 680 EXPECT_FALSE(provider_->GetDeviceInvalidationServiceForTest());
681 } 681 }
682 682
683 } // namespace policy 683 } // namespace policy
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698