OLD | NEW |
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 <string> | 7 #include <string> |
| 8 #include <utility> |
8 | 9 |
9 #include "base/macros.h" | 10 #include "base/macros.h" |
10 #include "base/memory/scoped_ptr.h" | 11 #include "base/memory/scoped_ptr.h" |
11 #include "chrome/browser/chrome_notification_types.h" | 12 #include "chrome/browser/chrome_notification_types.h" |
12 #include "chrome/browser/chromeos/login/users/fake_chrome_user_manager.h" | 13 #include "chrome/browser/chromeos/login/users/fake_chrome_user_manager.h" |
13 #include "chrome/browser/chromeos/login/users/scoped_user_manager_enabler.h" | 14 #include "chrome/browser/chromeos/login/users/scoped_user_manager_enabler.h" |
14 #include "chrome/browser/chromeos/policy/stub_enterprise_install_attributes.h" | 15 #include "chrome/browser/chromeos/policy/stub_enterprise_install_attributes.h" |
15 #include "chrome/browser/chromeos/settings/cros_settings.h" | 16 #include "chrome/browser/chromeos/settings/cros_settings.h" |
16 #include "chrome/browser/chromeos/settings/device_oauth2_token_service_factory.h
" | 17 #include "chrome/browser/chromeos/settings/device_oauth2_token_service_factory.h
" |
17 #include "chrome/browser/chromeos/settings/device_settings_service.h" | 18 #include "chrome/browser/chromeos/settings/device_settings_service.h" |
(...skipping 25 matching lines...) Expand all Loading... |
43 const char kAffiliatedUserID2[] = "test_2@example.com"; | 44 const char kAffiliatedUserID2[] = "test_2@example.com"; |
44 const char kUnaffiliatedUserID[] = "test@other_domain.test"; | 45 const char kUnaffiliatedUserID[] = "test@other_domain.test"; |
45 | 46 |
46 scoped_ptr<KeyedService> BuildProfileInvalidationProvider( | 47 scoped_ptr<KeyedService> BuildProfileInvalidationProvider( |
47 content::BrowserContext* context) { | 48 content::BrowserContext* context) { |
48 scoped_ptr<invalidation::FakeInvalidationService> invalidation_service( | 49 scoped_ptr<invalidation::FakeInvalidationService> invalidation_service( |
49 new invalidation::FakeInvalidationService); | 50 new invalidation::FakeInvalidationService); |
50 invalidation_service->SetInvalidatorState( | 51 invalidation_service->SetInvalidatorState( |
51 syncer::TRANSIENT_INVALIDATION_ERROR); | 52 syncer::TRANSIENT_INVALIDATION_ERROR); |
52 return make_scoped_ptr(new invalidation::ProfileInvalidationProvider( | 53 return make_scoped_ptr(new invalidation::ProfileInvalidationProvider( |
53 invalidation_service.Pass())); | 54 std::move(invalidation_service))); |
54 } | 55 } |
55 | 56 |
56 } // namespace | 57 } // namespace |
57 | 58 |
58 // A simple AffiliatedInvalidationServiceProvider::Consumer that registers a | 59 // A simple AffiliatedInvalidationServiceProvider::Consumer that registers a |
59 // syncer::FakeInvalidationHandler with the invalidation::InvalidationService | 60 // syncer::FakeInvalidationHandler with the invalidation::InvalidationService |
60 // that is currently being made available. | 61 // that is currently being made available. |
61 class FakeConsumer : public AffiliatedInvalidationServiceProvider::Consumer { | 62 class FakeConsumer : public AffiliatedInvalidationServiceProvider::Consumer { |
62 public: | 63 public: |
63 explicit FakeConsumer(AffiliatedInvalidationServiceProviderImpl* provider); | 64 explicit FakeConsumer(AffiliatedInvalidationServiceProviderImpl* provider); |
(...skipping 607 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
671 EXPECT_EQ(0, consumer_->GetAndClearInvalidationServiceSetCount()); | 672 EXPECT_EQ(0, consumer_->GetAndClearInvalidationServiceSetCount()); |
672 provider_->Shutdown(); | 673 provider_->Shutdown(); |
673 EXPECT_EQ(1, consumer_->GetAndClearInvalidationServiceSetCount()); | 674 EXPECT_EQ(1, consumer_->GetAndClearInvalidationServiceSetCount()); |
674 EXPECT_EQ(nullptr, consumer_->GetInvalidationService()); | 675 EXPECT_EQ(nullptr, consumer_->GetInvalidationService()); |
675 | 676 |
676 // Verify that the device-global invalidation service has been destroyed. | 677 // Verify that the device-global invalidation service has been destroyed. |
677 EXPECT_FALSE(provider_->GetDeviceInvalidationServiceForTest()); | 678 EXPECT_FALSE(provider_->GetDeviceInvalidationServiceForTest()); |
678 } | 679 } |
679 | 680 |
680 } // namespace policy | 681 } // namespace policy |
OLD | NEW |