| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 <queue> | 5 #include <queue> |
| 6 #include <utility> | 6 #include <utility> |
| 7 | 7 |
| 8 #include "base/macros.h" | 8 #include "base/macros.h" |
| 9 #include "base/memory/linked_ptr.h" | 9 #include "base/memory/linked_ptr.h" |
| 10 #include "base/memory/scoped_ptr.h" | 10 #include "base/memory/scoped_ptr.h" |
| (...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 93 : service_(nullptr), | 93 : service_(nullptr), |
| 94 local_state_(TestingBrowserProcess::GetGlobal()), | 94 local_state_(TestingBrowserProcess::GetGlobal()), |
| 95 user_data_dir_override_(chrome::DIR_USER_DATA), | 95 user_data_dir_override_(chrome::DIR_USER_DATA), |
| 96 management_settings_set_(false) {} | 96 management_settings_set_(false) {} |
| 97 | 97 |
| 98 void SetUp() override { | 98 void SetUp() override { |
| 99 DeviceSettingsTestBase::SetUp(); | 99 DeviceSettingsTestBase::SetUp(); |
| 100 provider_.reset(new DeviceSettingsProvider(base::Bind(&OnPrefChanged), | 100 provider_.reset(new DeviceSettingsProvider(base::Bind(&OnPrefChanged), |
| 101 &device_settings_service_)); | 101 &device_settings_service_)); |
| 102 owner_key_util_->SetPrivateKey(device_policy_.GetSigningKey()); | 102 owner_key_util_->SetPrivateKey(device_policy_.GetSigningKey()); |
| 103 InitOwner(device_policy_.policy_data().username(), true); | 103 InitOwner(AccountId::FromUserEmail(device_policy_.policy_data().username()), |
| 104 true); |
| 104 FlushDeviceSettings(); | 105 FlushDeviceSettings(); |
| 105 | 106 |
| 106 service_ = OwnerSettingsServiceChromeOSFactory::GetForBrowserContext( | 107 service_ = OwnerSettingsServiceChromeOSFactory::GetForBrowserContext( |
| 107 profile_.get()); | 108 profile_.get()); |
| 108 ASSERT_TRUE(service_); | 109 ASSERT_TRUE(service_); |
| 109 ASSERT_TRUE(service_->IsOwner()); | 110 ASSERT_TRUE(service_->IsOwner()); |
| 110 | 111 |
| 111 device_policy_.policy_data().set_management_mode( | 112 device_policy_.policy_data().set_management_mode( |
| 112 em::PolicyData::LOCAL_OWNER); | 113 em::PolicyData::LOCAL_OWNER); |
| 113 device_policy_.Build(); | 114 device_policy_.Build(); |
| (...skipping 221 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 335 }; | 336 }; |
| 336 | 337 |
| 337 TEST_F(OwnerSettingsServiceChromeOSNoOwnerTest, SingleSetTest) { | 338 TEST_F(OwnerSettingsServiceChromeOSNoOwnerTest, SingleSetTest) { |
| 338 ASSERT_FALSE(service_->SetBoolean(kAccountsPrefAllowGuest, false)); | 339 ASSERT_FALSE(service_->SetBoolean(kAccountsPrefAllowGuest, false)); |
| 339 } | 340 } |
| 340 | 341 |
| 341 TEST_F(OwnerSettingsServiceChromeOSNoOwnerTest, TakeOwnershipForceWhitelist) { | 342 TEST_F(OwnerSettingsServiceChromeOSNoOwnerTest, TakeOwnershipForceWhitelist) { |
| 342 EXPECT_FALSE(FindInListValue(device_policy_.policy_data().username(), | 343 EXPECT_FALSE(FindInListValue(device_policy_.policy_data().username(), |
| 343 provider_->Get(kAccountsPrefUsers))); | 344 provider_->Get(kAccountsPrefUsers))); |
| 344 owner_key_util_->SetPrivateKey(device_policy_.GetSigningKey()); | 345 owner_key_util_->SetPrivateKey(device_policy_.GetSigningKey()); |
| 345 InitOwner(device_policy_.policy_data().username(), true); | 346 InitOwner(AccountId::FromUserEmail(device_policy_.policy_data().username()), |
| 347 true); |
| 346 ReloadDeviceSettings(); | 348 ReloadDeviceSettings(); |
| 347 ASSERT_TRUE(service_->IsOwner()); | 349 ASSERT_TRUE(service_->IsOwner()); |
| 348 | 350 |
| 349 EXPECT_TRUE(FindInListValue(device_policy_.policy_data().username(), | 351 EXPECT_TRUE(FindInListValue(device_policy_.policy_data().username(), |
| 350 provider_->Get(kAccountsPrefUsers))); | 352 provider_->Get(kAccountsPrefUsers))); |
| 351 } | 353 } |
| 352 | 354 |
| 353 } // namespace chromeos | 355 } // namespace chromeos |
| OLD | NEW |