Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(155)

Side by Side Diff: chrome/browser/chromeos/policy/device_cloud_policy_manager_chromeos_unittest.cc

Issue 12538009: Public Sessions: fetch device robot api token during enterprise enrollment. (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: rebase Created 7 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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/prefs/pref_registry_simple.h" 11 #include "base/prefs/pref_registry_simple.h"
11 #include "base/prefs/testing_pref_service.h" 12 #include "base/prefs/testing_pref_service.h"
12 #include "base/run_loop.h" 13 #include "base/run_loop.h"
13 #include "chrome/browser/chromeos/policy/device_cloud_policy_store_chromeos.h" 14 #include "chrome/browser/chromeos/policy/device_cloud_policy_store_chromeos.h"
14 #include "chrome/browser/chromeos/policy/enterprise_install_attributes.h" 15 #include "chrome/browser/chromeos/policy/enterprise_install_attributes.h"
15 #include "chrome/browser/chromeos/settings/cros_settings.h" 16 #include "chrome/browser/chromeos/settings/cros_settings.h"
17 #include "chrome/browser/chromeos/settings/device_oauth2_token_service.h"
18 #include "chrome/browser/chromeos/settings/device_oauth2_token_service_factory.h "
16 #include "chrome/browser/chromeos/settings/device_settings_service.h" 19 #include "chrome/browser/chromeos/settings/device_settings_service.h"
17 #include "chrome/browser/chromeos/settings/device_settings_test_helper.h" 20 #include "chrome/browser/chromeos/settings/device_settings_test_helper.h"
18 #include "chrome/browser/policy/cloud/cloud_policy_client.h" 21 #include "chrome/browser/policy/cloud/cloud_policy_client.h"
19 #include "chrome/browser/policy/cloud/mock_device_management_service.h" 22 #include "chrome/browser/policy/cloud/mock_device_management_service.h"
20 #include "chrome/browser/policy/proto/chromeos/chrome_device_policy.pb.h" 23 #include "chrome/browser/policy/proto/chromeos/chrome_device_policy.pb.h"
21 #include "chrome/browser/policy/proto/cloud/device_management_backend.pb.h" 24 #include "chrome/browser/policy/proto/cloud/device_management_backend.pb.h"
22 #include "chrome/browser/prefs/browser_prefs.h" 25 #include "chrome/browser/prefs/browser_prefs.h"
26 #include "chrome/test/base/testing_browser_process.h"
23 #include "chromeos/cryptohome/cryptohome_library.h" 27 #include "chromeos/cryptohome/cryptohome_library.h"
28 #include "chromeos/cryptohome/mock_cryptohome_library.h"
24 #include "chromeos/dbus/cryptohome_client.h" 29 #include "chromeos/dbus/cryptohome_client.h"
25 #include "chromeos/dbus/dbus_client_implementation_type.h" 30 #include "chromeos/dbus/dbus_client_implementation_type.h"
31 #include "net/url_request/test_url_fetcher_factory.h"
32 #include "net/url_request/url_request_test_util.h"
26 #include "policy/policy_constants.h" 33 #include "policy/policy_constants.h"
27 #include "testing/gmock/include/gmock/gmock.h" 34 #include "testing/gmock/include/gmock/gmock.h"
28 #include "testing/gtest/include/gtest/gtest.h" 35 #include "testing/gtest/include/gtest/gtest.h"
29 36
30 using testing::AnyNumber; 37 using testing::AnyNumber;
31 using testing::AtMost; 38 using testing::AtMost;
32 using testing::DoAll; 39 using testing::DoAll;
33 using testing::Mock; 40 using testing::Mock;
34 using testing::SaveArg; 41 using testing::SaveArg;
35 using testing::_; 42 using testing::_;
(...skipping 20 matching lines...) Expand all
56 install_attributes_(cryptohome_library_.get(), 63 install_attributes_(cryptohome_library_.get(),
57 stub_cryptohome_client_.get()), 64 stub_cryptohome_client_.get()),
58 store_(new DeviceCloudPolicyStoreChromeOS(&device_settings_service_, 65 store_(new DeviceCloudPolicyStoreChromeOS(&device_settings_service_,
59 &install_attributes_)), 66 &install_attributes_)),
60 manager_(make_scoped_ptr(store_), &install_attributes_) {} 67 manager_(make_scoped_ptr(store_), &install_attributes_) {}
61 68
62 virtual void SetUp() OVERRIDE { 69 virtual void SetUp() OVERRIDE {
63 DeviceSettingsTestBase::SetUp(); 70 DeviceSettingsTestBase::SetUp();
64 chrome::RegisterLocalState(local_state_.registry()); 71 chrome::RegisterLocalState(local_state_.registry());
65 manager_.Init(); 72 manager_.Init();
73
74 // DeviceOAuth2TokenService uses the system request context to fetch
75 // OAuth tokens, then writes the token to local state, encrypting it
76 // first with methods in CryptohomeLibrary.
77 request_context_getter_ = new net::TestURLRequestContextGetter(
78 loop_.message_loop_proxy());
79 TestingBrowserProcess::GetGlobal()->SetSystemRequestContext(
80 request_context_getter_);
81 TestingBrowserProcess::GetGlobal()->SetLocalState(&local_state_);
82 chromeos::DeviceOAuth2TokenServiceFactory::Initialize();
83 chromeos::CryptohomeLibrary::SetForTest(cryptohome_library_.get());
84 url_fetcher_response_code_ = 200;
85 url_fetcher_response_string_ = "{\"access_token\":\"accessToken4Test\","
86 "\"expires_in\":1234,"
87 "\"refresh_token\":\"refreshToken4Test\"}";
66 } 88 }
67 89
68 virtual void TearDown() OVERRIDE { 90 virtual void TearDown() OVERRIDE {
69 manager_.Shutdown(); 91 manager_.Shutdown();
70 DeviceSettingsTestBase::TearDown(); 92 DeviceSettingsTestBase::TearDown();
93
94 chromeos::DeviceOAuth2TokenServiceFactory::Shutdown();
95 chromeos::CryptohomeLibrary::SetForTest(NULL);
96 TestingBrowserProcess::GetGlobal()->SetLocalState(NULL);
71 } 97 }
72 98
73 scoped_ptr<chromeos::CryptohomeLibrary> cryptohome_library_; 99 scoped_ptr<chromeos::CryptohomeLibrary> cryptohome_library_;
74 scoped_ptr<chromeos::CryptohomeClient> stub_cryptohome_client_; 100 scoped_ptr<chromeos::CryptohomeClient> stub_cryptohome_client_;
75 EnterpriseInstallAttributes install_attributes_; 101 EnterpriseInstallAttributes install_attributes_;
76 102
103 scoped_refptr<net::URLRequestContextGetter> request_context_getter_;
104 net::TestURLFetcherFactory url_fetcher_factory_;
105 int url_fetcher_response_code_;
106 string url_fetcher_response_string_;
77 TestingPrefServiceSimple local_state_; 107 TestingPrefServiceSimple local_state_;
78 MockDeviceManagementService device_management_service_; 108 MockDeviceManagementService device_management_service_;
79 chromeos::ScopedTestDeviceSettingsService test_device_settings_service_; 109 chromeos::ScopedTestDeviceSettingsService test_device_settings_service_;
80 chromeos::ScopedTestCrosSettings test_cros_settings_; 110 chromeos::ScopedTestCrosSettings test_cros_settings_;
81 111
82 DeviceCloudPolicyStoreChromeOS* store_; 112 DeviceCloudPolicyStoreChromeOS* store_;
83 DeviceCloudPolicyManagerChromeOS manager_; 113 DeviceCloudPolicyManagerChromeOS manager_;
84 114
85 private: 115 private:
86 DISALLOW_COPY_AND_ASSIGN(DeviceCloudPolicyManagerChromeOSTest); 116 DISALLOW_COPY_AND_ASSIGN(DeviceCloudPolicyManagerChromeOSTest);
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after
149 public: 179 public:
150 void Done(EnrollmentStatus status) { 180 void Done(EnrollmentStatus status) {
151 status_ = status; 181 status_ = status;
152 done_ = true; 182 done_ = true;
153 } 183 }
154 184
155 protected: 185 protected:
156 DeviceCloudPolicyManagerChromeOSEnrollmentTest() 186 DeviceCloudPolicyManagerChromeOSEnrollmentTest()
157 : is_auto_enrollment_(false), 187 : is_auto_enrollment_(false),
158 register_status_(DM_STATUS_SUCCESS), 188 register_status_(DM_STATUS_SUCCESS),
159 fetch_status_(DM_STATUS_SUCCESS), 189 policy_fetch_status_(DM_STATUS_SUCCESS),
190 robot_auth_fetch_status_(DM_STATUS_SUCCESS),
160 store_result_(true), 191 store_result_(true),
161 status_(EnrollmentStatus::ForStatus(EnrollmentStatus::STATUS_SUCCESS)), 192 status_(EnrollmentStatus::ForStatus(EnrollmentStatus::STATUS_SUCCESS)),
162 done_(false) {} 193 done_(false) {}
163 194
164 virtual void SetUp() OVERRIDE { 195 virtual void SetUp() OVERRIDE {
165 DeviceCloudPolicyManagerChromeOSTest::SetUp(); 196 DeviceCloudPolicyManagerChromeOSTest::SetUp();
166 197
167 // Set up test data. 198 // Set up test data.
168 device_policy_.set_new_signing_key( 199 device_policy_.set_new_signing_key(
169 PolicyBuilder::CreateTestNewSigningKey()); 200 PolicyBuilder::CreateTestNewSigningKey());
170 device_policy_.policy_data().set_timestamp( 201 device_policy_.policy_data().set_timestamp(
171 (base::Time::NowFromSystemTime() - 202 (base::Time::NowFromSystemTime() -
172 base::Time::UnixEpoch()).InMilliseconds()); 203 base::Time::UnixEpoch()).InMilliseconds());
173 device_policy_.Build(); 204 device_policy_.Build();
174 205
175 register_response_.mutable_register_response()->set_device_management_token( 206 register_response_.mutable_register_response()->set_device_management_token(
176 PolicyBuilder::kFakeToken); 207 PolicyBuilder::kFakeToken);
177 fetch_response_.mutable_policy_response()->add_response()->CopyFrom( 208 policy_fetch_response_.mutable_policy_response()->add_response()->CopyFrom(
178 device_policy_.policy()); 209 device_policy_.policy());
210 robot_auth_fetch_response_.mutable_service_api_access_response()
211 ->set_auth_code("auth_code_for_test");
179 loaded_blob_ = device_policy_.GetBlob(); 212 loaded_blob_ = device_policy_.GetBlob();
180 213
181 // Initialize the manager. 214 // Initialize the manager.
182 FlushDeviceSettings(); 215 FlushDeviceSettings();
183 EXPECT_EQ(CloudPolicyStore::STATUS_BAD_STATE, store_->status()); 216 EXPECT_EQ(CloudPolicyStore::STATUS_BAD_STATE, store_->status());
184 EXPECT_TRUE(manager_.IsInitializationComplete(POLICY_DOMAIN_CHROME)); 217 EXPECT_TRUE(manager_.IsInitializationComplete(POLICY_DOMAIN_CHROME));
185 218
186 PolicyBundle bundle; 219 PolicyBundle bundle;
187 EXPECT_TRUE(manager_.policies().Equals(bundle)); 220 EXPECT_TRUE(manager_.policies().Equals(bundle));
188 221
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
231 "auth token", is_auto_enrollment_, modes, 264 "auth token", is_auto_enrollment_, modes,
232 base::Bind(&DeviceCloudPolicyManagerChromeOSEnrollmentTest::Done, 265 base::Bind(&DeviceCloudPolicyManagerChromeOSEnrollmentTest::Done,
233 base::Unretained(this))); 266 base::Unretained(this)));
234 Mock::VerifyAndClearExpectations(&device_management_service_); 267 Mock::VerifyAndClearExpectations(&device_management_service_);
235 268
236 if (done_) 269 if (done_)
237 return; 270 return;
238 271
239 // Process registration. 272 // Process registration.
240 ASSERT_TRUE(register_job); 273 ASSERT_TRUE(register_job);
241 MockDeviceManagementJob* fetch_job = NULL; 274 MockDeviceManagementJob* policy_fetch_job = NULL;
242 EXPECT_CALL(device_management_service_, 275 EXPECT_CALL(device_management_service_,
243 CreateJob(DeviceManagementRequestJob::TYPE_POLICY_FETCH)) 276 CreateJob(DeviceManagementRequestJob::TYPE_POLICY_FETCH))
244 .Times(AtMost(1)) 277 .Times(AtMost(1))
245 .WillOnce(device_management_service_.CreateAsyncJob(&fetch_job)); 278 .WillOnce(device_management_service_.CreateAsyncJob(&policy_fetch_job));
246 EXPECT_CALL(device_management_service_, StartJob(_, _, _, _, _, _, _)) 279 EXPECT_CALL(device_management_service_, StartJob(_, _, _, _, _, _, _))
247 .Times(AtMost(1)); 280 .Times(AtMost(1));
248 register_job->SendResponse(register_status_, register_response_); 281 register_job->SendResponse(register_status_, register_response_);
249 Mock::VerifyAndClearExpectations(&device_management_service_); 282 Mock::VerifyAndClearExpectations(&device_management_service_);
250 283
251 if (done_) 284 if (done_)
252 return; 285 return;
253 286
254 // Process policy fetch. 287 // Process policy fetch.
255 ASSERT_TRUE(fetch_job); 288 ASSERT_TRUE(policy_fetch_job);
256 fetch_job->SendResponse(fetch_status_, fetch_response_); 289 policy_fetch_job->SendResponse(policy_fetch_status_,
290 policy_fetch_response_);
257 291
258 if (done_) 292 if (done_)
259 return; 293 return;
260 294
261 // Process verification. 295 // Process verification.
296 MockDeviceManagementJob* robot_auth_fetch_job = NULL;
297 EXPECT_CALL(device_management_service_,
298 CreateJob(DeviceManagementRequestJob::TYPE_API_AUTH_CODE_FETCH))
299 .Times(AtMost(1))
300 .WillOnce(device_management_service_.CreateAsyncJob(
301 &robot_auth_fetch_job));
302 EXPECT_CALL(device_management_service_, StartJob(_, _, _, _, _, _, _))
303 .Times(AtMost(1));
262 base::RunLoop().RunUntilIdle(); 304 base::RunLoop().RunUntilIdle();
305 Mock::VerifyAndClearExpectations(&device_management_service_);
263 306
264 if (done_) 307 if (done_)
265 return; 308 return;
266 309
310 // Process robot auth token fetch.
311 ASSERT_TRUE(robot_auth_fetch_job);
312 robot_auth_fetch_job->SendResponse(robot_auth_fetch_status_,
313 robot_auth_fetch_response_);
314 Mock::VerifyAndClearExpectations(&device_management_service_);
315
316 if (done_)
317 return;
318
319 // Process robot refresh token fetch if the auth code fetch succeeded.
320 // DeviceCloudPolicyManagerChromeOS holds an EnrollmentHandlerChromeOS which
321 // holds a GaiaOAuthClient that fetches the refresh token during enrollment.
322 // We return a successful OAuth response via a TestURLFetcher to trigger the
323 // happy path for these classes so that enrollment can continue.
324 if (robot_auth_fetch_status_ == DM_STATUS_SUCCESS) {
325 net::TestURLFetcher* url_fetcher = url_fetcher_factory_.GetFetcherByID(0);
326 ASSERT_TRUE(url_fetcher);
327 // The logic in GaiaOAuthClient seems broken, it always retries 1x on
328 // non-200 response codes, even if the retries are set to 0. Seems like
329 // its num_retries_ > source->GetMaxRetriesOn5xx() should have a >=?
330 url_fetcher->SetMaxRetriesOn5xx(-2);
331 url_fetcher->set_status(net::URLRequestStatus());
332 url_fetcher->set_response_code(url_fetcher_response_code_);
333 url_fetcher->SetResponseString(url_fetcher_response_string_);
334 url_fetcher->delegate()->OnURLFetchComplete(url_fetcher);
335 }
336 base::RunLoop().RunUntilIdle();
337
267 // Process policy store. 338 // Process policy store.
268 device_settings_test_helper_.set_store_result(store_result_); 339 device_settings_test_helper_.set_store_result(store_result_);
269 device_settings_test_helper_.FlushStore(); 340 device_settings_test_helper_.FlushStore();
270 EXPECT_EQ(device_policy_.GetBlob(), 341 EXPECT_EQ(device_policy_.GetBlob(),
271 device_settings_test_helper_.policy_blob()); 342 device_settings_test_helper_.policy_blob());
272 343
273 if (done_) 344 if (done_)
274 return; 345 return;
275 346
276 // Key installation and policy load. 347 // Key installation, policy load and refresh token save.
277 device_settings_test_helper_.set_policy_blob(loaded_blob_); 348 device_settings_test_helper_.set_policy_blob(loaded_blob_);
278 owner_key_util_->SetPublicKeyFromPrivateKey( 349 owner_key_util_->SetPublicKeyFromPrivateKey(
279 device_policy_.new_signing_key()); 350 device_policy_.new_signing_key());
280 ReloadDeviceSettings(); 351 ReloadDeviceSettings();
352
353 if (done_)
354 return;
355
356 // Process robot refresh token store.
357 EXPECT_EQ(
358 "refreshToken4Test",
359 chromeos::DeviceOAuth2TokenServiceFactory::Get()->GetRefreshToken());
281 } 360 }
282 361
283 bool is_auto_enrollment_; 362 bool is_auto_enrollment_;
284 363
285 DeviceManagementStatus register_status_; 364 DeviceManagementStatus register_status_;
286 em::DeviceManagementResponse register_response_; 365 em::DeviceManagementResponse register_response_;
287 366
288 DeviceManagementStatus fetch_status_; 367 DeviceManagementStatus policy_fetch_status_;
289 em::DeviceManagementResponse fetch_response_; 368 em::DeviceManagementResponse policy_fetch_response_;
369
370 DeviceManagementStatus robot_auth_fetch_status_;
371 em::DeviceManagementResponse robot_auth_fetch_response_;
290 372
291 bool store_result_; 373 bool store_result_;
292 std::string loaded_blob_; 374 std::string loaded_blob_;
293 375
294 em::DeviceManagementRequest register_request_; 376 em::DeviceManagementRequest register_request_;
295 std::string client_id_; 377 std::string client_id_;
296 EnrollmentStatus status_; 378 EnrollmentStatus status_;
297 379
298 bool done_; 380 bool done_;
299 381
(...skipping 29 matching lines...) Expand all
329 EXPECT_EQ(PolicyBuilder::kFakeDeviceId, client_id_); 411 EXPECT_EQ(PolicyBuilder::kFakeDeviceId, client_id_);
330 } 412 }
331 413
332 TEST_F(DeviceCloudPolicyManagerChromeOSEnrollmentTest, RegistrationFailed) { 414 TEST_F(DeviceCloudPolicyManagerChromeOSEnrollmentTest, RegistrationFailed) {
333 register_status_ = DM_STATUS_REQUEST_FAILED; 415 register_status_ = DM_STATUS_REQUEST_FAILED;
334 RunTest(); 416 RunTest();
335 ExpectFailedEnrollment(EnrollmentStatus::STATUS_REGISTRATION_FAILED); 417 ExpectFailedEnrollment(EnrollmentStatus::STATUS_REGISTRATION_FAILED);
336 EXPECT_EQ(DM_STATUS_REQUEST_FAILED, status_.client_status()); 418 EXPECT_EQ(DM_STATUS_REQUEST_FAILED, status_.client_status());
337 } 419 }
338 420
421 // Policy server implementations are not required to support robot auth
422 // tokens, so the following 4 Robot* tests verify that enrollment succeeds
423 // even if the robot auth token fetch fails.
424 TEST_F(DeviceCloudPolicyManagerChromeOSEnrollmentTest,
425 RobotAuthCodeFetchFailed) {
426 robot_auth_fetch_status_ = DM_STATUS_REQUEST_FAILED;
427 RunTest();
428 ExpectSuccessfulEnrollment();
429 }
430
431 TEST_F(DeviceCloudPolicyManagerChromeOSEnrollmentTest,
432 RobotRefreshTokenFetchResponseCodeFailed) {
433 url_fetcher_response_code_ = 400;
434 RunTest();
435 ExpectSuccessfulEnrollment();
436 }
437
438 TEST_F(DeviceCloudPolicyManagerChromeOSEnrollmentTest,
439 RobotRefreshTokenFetchResponseStringFailed) {
440 url_fetcher_response_string_ = "invalid response json";
441 RunTest();
442 ExpectSuccessfulEnrollment();
443 }
444
445 TEST_F(DeviceCloudPolicyManagerChromeOSEnrollmentTest, RobotRefreshSaveFailed) {
446 // Without a DeviceOAuth2TokenService, the refresh token can't be saved.
447 chromeos::DeviceOAuth2TokenServiceFactory::Shutdown();
448 RunTest();
449 ExpectSuccessfulEnrollment();
450 }
451
339 TEST_F(DeviceCloudPolicyManagerChromeOSEnrollmentTest, PolicyFetchFailed) { 452 TEST_F(DeviceCloudPolicyManagerChromeOSEnrollmentTest, PolicyFetchFailed) {
340 fetch_status_ = DM_STATUS_REQUEST_FAILED; 453 policy_fetch_status_ = DM_STATUS_REQUEST_FAILED;
341 RunTest(); 454 RunTest();
342 ExpectFailedEnrollment(EnrollmentStatus::STATUS_POLICY_FETCH_FAILED); 455 ExpectFailedEnrollment(EnrollmentStatus::STATUS_POLICY_FETCH_FAILED);
343 EXPECT_EQ(DM_STATUS_REQUEST_FAILED, status_.client_status()); 456 EXPECT_EQ(DM_STATUS_REQUEST_FAILED, status_.client_status());
344 } 457 }
345 458
346 TEST_F(DeviceCloudPolicyManagerChromeOSEnrollmentTest, ValidationFailed) { 459 TEST_F(DeviceCloudPolicyManagerChromeOSEnrollmentTest, ValidationFailed) {
347 device_policy_.policy().set_policy_data_signature("bad"); 460 device_policy_.policy().set_policy_data_signature("bad");
348 fetch_response_.clear_policy_response(); 461 policy_fetch_response_.clear_policy_response();
349 fetch_response_.mutable_policy_response()->add_response()->CopyFrom( 462 policy_fetch_response_.mutable_policy_response()->add_response()->CopyFrom(
350 device_policy_.policy()); 463 device_policy_.policy());
351 RunTest(); 464 RunTest();
352 ExpectFailedEnrollment(EnrollmentStatus::STATUS_VALIDATION_FAILED); 465 ExpectFailedEnrollment(EnrollmentStatus::STATUS_VALIDATION_FAILED);
353 EXPECT_EQ(CloudPolicyValidatorBase::VALIDATION_BAD_INITIAL_SIGNATURE, 466 EXPECT_EQ(CloudPolicyValidatorBase::VALIDATION_BAD_INITIAL_SIGNATURE,
354 status_.validation_status()); 467 status_.validation_status());
355 } 468 }
356 469
357 TEST_F(DeviceCloudPolicyManagerChromeOSEnrollmentTest, StoreError) { 470 TEST_F(DeviceCloudPolicyManagerChromeOSEnrollmentTest, StoreError) {
358 store_result_ = false; 471 store_result_ = false;
359 RunTest(); 472 RunTest();
360 ExpectFailedEnrollment(EnrollmentStatus::STATUS_STORE_ERROR); 473 ExpectFailedEnrollment(EnrollmentStatus::STATUS_STORE_ERROR);
361 EXPECT_EQ(CloudPolicyStore::STATUS_STORE_ERROR, 474 EXPECT_EQ(CloudPolicyStore::STATUS_STORE_ERROR,
362 status_.store_status()); 475 status_.store_status());
363 } 476 }
364 477
365 TEST_F(DeviceCloudPolicyManagerChromeOSEnrollmentTest, LoadError) { 478 TEST_F(DeviceCloudPolicyManagerChromeOSEnrollmentTest, LoadError) {
366 loaded_blob_.clear(); 479 loaded_blob_.clear();
367 RunTest(); 480 RunTest();
368 ExpectFailedEnrollment(EnrollmentStatus::STATUS_STORE_ERROR); 481 ExpectFailedEnrollment(EnrollmentStatus::STATUS_STORE_ERROR);
369 EXPECT_EQ(CloudPolicyStore::STATUS_LOAD_ERROR, 482 EXPECT_EQ(CloudPolicyStore::STATUS_LOAD_ERROR,
370 status_.store_status()); 483 status_.store_status());
371 } 484 }
372 485
373 } // namespace 486 } // namespace test
374 } // namespace policy 487 } // namespace policy
OLDNEW
« no previous file with comments | « chrome/app/generated_resources.grd ('k') | chrome/browser/chromeos/policy/enrollment_handler_chromeos.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698