device_cloud_policy_manager_chromeos_unittest.cc revision f2477e01787aa58f445919b809d89e252beef54f
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 3// found in the LICENSE file. 4 5#include "chrome/browser/chromeos/policy/device_cloud_policy_manager_chromeos.h" 6 7#include "base/basictypes.h" 8#include "base/compiler_specific.h" 9#include "base/memory/scoped_ptr.h" 10#include "base/message_loop/message_loop.h" 11#include "base/prefs/pref_registry_simple.h" 12#include "base/prefs/testing_pref_service.h" 13#include "base/run_loop.h" 14#include "chrome/browser/chromeos/policy/device_cloud_policy_store_chromeos.h" 15#include "chrome/browser/chromeos/policy/enterprise_install_attributes.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" 19#include "chrome/browser/chromeos/settings/device_settings_service.h" 20#include "chrome/browser/chromeos/settings/device_settings_test_helper.h" 21#include "chrome/browser/policy/cloud/cloud_policy_client.h" 22#include "chrome/browser/policy/cloud/mock_device_management_service.h" 23#include "chrome/browser/policy/proto/chromeos/chrome_device_policy.pb.h" 24#include "chrome/browser/policy/proto/cloud/device_management_backend.pb.h" 25#include "chrome/browser/prefs/browser_prefs.h" 26#include "chrome/test/base/testing_browser_process.h" 27#include "chromeos/cryptohome/system_salt_getter.h" 28#include "chromeos/dbus/dbus_client_implementation_type.h" 29#include "chromeos/dbus/dbus_thread_manager.h" 30#include "chromeos/system/mock_statistics_provider.h" 31#include "chromeos/system/statistics_provider.h" 32#include "components/policy/core/common/external_data_fetcher.h" 33#include "components/policy/core/common/schema_registry.h" 34#include "google_apis/gaia/gaia_oauth_client.h" 35#include "net/url_request/test_url_fetcher_factory.h" 36#include "net/url_request/url_request_test_util.h" 37#include "policy/policy_constants.h" 38#include "testing/gmock/include/gmock/gmock.h" 39#include "testing/gtest/include/gtest/gtest.h" 40 41using testing::AnyNumber; 42using testing::AtMost; 43using testing::DoAll; 44using testing::Mock; 45using testing::Return; 46using testing::SaveArg; 47using testing::SetArgumentPointee; 48using testing::_; 49 50namespace em = enterprise_management; 51 52namespace policy { 53namespace { 54 55void CopyLockResult(base::RunLoop* loop, 56 EnterpriseInstallAttributes::LockResult* out, 57 EnterpriseInstallAttributes::LockResult result) { 58 *out = result; 59 loop->Quit(); 60} 61 62void CopyTokenService(chromeos::DeviceOAuth2TokenService** out_token_service, 63 chromeos::DeviceOAuth2TokenService* in_token_service) { 64 *out_token_service = in_token_service; 65} 66 67class DeviceCloudPolicyManagerChromeOSTest 68 : public chromeos::DeviceSettingsTestBase { 69 protected: 70 DeviceCloudPolicyManagerChromeOSTest() : store_(NULL) { 71 EXPECT_CALL(mock_statistics_provider_, 72 GetMachineStatistic(_, _)) 73 .WillRepeatedly(Return(false)); 74 EXPECT_CALL(mock_statistics_provider_, 75 GetMachineStatistic("serial_number", _)) 76 .WillRepeatedly(DoAll(SetArgumentPointee<1>(std::string("test_sn")), 77 Return(true))); 78 chromeos::system::StatisticsProvider::SetTestProvider( 79 &mock_statistics_provider_); 80 } 81 82 virtual ~DeviceCloudPolicyManagerChromeOSTest() { 83 chromeos::system::StatisticsProvider::SetTestProvider(NULL); 84 } 85 86 virtual void SetUp() OVERRIDE { 87 DeviceSettingsTestBase::SetUp(); 88 89 // DBusThreadManager is set up in DeviceSettingsTestBase::SetUp(). 90 install_attributes_.reset(new EnterpriseInstallAttributes( 91 chromeos::DBusThreadManager::Get()->GetCryptohomeClient())); 92 store_ = new DeviceCloudPolicyStoreChromeOS(&device_settings_service_, 93 install_attributes_.get(), 94 loop_.message_loop_proxy()); 95 manager_.reset(new DeviceCloudPolicyManagerChromeOS( 96 make_scoped_ptr(store_), 97 loop_.message_loop_proxy(), 98 loop_.message_loop_proxy(), 99 install_attributes_.get())); 100 101 chrome::RegisterLocalState(local_state_.registry()); 102 manager_->Init(&schema_registry_); 103 104 // DeviceOAuth2TokenService uses the system request context to fetch 105 // OAuth tokens, then writes the token to local state, encrypting it 106 // first with methods in CryptohomeTokenEncryptor. 107 request_context_getter_ = new net::TestURLRequestContextGetter( 108 loop_.message_loop_proxy()); 109 TestingBrowserProcess::GetGlobal()->SetSystemRequestContext( 110 request_context_getter_.get()); 111 TestingBrowserProcess::GetGlobal()->SetLocalState(&local_state_); 112 // SystemSaltGetter is used in DeviceOAuth2TokenServiceFactory. 113 chromeos::SystemSaltGetter::Initialize(); 114 chromeos::DeviceOAuth2TokenServiceFactory::Initialize(); 115 url_fetcher_response_code_ = 200; 116 url_fetcher_response_string_ = "{\"access_token\":\"accessToken4Test\"," 117 "\"expires_in\":1234," 118 "\"refresh_token\":\"refreshToken4Test\"}"; 119 } 120 121 virtual void TearDown() OVERRIDE { 122 manager_->Shutdown(); 123 DeviceSettingsTestBase::TearDown(); 124 125 chromeos::DeviceOAuth2TokenServiceFactory::Shutdown(); 126 chromeos::SystemSaltGetter::Shutdown(); 127 TestingBrowserProcess::GetGlobal()->SetLocalState(NULL); 128 } 129 130 scoped_ptr<EnterpriseInstallAttributes> install_attributes_; 131 132 scoped_refptr<net::URLRequestContextGetter> request_context_getter_; 133 net::TestURLFetcherFactory url_fetcher_factory_; 134 int url_fetcher_response_code_; 135 string url_fetcher_response_string_; 136 TestingPrefServiceSimple local_state_; 137 MockDeviceManagementService device_management_service_; 138 chromeos::ScopedTestDeviceSettingsService test_device_settings_service_; 139 chromeos::ScopedTestCrosSettings test_cros_settings_; 140 chromeos::system::MockStatisticsProvider mock_statistics_provider_; 141 142 DeviceCloudPolicyStoreChromeOS* store_; 143 SchemaRegistry schema_registry_; 144 scoped_ptr<DeviceCloudPolicyManagerChromeOS> manager_; 145 146 private: 147 DISALLOW_COPY_AND_ASSIGN(DeviceCloudPolicyManagerChromeOSTest); 148}; 149 150TEST_F(DeviceCloudPolicyManagerChromeOSTest, FreshDevice) { 151 owner_key_util_->Clear(); 152 FlushDeviceSettings(); 153 EXPECT_TRUE(manager_->IsInitializationComplete(POLICY_DOMAIN_CHROME)); 154 155 manager_->Connect(&local_state_, 156 &device_management_service_, 157 scoped_ptr<CloudPolicyClient::StatusProvider>()); 158 159 PolicyBundle bundle; 160 EXPECT_TRUE(manager_->policies().Equals(bundle)); 161} 162 163TEST_F(DeviceCloudPolicyManagerChromeOSTest, EnrolledDevice) { 164 base::RunLoop loop; 165 EnterpriseInstallAttributes::LockResult result; 166 install_attributes_->LockDevice(PolicyBuilder::kFakeUsername, 167 DEVICE_MODE_ENTERPRISE, 168 PolicyBuilder::kFakeDeviceId, 169 base::Bind(&CopyLockResult, &loop, &result)); 170 loop.Run(); 171 ASSERT_EQ(EnterpriseInstallAttributes::LOCK_SUCCESS, result); 172 173 FlushDeviceSettings(); 174 EXPECT_EQ(CloudPolicyStore::STATUS_OK, store_->status()); 175 EXPECT_TRUE(manager_->IsInitializationComplete(POLICY_DOMAIN_CHROME)); 176 177 PolicyBundle bundle; 178 bundle.Get(PolicyNamespace(POLICY_DOMAIN_CHROME, std::string())) 179 .Set(key::kDeviceMetricsReportingEnabled, 180 POLICY_LEVEL_MANDATORY, 181 POLICY_SCOPE_MACHINE, 182 Value::CreateBooleanValue(false), 183 NULL); 184 EXPECT_TRUE(manager_->policies().Equals(bundle)); 185 186 manager_->Connect(&local_state_, 187 &device_management_service_, 188 scoped_ptr<CloudPolicyClient::StatusProvider>()); 189 EXPECT_TRUE(manager_->policies().Equals(bundle)); 190 191 manager_->Shutdown(); 192 EXPECT_TRUE(manager_->policies().Equals(bundle)); 193 194 EXPECT_EQ(manager_->GetRobotAccountId(), 195 PolicyBuilder::kFakeServiceAccountIdentity); 196} 197 198TEST_F(DeviceCloudPolicyManagerChromeOSTest, ConsumerDevice) { 199 FlushDeviceSettings(); 200 EXPECT_EQ(CloudPolicyStore::STATUS_BAD_STATE, store_->status()); 201 EXPECT_TRUE(manager_->IsInitializationComplete(POLICY_DOMAIN_CHROME)); 202 203 PolicyBundle bundle; 204 EXPECT_TRUE(manager_->policies().Equals(bundle)); 205 206 manager_->Connect(&local_state_, 207 &device_management_service_, 208 scoped_ptr<CloudPolicyClient::StatusProvider>()); 209 EXPECT_TRUE(manager_->policies().Equals(bundle)); 210 211 manager_->Shutdown(); 212 EXPECT_TRUE(manager_->policies().Equals(bundle)); 213} 214 215class DeviceCloudPolicyManagerChromeOSEnrollmentTest 216 : public DeviceCloudPolicyManagerChromeOSTest { 217 public: 218 void Done(EnrollmentStatus status) { 219 status_ = status; 220 done_ = true; 221 } 222 223 protected: 224 DeviceCloudPolicyManagerChromeOSEnrollmentTest() 225 : is_auto_enrollment_(false), 226 register_status_(DM_STATUS_SUCCESS), 227 policy_fetch_status_(DM_STATUS_SUCCESS), 228 robot_auth_fetch_status_(DM_STATUS_SUCCESS), 229 store_result_(true), 230 status_(EnrollmentStatus::ForStatus(EnrollmentStatus::STATUS_SUCCESS)), 231 done_(false) {} 232 233 virtual void SetUp() OVERRIDE { 234 DeviceCloudPolicyManagerChromeOSTest::SetUp(); 235 236 // Set up test data. 237 device_policy_.SetDefaultNewSigningKey(); 238 device_policy_.policy_data().set_timestamp( 239 (base::Time::NowFromSystemTime() - 240 base::Time::UnixEpoch()).InMilliseconds()); 241 device_policy_.Build(); 242 243 register_response_.mutable_register_response()->set_device_management_token( 244 PolicyBuilder::kFakeToken); 245 policy_fetch_response_.mutable_policy_response()->add_response()->CopyFrom( 246 device_policy_.policy()); 247 robot_auth_fetch_response_.mutable_service_api_access_response() 248 ->set_auth_code("auth_code_for_test"); 249 loaded_blob_ = device_policy_.GetBlob(); 250 251 // Initialize the manager. 252 FlushDeviceSettings(); 253 EXPECT_EQ(CloudPolicyStore::STATUS_BAD_STATE, store_->status()); 254 EXPECT_TRUE(manager_->IsInitializationComplete(POLICY_DOMAIN_CHROME)); 255 256 PolicyBundle bundle; 257 EXPECT_TRUE(manager_->policies().Equals(bundle)); 258 259 manager_->Connect(&local_state_, 260 &device_management_service_, 261 scoped_ptr<CloudPolicyClient::StatusProvider>()); 262 } 263 264 void ExpectFailedEnrollment(EnrollmentStatus::Status status) { 265 EXPECT_EQ(status, status_.status()); 266 EXPECT_FALSE(store_->is_managed()); 267 PolicyBundle empty_bundle; 268 EXPECT_TRUE(manager_->policies().Equals(empty_bundle)); 269 } 270 271 void ExpectSuccessfulEnrollment() { 272 EXPECT_EQ(EnrollmentStatus::STATUS_SUCCESS, status_.status()); 273 EXPECT_EQ(DEVICE_MODE_ENTERPRISE, install_attributes_->GetMode()); 274 EXPECT_TRUE(store_->has_policy()); 275 EXPECT_TRUE(store_->is_managed()); 276 ASSERT_TRUE(manager_->core()->client()); 277 EXPECT_TRUE(manager_->core()->client()->is_registered()); 278 279 PolicyBundle bundle; 280 bundle.Get(PolicyNamespace(POLICY_DOMAIN_CHROME, std::string())) 281 .Set(key::kDeviceMetricsReportingEnabled, 282 POLICY_LEVEL_MANDATORY, 283 POLICY_SCOPE_MACHINE, 284 Value::CreateBooleanValue(false), 285 NULL); 286 EXPECT_TRUE(manager_->policies().Equals(bundle)); 287 } 288 289 void RunTest() { 290 // Trigger enrollment. 291 MockDeviceManagementJob* register_job = NULL; 292 EXPECT_CALL(device_management_service_, 293 CreateJob(DeviceManagementRequestJob::TYPE_REGISTRATION)) 294 .Times(AtMost(1)) 295 .WillOnce(device_management_service_.CreateAsyncJob(®ister_job)); 296 EXPECT_CALL(device_management_service_, StartJob(_, _, _, _, _, _, _)) 297 .Times(AtMost(1)) 298 .WillOnce(DoAll(SaveArg<5>(&client_id_), 299 SaveArg<6>(®ister_request_))); 300 DeviceCloudPolicyManagerChromeOS::AllowedDeviceModes modes; 301 modes[DEVICE_MODE_ENTERPRISE] = true; 302 manager_->StartEnrollment( 303 "auth token", is_auto_enrollment_, modes, 304 base::Bind(&DeviceCloudPolicyManagerChromeOSEnrollmentTest::Done, 305 base::Unretained(this))); 306 Mock::VerifyAndClearExpectations(&device_management_service_); 307 308 if (done_) 309 return; 310 311 // Process registration. 312 ASSERT_TRUE(register_job); 313 MockDeviceManagementJob* policy_fetch_job = NULL; 314 EXPECT_CALL(device_management_service_, 315 CreateJob(DeviceManagementRequestJob::TYPE_POLICY_FETCH)) 316 .Times(AtMost(1)) 317 .WillOnce(device_management_service_.CreateAsyncJob(&policy_fetch_job)); 318 EXPECT_CALL(device_management_service_, StartJob(_, _, _, _, _, _, _)) 319 .Times(AtMost(1)); 320 register_job->SendResponse(register_status_, register_response_); 321 Mock::VerifyAndClearExpectations(&device_management_service_); 322 323 if (done_) 324 return; 325 326 // Process policy fetch. 327 ASSERT_TRUE(policy_fetch_job); 328 policy_fetch_job->SendResponse(policy_fetch_status_, 329 policy_fetch_response_); 330 331 if (done_) 332 return; 333 334 // Process verification. 335 MockDeviceManagementJob* robot_auth_fetch_job = NULL; 336 EXPECT_CALL(device_management_service_, 337 CreateJob(DeviceManagementRequestJob::TYPE_API_AUTH_CODE_FETCH)) 338 .Times(AtMost(1)) 339 .WillOnce(device_management_service_.CreateAsyncJob( 340 &robot_auth_fetch_job)); 341 EXPECT_CALL(device_management_service_, StartJob(_, _, _, _, _, _, _)) 342 .Times(AtMost(1)); 343 base::RunLoop().RunUntilIdle(); 344 Mock::VerifyAndClearExpectations(&device_management_service_); 345 346 if (done_) 347 return; 348 349 // Process robot auth token fetch. 350 ASSERT_TRUE(robot_auth_fetch_job); 351 robot_auth_fetch_job->SendResponse(robot_auth_fetch_status_, 352 robot_auth_fetch_response_); 353 Mock::VerifyAndClearExpectations(&device_management_service_); 354 355 if (done_) 356 return; 357 358 // Process robot refresh token fetch if the auth code fetch succeeded. 359 // DeviceCloudPolicyManagerChromeOS holds an EnrollmentHandlerChromeOS which 360 // holds a GaiaOAuthClient that fetches the refresh token during enrollment. 361 // We return a successful OAuth response via a TestURLFetcher to trigger the 362 // happy path for these classes so that enrollment can continue. 363 if (robot_auth_fetch_status_ == DM_STATUS_SUCCESS) { 364 net::TestURLFetcher* url_fetcher = url_fetcher_factory_.GetFetcherByID( 365 gaia::GaiaOAuthClient::kUrlFetcherId); 366 ASSERT_TRUE(url_fetcher); 367 url_fetcher->SetMaxRetriesOn5xx(0); 368 url_fetcher->set_status(net::URLRequestStatus()); 369 url_fetcher->set_response_code(url_fetcher_response_code_); 370 url_fetcher->SetResponseString(url_fetcher_response_string_); 371 url_fetcher->delegate()->OnURLFetchComplete(url_fetcher); 372 } 373 base::RunLoop().RunUntilIdle(); 374 375 if (done_) 376 return; 377 378 // Process robot refresh token store. 379 chromeos::DeviceOAuth2TokenService* token_service = NULL; 380 chromeos::DeviceOAuth2TokenServiceFactory::Get( 381 base::Bind(&CopyTokenService, &token_service)); 382 base::RunLoop().RunUntilIdle(); 383 ASSERT_TRUE(token_service); 384 EXPECT_EQ("refreshToken4Test", token_service->GetRefreshToken("")); 385 386 // Process policy store. 387 device_settings_test_helper_.set_store_result(store_result_); 388 device_settings_test_helper_.FlushStore(); 389 EXPECT_EQ(device_policy_.GetBlob(), 390 device_settings_test_helper_.policy_blob()); 391 392 if (done_) 393 return; 394 395 // Key installation and policy load. 396 device_settings_test_helper_.set_policy_blob(loaded_blob_); 397 owner_key_util_->SetPublicKeyFromPrivateKey( 398 *device_policy_.GetNewSigningKey()); 399 ReloadDeviceSettings(); 400 } 401 402 bool is_auto_enrollment_; 403 404 DeviceManagementStatus register_status_; 405 em::DeviceManagementResponse register_response_; 406 407 DeviceManagementStatus policy_fetch_status_; 408 em::DeviceManagementResponse policy_fetch_response_; 409 410 DeviceManagementStatus robot_auth_fetch_status_; 411 em::DeviceManagementResponse robot_auth_fetch_response_; 412 413 bool store_result_; 414 std::string loaded_blob_; 415 416 em::DeviceManagementRequest register_request_; 417 std::string client_id_; 418 EnrollmentStatus status_; 419 420 bool done_; 421 422 private: 423 DISALLOW_COPY_AND_ASSIGN(DeviceCloudPolicyManagerChromeOSEnrollmentTest); 424}; 425 426TEST_F(DeviceCloudPolicyManagerChromeOSEnrollmentTest, Success) { 427 RunTest(); 428 ExpectSuccessfulEnrollment(); 429} 430 431TEST_F(DeviceCloudPolicyManagerChromeOSEnrollmentTest, AutoEnrollment) { 432 is_auto_enrollment_ = true; 433 RunTest(); 434 ExpectSuccessfulEnrollment(); 435 EXPECT_TRUE(register_request_.register_request().auto_enrolled()); 436} 437 438TEST_F(DeviceCloudPolicyManagerChromeOSEnrollmentTest, Reenrollment) { 439 base::RunLoop loop; 440 EnterpriseInstallAttributes::LockResult result; 441 install_attributes_->LockDevice(PolicyBuilder::kFakeUsername, 442 DEVICE_MODE_ENTERPRISE, 443 PolicyBuilder::kFakeDeviceId, 444 base::Bind(&CopyLockResult, &loop, &result)); 445 loop.Run(); 446 ASSERT_EQ(EnterpriseInstallAttributes::LOCK_SUCCESS, result); 447 448 RunTest(); 449 ExpectSuccessfulEnrollment(); 450 EXPECT_TRUE(register_request_.register_request().reregister()); 451 EXPECT_EQ(PolicyBuilder::kFakeDeviceId, client_id_); 452} 453 454TEST_F(DeviceCloudPolicyManagerChromeOSEnrollmentTest, RegistrationFailed) { 455 register_status_ = DM_STATUS_REQUEST_FAILED; 456 RunTest(); 457 ExpectFailedEnrollment(EnrollmentStatus::STATUS_REGISTRATION_FAILED); 458 EXPECT_EQ(DM_STATUS_REQUEST_FAILED, status_.client_status()); 459} 460 461TEST_F(DeviceCloudPolicyManagerChromeOSEnrollmentTest, 462 RobotAuthCodeFetchFailed) { 463 robot_auth_fetch_status_ = DM_STATUS_REQUEST_FAILED; 464 RunTest(); 465 ExpectFailedEnrollment(EnrollmentStatus::STATUS_ROBOT_AUTH_FETCH_FAILED); 466} 467 468TEST_F(DeviceCloudPolicyManagerChromeOSEnrollmentTest, 469 RobotRefreshTokenFetchResponseCodeFailed) { 470 url_fetcher_response_code_ = 400; 471 RunTest(); 472 ExpectFailedEnrollment(EnrollmentStatus::STATUS_ROBOT_REFRESH_FETCH_FAILED); 473 EXPECT_EQ(400, status_.http_status()); 474} 475 476TEST_F(DeviceCloudPolicyManagerChromeOSEnrollmentTest, 477 RobotRefreshTokenFetchResponseStringFailed) { 478 url_fetcher_response_string_ = "invalid response json"; 479 RunTest(); 480 ExpectFailedEnrollment(EnrollmentStatus::STATUS_ROBOT_REFRESH_FETCH_FAILED); 481} 482 483TEST_F(DeviceCloudPolicyManagerChromeOSEnrollmentTest, RobotRefreshSaveFailed) { 484 // Without a DeviceOAuth2TokenService, the refresh token can't be saved. 485 chromeos::DeviceOAuth2TokenServiceFactory::Shutdown(); 486 RunTest(); 487 ExpectFailedEnrollment(EnrollmentStatus::STATUS_ROBOT_REFRESH_STORE_FAILED); 488} 489 490TEST_F(DeviceCloudPolicyManagerChromeOSEnrollmentTest, 491 RobotRefreshEncryptionFailed) { 492 // The encryption lib is a noop for tests, but empty results from encryption 493 // is an error, so we simulate an encryption error by returning an empty 494 // refresh token. 495 url_fetcher_response_string_ = "{\"access_token\":\"accessToken4Test\"," 496 "\"expires_in\":1234," 497 "\"refresh_token\":\"\"}"; 498 RunTest(); 499 ExpectFailedEnrollment(EnrollmentStatus::STATUS_ROBOT_REFRESH_STORE_FAILED); 500} 501 502TEST_F(DeviceCloudPolicyManagerChromeOSEnrollmentTest, PolicyFetchFailed) { 503 policy_fetch_status_ = DM_STATUS_REQUEST_FAILED; 504 RunTest(); 505 ExpectFailedEnrollment(EnrollmentStatus::STATUS_POLICY_FETCH_FAILED); 506 EXPECT_EQ(DM_STATUS_REQUEST_FAILED, status_.client_status()); 507} 508 509TEST_F(DeviceCloudPolicyManagerChromeOSEnrollmentTest, ValidationFailed) { 510 device_policy_.policy().set_policy_data_signature("bad"); 511 policy_fetch_response_.clear_policy_response(); 512 policy_fetch_response_.mutable_policy_response()->add_response()->CopyFrom( 513 device_policy_.policy()); 514 RunTest(); 515 ExpectFailedEnrollment(EnrollmentStatus::STATUS_VALIDATION_FAILED); 516 EXPECT_EQ(CloudPolicyValidatorBase::VALIDATION_BAD_INITIAL_SIGNATURE, 517 status_.validation_status()); 518} 519 520TEST_F(DeviceCloudPolicyManagerChromeOSEnrollmentTest, StoreError) { 521 store_result_ = false; 522 RunTest(); 523 ExpectFailedEnrollment(EnrollmentStatus::STATUS_STORE_ERROR); 524 EXPECT_EQ(CloudPolicyStore::STATUS_STORE_ERROR, 525 status_.store_status()); 526} 527 528TEST_F(DeviceCloudPolicyManagerChromeOSEnrollmentTest, LoadError) { 529 loaded_blob_.clear(); 530 RunTest(); 531 ExpectFailedEnrollment(EnrollmentStatus::STATUS_STORE_ERROR); 532 EXPECT_EQ(CloudPolicyStore::STATUS_LOAD_ERROR, 533 status_.store_status()); 534} 535 536} // namespace 537} // namespace policy 538