| 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" |
| 11 #include "base/run_loop.h" | 11 #include "base/run_loop.h" |
| 12 #include "chrome/browser/browser_process_platform_part.h" | 12 #include "chrome/browser/browser_process_platform_part.h" |
| 13 #include "chrome/browser/chrome_notification_types.h" | 13 #include "chrome/browser/chrome_notification_types.h" |
| 14 #include "chrome/browser/chromeos/login/users/fake_user_manager.h" | 14 #include "chrome/browser/chromeos/login/users/fake_chrome_user_manager.h" |
| 15 #include "chrome/browser/chromeos/login/users/scoped_user_manager_enabler.h" | 15 #include "chrome/browser/chromeos/login/users/scoped_user_manager_enabler.h" |
| 16 #include "chrome/browser/chromeos/policy/browser_policy_connector_chromeos.h" | 16 #include "chrome/browser/chromeos/policy/browser_policy_connector_chromeos.h" |
| 17 #include "chrome/browser/chromeos/policy/device_cloud_policy_manager_chromeos.h" | 17 #include "chrome/browser/chromeos/policy/device_cloud_policy_manager_chromeos.h" |
| 18 #include "chrome/browser/chromeos/policy/device_cloud_policy_store_chromeos.h" | 18 #include "chrome/browser/chromeos/policy/device_cloud_policy_store_chromeos.h" |
| 19 #include "chrome/browser/chromeos/policy/device_policy_builder.h" | 19 #include "chrome/browser/chromeos/policy/device_policy_builder.h" |
| 20 #include "chrome/browser/chromeos/policy/stub_enterprise_install_attributes.h" | 20 #include "chrome/browser/chromeos/policy/stub_enterprise_install_attributes.h" |
| 21 #include "chrome/browser/chromeos/settings/cros_settings.h" | 21 #include "chrome/browser/chromeos/settings/cros_settings.h" |
| 22 #include "chrome/browser/chromeos/settings/device_oauth2_token_service_factory.h
" | 22 #include "chrome/browser/chromeos/settings/device_oauth2_token_service_factory.h
" |
| 23 #include "chrome/browser/chromeos/settings/device_settings_service.h" | 23 #include "chrome/browser/chromeos/settings/device_settings_service.h" |
| 24 #include "chrome/browser/chromeos/settings/device_settings_test_helper.h" | 24 #include "chrome/browser/chromeos/settings/device_settings_test_helper.h" |
| (...skipping 68 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 chromeos::FakeUserManager* fake_user_manager_; | 103 chromeos::FakeChromeUserManager* fake_user_manager_; |
| 104 chromeos::ScopedUserManagerEnabler user_manager_enabler_; | 104 chromeos::ScopedUserManagerEnabler user_manager_enabler_; |
| 105 ScopedStubEnterpriseInstallAttributes install_attributes_; | 105 ScopedStubEnterpriseInstallAttributes install_attributes_; |
| 106 scoped_ptr<chromeos::ScopedTestDeviceSettingsService> | 106 scoped_ptr<chromeos::ScopedTestDeviceSettingsService> |
| 107 test_device_settings_service_; | 107 test_device_settings_service_; |
| 108 scoped_ptr<chromeos::ScopedTestCrosSettings> test_cros_settings_; | 108 scoped_ptr<chromeos::ScopedTestCrosSettings> test_cros_settings_; |
| 109 chromeos::DeviceSettingsTestHelper device_settings_test_helper_; | 109 chromeos::DeviceSettingsTestHelper device_settings_test_helper_; |
| 110 TestingProfileManager profile_manager_; | 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 fake_user_manager_(new chromeos::FakeUserManager), | 119 fake_user_manager_(new chromeos::FakeChromeUserManager), |
| 120 user_manager_enabler_(fake_user_manager_), | 120 user_manager_enabler_(fake_user_manager_), |
| 121 install_attributes_("example.com", | 121 install_attributes_("example.com", |
| 122 "user@example.com", | 122 "user@example.com", |
| 123 "device_id", | 123 "device_id", |
| 124 DEVICE_MODE_ENTERPRISE), | 124 DEVICE_MODE_ENTERPRISE), |
| 125 profile_manager_(TestingBrowserProcess::GetGlobal()) { | 125 profile_manager_(TestingBrowserProcess::GetGlobal()) { |
| 126 } | 126 } |
| 127 | 127 |
| 128 DeviceCloudPolicyInvalidatorTest::~DeviceCloudPolicyInvalidatorTest() { | 128 DeviceCloudPolicyInvalidatorTest::~DeviceCloudPolicyInvalidatorTest() { |
| 129 } | 129 } |
| (...skipping 607 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 |