OLD | NEW |
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 "chrome/browser/chromeos/policy/device_cloud_policy_invalidator.h" | 5 #include "chrome/browser/chromeos/policy/device_cloud_policy_invalidator.h" |
6 | 6 |
7 #include <string> | 7 #include <string> |
8 | 8 |
9 #include "base/memory/ref_counted.h" | 9 #include "base/memory/ref_counted.h" |
10 #include "base/message_loop/message_loop_proxy.h" | 10 #include "base/message_loop/message_loop_proxy.h" |
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
93 CloudPolicyInvalidator* GetCloudPolicyInvalidator() const; | 93 CloudPolicyInvalidator* GetCloudPolicyInvalidator() const; |
94 | 94 |
95 void ConnectDeviceInvalidationService(); | 95 void ConnectDeviceInvalidationService(); |
96 | 96 |
97 protected: | 97 protected: |
98 DevicePolicyBuilder device_policy_; | 98 DevicePolicyBuilder device_policy_; |
99 | 99 |
100 private: | 100 private: |
101 content::TestBrowserThreadBundle thread_bundle_; | 101 content::TestBrowserThreadBundle thread_bundle_; |
102 scoped_refptr<net::URLRequestContextGetter> system_request_context_; | 102 scoped_refptr<net::URLRequestContextGetter> system_request_context_; |
| 103 TestingProfileManager profile_manager_; |
103 chromeos::FakeUserManager* fake_user_manager_; | 104 chromeos::FakeUserManager* fake_user_manager_; |
104 chromeos::ScopedUserManagerEnabler user_manager_enabler_; | 105 chromeos::ScopedUserManagerEnabler user_manager_enabler_; |
105 ScopedStubEnterpriseInstallAttributes install_attributes_; | 106 ScopedStubEnterpriseInstallAttributes install_attributes_; |
106 scoped_ptr<chromeos::ScopedTestDeviceSettingsService> | 107 scoped_ptr<chromeos::ScopedTestDeviceSettingsService> |
107 test_device_settings_service_; | 108 test_device_settings_service_; |
108 scoped_ptr<chromeos::ScopedTestCrosSettings> test_cros_settings_; | 109 scoped_ptr<chromeos::ScopedTestCrosSettings> test_cros_settings_; |
109 chromeos::DeviceSettingsTestHelper device_settings_test_helper_; | 110 chromeos::DeviceSettingsTestHelper device_settings_test_helper_; |
110 TestingProfileManager profile_manager_; | |
111 | 111 |
112 scoped_ptr<DeviceCloudPolicyInvalidator> invalidator_; | 112 scoped_ptr<DeviceCloudPolicyInvalidator> invalidator_; |
113 }; | 113 }; |
114 | 114 |
115 DeviceCloudPolicyInvalidatorTest::DeviceCloudPolicyInvalidatorTest() | 115 DeviceCloudPolicyInvalidatorTest::DeviceCloudPolicyInvalidatorTest() |
116 : thread_bundle_(content::TestBrowserThreadBundle::IO_MAINLOOP), | 116 : thread_bundle_(content::TestBrowserThreadBundle::IO_MAINLOOP), |
117 system_request_context_(new net::TestURLRequestContextGetter( | 117 system_request_context_(new net::TestURLRequestContextGetter( |
118 base::MessageLoopProxy::current())), | 118 base::MessageLoopProxy::current())), |
| 119 profile_manager_(TestingBrowserProcess::GetGlobal()), |
119 fake_user_manager_(new chromeos::FakeUserManager), | 120 fake_user_manager_(new chromeos::FakeUserManager), |
120 user_manager_enabler_(fake_user_manager_), | 121 user_manager_enabler_(fake_user_manager_), |
121 install_attributes_("example.com", | 122 install_attributes_("example.com", |
122 "user@example.com", | 123 "user@example.com", |
123 "device_id", | 124 "device_id", |
124 DEVICE_MODE_ENTERPRISE), | 125 DEVICE_MODE_ENTERPRISE) { |
125 profile_manager_(TestingBrowserProcess::GetGlobal()) { | |
126 } | 126 } |
127 | 127 |
128 DeviceCloudPolicyInvalidatorTest::~DeviceCloudPolicyInvalidatorTest() { | 128 DeviceCloudPolicyInvalidatorTest::~DeviceCloudPolicyInvalidatorTest() { |
129 } | 129 } |
130 | 130 |
131 void DeviceCloudPolicyInvalidatorTest::SetUp() { | 131 void DeviceCloudPolicyInvalidatorTest::SetUp() { |
132 chromeos::SystemSaltGetter::Initialize(); | 132 chromeos::SystemSaltGetter::Initialize(); |
133 chromeos::DBusThreadManager::Initialize(); | 133 chromeos::DBusThreadManager::Initialize(); |
134 chromeos::DeviceOAuth2TokenServiceFactory::Initialize(); | 134 chromeos::DeviceOAuth2TokenServiceFactory::Initialize(); |
135 TestingBrowserProcess::GetGlobal()->SetSystemRequestContext( | 135 TestingBrowserProcess::GetGlobal()->SetSystemRequestContext( |
(...skipping 601 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
737 invalidator = GetCloudPolicyInvalidator(); | 737 invalidator = GetCloudPolicyInvalidator(); |
738 ASSERT_TRUE(invalidator); | 738 ASSERT_TRUE(invalidator); |
739 EXPECT_EQ(profile_2_invalidation_service, GetInvalidationService()); | 739 EXPECT_EQ(profile_2_invalidation_service, GetInvalidationService()); |
740 | 740 |
741 // Verify that the invalidator's highest handled invalidation version starts | 741 // Verify that the invalidator's highest handled invalidation version starts |
742 // out as one. | 742 // out as one. |
743 EXPECT_EQ(1, invalidator->highest_handled_invalidation_version()); | 743 EXPECT_EQ(1, invalidator->highest_handled_invalidation_version()); |
744 } | 744 } |
745 | 745 |
746 } // namespace policy | 746 } // namespace policy |
OLD | NEW |