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.h" | 10 #include "base/message_loop.h" |
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
70 DeviceSettingsTestBase::SetUp(); | 70 DeviceSettingsTestBase::SetUp(); |
71 chrome::RegisterLocalState(local_state_.registry()); | 71 chrome::RegisterLocalState(local_state_.registry()); |
72 manager_.Init(); | 72 manager_.Init(); |
73 | 73 |
74 // DeviceOAuth2TokenService uses the system request context to fetch | 74 // DeviceOAuth2TokenService uses the system request context to fetch |
75 // OAuth tokens, then writes the token to local state, encrypting it | 75 // OAuth tokens, then writes the token to local state, encrypting it |
76 // first with methods in CryptohomeLibrary. | 76 // first with methods in CryptohomeLibrary. |
77 request_context_getter_ = new net::TestURLRequestContextGetter( | 77 request_context_getter_ = new net::TestURLRequestContextGetter( |
78 loop_.message_loop_proxy()); | 78 loop_.message_loop_proxy()); |
79 TestingBrowserProcess::GetGlobal()->SetSystemRequestContext( | 79 TestingBrowserProcess::GetGlobal()->SetSystemRequestContext( |
80 request_context_getter_); | 80 request_context_getter_.get()); |
81 TestingBrowserProcess::GetGlobal()->SetLocalState(&local_state_); | 81 TestingBrowserProcess::GetGlobal()->SetLocalState(&local_state_); |
82 chromeos::DeviceOAuth2TokenServiceFactory::Initialize(); | 82 chromeos::DeviceOAuth2TokenServiceFactory::Initialize(); |
83 chromeos::CryptohomeLibrary::SetForTest(cryptohome_library_.get()); | 83 chromeos::CryptohomeLibrary::SetForTest(cryptohome_library_.get()); |
84 url_fetcher_response_code_ = 200; | 84 url_fetcher_response_code_ = 200; |
85 url_fetcher_response_string_ = "{\"access_token\":\"accessToken4Test\"," | 85 url_fetcher_response_string_ = "{\"access_token\":\"accessToken4Test\"," |
86 "\"expires_in\":1234," | 86 "\"expires_in\":1234," |
87 "\"refresh_token\":\"refreshToken4Test\"}"; | 87 "\"refresh_token\":\"refreshToken4Test\"}"; |
88 } | 88 } |
89 | 89 |
90 virtual void TearDown() OVERRIDE { | 90 virtual void TearDown() OVERRIDE { |
(...skipping 384 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
475 TEST_F(DeviceCloudPolicyManagerChromeOSEnrollmentTest, LoadError) { | 475 TEST_F(DeviceCloudPolicyManagerChromeOSEnrollmentTest, LoadError) { |
476 loaded_blob_.clear(); | 476 loaded_blob_.clear(); |
477 RunTest(); | 477 RunTest(); |
478 ExpectFailedEnrollment(EnrollmentStatus::STATUS_STORE_ERROR); | 478 ExpectFailedEnrollment(EnrollmentStatus::STATUS_STORE_ERROR); |
479 EXPECT_EQ(CloudPolicyStore::STATUS_LOAD_ERROR, | 479 EXPECT_EQ(CloudPolicyStore::STATUS_LOAD_ERROR, |
480 status_.store_status()); | 480 status_.store_status()); |
481 } | 481 } |
482 | 482 |
483 } // namespace test | 483 } // namespace test |
484 } // namespace policy | 484 } // namespace policy |
OLD | NEW |