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.h" | 5 #include "chrome/browser/chromeos/policy/affiliated_invalidation_service_provide
r.h" |
6 | 6 |
7 #include <string> | 7 #include <string> |
8 | 8 |
9 #include "chrome/browser/chrome_notification_types.h" | 9 #include "chrome/browser/chrome_notification_types.h" |
10 #include "chrome/browser/chromeos/login/users/fake_user_manager.h" | 10 #include "chrome/browser/chromeos/login/users/fake_chrome_user_manager.h" |
11 #include "chrome/browser/chromeos/login/users/scoped_user_manager_enabler.h" | 11 #include "chrome/browser/chromeos/login/users/scoped_user_manager_enabler.h" |
12 #include "chrome/browser/chromeos/policy/stub_enterprise_install_attributes.h" | 12 #include "chrome/browser/chromeos/policy/stub_enterprise_install_attributes.h" |
13 #include "chrome/browser/chromeos/settings/cros_settings.h" | 13 #include "chrome/browser/chromeos/settings/cros_settings.h" |
14 #include "chrome/browser/chromeos/settings/device_oauth2_token_service_factory.h
" | 14 #include "chrome/browser/chromeos/settings/device_oauth2_token_service_factory.h
" |
15 #include "chrome/browser/chromeos/settings/device_settings_service.h" | 15 #include "chrome/browser/chromeos/settings/device_settings_service.h" |
16 #include "chrome/browser/invalidation/fake_invalidation_service.h" | 16 #include "chrome/browser/invalidation/fake_invalidation_service.h" |
17 #include "chrome/browser/invalidation/profile_invalidation_provider_factory.h" | 17 #include "chrome/browser/invalidation/profile_invalidation_provider_factory.h" |
18 #include "chrome/browser/profiles/profile.h" | 18 #include "chrome/browser/profiles/profile.h" |
19 #include "chrome/test/base/testing_browser_process.h" | 19 #include "chrome/test/base/testing_browser_process.h" |
20 #include "chrome/test/base/testing_profile_manager.h" | 20 #include "chrome/test/base/testing_profile_manager.h" |
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
105 bool create); | 105 bool create); |
106 | 106 |
107 protected: | 107 protected: |
108 scoped_ptr<AffiliatedInvalidationServiceProvider> provider_; | 108 scoped_ptr<AffiliatedInvalidationServiceProvider> provider_; |
109 StrictMock<MockConsumer> consumer_; | 109 StrictMock<MockConsumer> consumer_; |
110 invalidation::TiclInvalidationService* device_invalidation_service_; | 110 invalidation::TiclInvalidationService* device_invalidation_service_; |
111 invalidation::FakeInvalidationService* profile_invalidation_service_; | 111 invalidation::FakeInvalidationService* profile_invalidation_service_; |
112 | 112 |
113 private: | 113 private: |
114 content::TestBrowserThreadBundle thread_bundle_; | 114 content::TestBrowserThreadBundle thread_bundle_; |
115 chromeos::FakeUserManager* fake_user_manager_; | 115 chromeos::FakeChromeUserManager* fake_user_manager_; |
116 chromeos::ScopedUserManagerEnabler user_manager_enabler_; | 116 chromeos::ScopedUserManagerEnabler user_manager_enabler_; |
117 ScopedStubEnterpriseInstallAttributes install_attributes_; | 117 ScopedStubEnterpriseInstallAttributes install_attributes_; |
118 scoped_ptr<chromeos::ScopedTestDeviceSettingsService> | 118 scoped_ptr<chromeos::ScopedTestDeviceSettingsService> |
119 test_device_settings_service_; | 119 test_device_settings_service_; |
120 scoped_ptr<chromeos::ScopedTestCrosSettings> test_cros_settings_; | 120 scoped_ptr<chromeos::ScopedTestCrosSettings> test_cros_settings_; |
121 TestingProfileManager profile_manager_; | 121 TestingProfileManager profile_manager_; |
122 }; | 122 }; |
123 | 123 |
124 MockConsumer::MockConsumer() { | 124 MockConsumer::MockConsumer() { |
125 } | 125 } |
126 | 126 |
127 MockConsumer::~MockConsumer() { | 127 MockConsumer::~MockConsumer() { |
128 } | 128 } |
129 | 129 |
130 AffiliatedInvalidationServiceProviderTest:: | 130 AffiliatedInvalidationServiceProviderTest:: |
131 AffiliatedInvalidationServiceProviderTest() | 131 AffiliatedInvalidationServiceProviderTest() |
132 : device_invalidation_service_(nullptr), | 132 : device_invalidation_service_(nullptr), |
133 profile_invalidation_service_(nullptr), | 133 profile_invalidation_service_(nullptr), |
134 fake_user_manager_(new chromeos::FakeUserManager), | 134 fake_user_manager_(new chromeos::FakeChromeUserManager), |
135 user_manager_enabler_(fake_user_manager_), | 135 user_manager_enabler_(fake_user_manager_), |
136 install_attributes_("example.com", | 136 install_attributes_("example.com", |
137 "user@example.com", | 137 "user@example.com", |
138 "device_id", | 138 "device_id", |
139 DEVICE_MODE_ENTERPRISE), | 139 DEVICE_MODE_ENTERPRISE), |
140 profile_manager_(TestingBrowserProcess::GetGlobal()) { | 140 profile_manager_(TestingBrowserProcess::GetGlobal()) { |
141 } | 141 } |
142 | 142 |
143 void AffiliatedInvalidationServiceProviderTest::SetUp() { | 143 void AffiliatedInvalidationServiceProviderTest::SetUp() { |
144 chromeos::SystemSaltGetter::Initialize(); | 144 chromeos::SystemSaltGetter::Initialize(); |
(...skipping 473 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
618 | 618 |
619 // Verify that the device-global invalidation service still does not exist. | 619 // Verify that the device-global invalidation service still does not exist. |
620 EXPECT_FALSE(provider_->GetDeviceInvalidationServiceForTest()); | 620 EXPECT_FALSE(provider_->GetDeviceInvalidationServiceForTest()); |
621 | 621 |
622 // Unregister the consumer. | 622 // Unregister the consumer. |
623 provider_->UnregisterConsumer(&consumer_); | 623 provider_->UnregisterConsumer(&consumer_); |
624 Mock::VerifyAndClearExpectations(&consumer_); | 624 Mock::VerifyAndClearExpectations(&consumer_); |
625 } | 625 } |
626 | 626 |
627 } // namespace policy | 627 } // namespace policy |
OLD | NEW |