OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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/settings/device_oauth2_token_service.h" | 5 #include "chrome/browser/chromeos/settings/device_oauth2_token_service.h" |
6 | 6 |
7 #include "base/message_loop/message_loop.h" | 7 #include "base/message_loop/message_loop.h" |
8 #include "base/prefs/testing_pref_service.h" | 8 #include "base/prefs/testing_pref_service.h" |
9 #include "base/run_loop.h" | 9 #include "base/run_loop.h" |
10 #include "chrome/browser/chromeos/policy/device_policy_builder.h" | 10 #include "chrome/browser/chromeos/policy/device_policy_builder.h" |
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
91 owner_key_util_->SetPublicKeyFromPrivateKey( | 91 owner_key_util_->SetPublicKeyFromPrivateKey( |
92 *device_policy_.GetSigningKey()); | 92 *device_policy_.GetSigningKey()); |
93 DeviceSettingsService::Get()->SetSessionManager( | 93 DeviceSettingsService::Get()->SetSessionManager( |
94 &device_settings_test_helper_, owner_key_util_); | 94 &device_settings_test_helper_, owner_key_util_); |
95 | 95 |
96 CrosSettings::Initialize(); | 96 CrosSettings::Initialize(); |
97 } | 97 } |
98 | 98 |
99 virtual void TearDown() OVERRIDE { | 99 virtual void TearDown() OVERRIDE { |
100 CrosSettings::Shutdown(); | 100 CrosSettings::Shutdown(); |
| 101 TestingBrowserProcess::GetGlobal()->SetBrowserPolicyConnector(NULL); |
101 DeviceSettingsService::Get()->UnsetSessionManager(); | 102 DeviceSettingsService::Get()->UnsetSessionManager(); |
102 DeviceSettingsService::Shutdown(); | 103 DeviceSettingsService::Shutdown(); |
103 SystemSaltGetter::Shutdown(); | 104 SystemSaltGetter::Shutdown(); |
104 DBusThreadManager::Shutdown(); | 105 DBusThreadManager::Shutdown(); |
105 base::RunLoop().RunUntilIdle(); | 106 base::RunLoop().RunUntilIdle(); |
106 } | 107 } |
107 | 108 |
108 void CreateService() { | 109 void CreateService() { |
109 oauth2_service_.reset(new DeviceOAuth2TokenService( | 110 oauth2_service_.reset(new DeviceOAuth2TokenService( |
110 request_context_getter_.get(), scoped_testing_local_state_.Get())); | 111 request_context_getter_.get(), scoped_testing_local_state_.Get())); |
(...skipping 312 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
423 | 424 |
424 AssertConsumerTokensAndErrors(0, 1); | 425 AssertConsumerTokensAndErrors(0, 1); |
425 | 426 |
426 // Retry should succeed. | 427 // Retry should succeed. |
427 request = StartTokenRequest(); | 428 request = StartTokenRequest(); |
428 PerformURLFetches(); | 429 PerformURLFetches(); |
429 AssertConsumerTokensAndErrors(1, 1); | 430 AssertConsumerTokensAndErrors(1, 1); |
430 } | 431 } |
431 | 432 |
432 } // namespace chromeos | 433 } // namespace chromeos |
OLD | NEW |