| 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 "base/memory/ref_counted.h" | 7 #include "base/memory/ref_counted.h" |
| 8 #include "base/message_loop/message_loop_proxy.h" | 8 #include "base/message_loop/message_loop_proxy.h" |
| 9 #include "chrome/browser/browser_process_platform_part.h" | 9 #include "chrome/browser/browser_process_platform_part.h" |
| 10 #include "chrome/browser/chromeos/policy/browser_policy_connector_chromeos.h" | 10 #include "chrome/browser/chromeos/policy/browser_policy_connector_chromeos.h" |
| (...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 69 DEVICE_MODE_ENTERPRISE), | 69 DEVICE_MODE_ENTERPRISE), |
| 70 profile_manager_(TestingBrowserProcess::GetGlobal()) { | 70 profile_manager_(TestingBrowserProcess::GetGlobal()) { |
| 71 } | 71 } |
| 72 | 72 |
| 73 DeviceCloudPolicyInvalidatorTest::~DeviceCloudPolicyInvalidatorTest() { | 73 DeviceCloudPolicyInvalidatorTest::~DeviceCloudPolicyInvalidatorTest() { |
| 74 } | 74 } |
| 75 | 75 |
| 76 void DeviceCloudPolicyInvalidatorTest::SetUp() { | 76 void DeviceCloudPolicyInvalidatorTest::SetUp() { |
| 77 chromeos::SystemSaltGetter::Initialize(); | 77 chromeos::SystemSaltGetter::Initialize(); |
| 78 chromeos::DBusThreadManager::Initialize(); | 78 chromeos::DBusThreadManager::Initialize(); |
| 79 chromeos::DeviceOAuth2TokenServiceFactory::Initialize(); | |
| 80 TestingBrowserProcess::GetGlobal()->SetSystemRequestContext( | 79 TestingBrowserProcess::GetGlobal()->SetSystemRequestContext( |
| 81 system_request_context_.get()); | 80 system_request_context_.get()); |
| 82 ASSERT_TRUE(profile_manager_.SetUp()); | 81 ASSERT_TRUE(profile_manager_.SetUp()); |
| 83 | 82 |
| 84 test_device_settings_service_.reset(new | 83 test_device_settings_service_.reset(new |
| 85 chromeos::ScopedTestDeviceSettingsService); | 84 chromeos::ScopedTestDeviceSettingsService); |
| 86 test_cros_settings_.reset(new chromeos::ScopedTestCrosSettings); | 85 test_cros_settings_.reset(new chromeos::ScopedTestCrosSettings); |
| 86 chromeos::DeviceOAuth2TokenServiceFactory::Initialize(); |
| 87 |
| 87 scoped_refptr<ownership::MockOwnerKeyUtil> owner_key_util( | 88 scoped_refptr<ownership::MockOwnerKeyUtil> owner_key_util( |
| 88 new ownership::MockOwnerKeyUtil); | 89 new ownership::MockOwnerKeyUtil); |
| 89 owner_key_util->SetPublicKeyFromPrivateKey( | 90 owner_key_util->SetPublicKeyFromPrivateKey( |
| 90 *device_policy_.GetSigningKey()); | 91 *device_policy_.GetSigningKey()); |
| 91 chromeos::DeviceSettingsService::Get()->SetSessionManager( | 92 chromeos::DeviceSettingsService::Get()->SetSessionManager( |
| 92 &device_settings_test_helper_, | 93 &device_settings_test_helper_, |
| 93 owner_key_util); | 94 owner_key_util); |
| 94 | 95 |
| 95 device_policy_.policy_data().set_invalidation_source(123); | 96 device_policy_.policy_data().set_invalidation_source(123); |
| 96 device_policy_.policy_data().set_invalidation_name("invalidation"); | 97 device_policy_.policy_data().set_invalidation_name("invalidation"); |
| (...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 179 ASSERT_TRUE(invalidator); | 180 ASSERT_TRUE(invalidator); |
| 180 EXPECT_EQ(1, invalidator->highest_handled_invalidation_version()); | 181 EXPECT_EQ(1, invalidator->highest_handled_invalidation_version()); |
| 181 EXPECT_EQ(&invalidation_service_1, | 182 EXPECT_EQ(&invalidation_service_1, |
| 182 invalidator->invalidation_service_for_test()); | 183 invalidator->invalidation_service_for_test()); |
| 183 | 184 |
| 184 provider.Shutdown(); | 185 provider.Shutdown(); |
| 185 device_policy_invalidator.OnInvalidationServiceSet(nullptr); | 186 device_policy_invalidator.OnInvalidationServiceSet(nullptr); |
| 186 } | 187 } |
| 187 | 188 |
| 188 } // namespace policy | 189 } // namespace policy |
| OLD | NEW |