OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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_manager_chromeos.h" | 5 #include "chrome/browser/chromeos/policy/device_cloud_policy_manager_chromeos.h" |
6 | 6 |
7 #include "base/basictypes.h" | 7 #include "base/basictypes.h" |
8 #include "base/compiler_specific.h" | 8 #include "base/compiler_specific.h" |
9 #include "base/memory/scoped_ptr.h" | 9 #include "base/memory/scoped_ptr.h" |
10 #include "base/message_loop/message_loop.h" | 10 #include "base/message_loop/message_loop.h" |
(...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
101 manager_->Init(); | 101 manager_->Init(); |
102 | 102 |
103 // DeviceOAuth2TokenService uses the system request context to fetch | 103 // DeviceOAuth2TokenService uses the system request context to fetch |
104 // OAuth tokens, then writes the token to local state, encrypting it | 104 // OAuth tokens, then writes the token to local state, encrypting it |
105 // first with methods in CryptohomeTokenEncryptor. | 105 // first with methods in CryptohomeTokenEncryptor. |
106 request_context_getter_ = new net::TestURLRequestContextGetter( | 106 request_context_getter_ = new net::TestURLRequestContextGetter( |
107 loop_.message_loop_proxy()); | 107 loop_.message_loop_proxy()); |
108 TestingBrowserProcess::GetGlobal()->SetSystemRequestContext( | 108 TestingBrowserProcess::GetGlobal()->SetSystemRequestContext( |
109 request_context_getter_.get()); | 109 request_context_getter_.get()); |
110 TestingBrowserProcess::GetGlobal()->SetLocalState(&local_state_); | 110 TestingBrowserProcess::GetGlobal()->SetLocalState(&local_state_); |
| 111 // SystemSaltGetter is used in DeviceOAuth2TokenServiceFactory. |
| 112 chromeos::SystemSaltGetter::Initialize(); |
111 chromeos::DeviceOAuth2TokenServiceFactory::Initialize(); | 113 chromeos::DeviceOAuth2TokenServiceFactory::Initialize(); |
112 // This is needed as SystemSaltGetter is used for encrypting tokens in | |
113 // CryptohomeTokenEncryptor. | |
114 chromeos::SystemSaltGetter::Initialize(); | |
115 url_fetcher_response_code_ = 200; | 114 url_fetcher_response_code_ = 200; |
116 url_fetcher_response_string_ = "{\"access_token\":\"accessToken4Test\"," | 115 url_fetcher_response_string_ = "{\"access_token\":\"accessToken4Test\"," |
117 "\"expires_in\":1234," | 116 "\"expires_in\":1234," |
118 "\"refresh_token\":\"refreshToken4Test\"}"; | 117 "\"refresh_token\":\"refreshToken4Test\"}"; |
119 } | 118 } |
120 | 119 |
121 virtual void TearDown() OVERRIDE { | 120 virtual void TearDown() OVERRIDE { |
122 manager_->Shutdown(); | 121 manager_->Shutdown(); |
123 DeviceSettingsTestBase::TearDown(); | 122 DeviceSettingsTestBase::TearDown(); |
124 | 123 |
(...skipping 395 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
520 TEST_F(DeviceCloudPolicyManagerChromeOSEnrollmentTest, LoadError) { | 519 TEST_F(DeviceCloudPolicyManagerChromeOSEnrollmentTest, LoadError) { |
521 loaded_blob_.clear(); | 520 loaded_blob_.clear(); |
522 RunTest(); | 521 RunTest(); |
523 ExpectFailedEnrollment(EnrollmentStatus::STATUS_STORE_ERROR); | 522 ExpectFailedEnrollment(EnrollmentStatus::STATUS_STORE_ERROR); |
524 EXPECT_EQ(CloudPolicyStore::STATUS_LOAD_ERROR, | 523 EXPECT_EQ(CloudPolicyStore::STATUS_LOAD_ERROR, |
525 status_.store_status()); | 524 status_.store_status()); |
526 } | 525 } |
527 | 526 |
528 } // namespace | 527 } // namespace |
529 } // namespace policy | 528 } // namespace policy |
OLD | NEW |