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(AccountId::FromUserEmail(device_policy_.policy_data().username()), | 103 InitOwner(device_policy_.policy_data().username(), true); |
104 true); | |
105 FlushDeviceSettings(); | 104 FlushDeviceSettings(); |
106 | 105 |
107 service_ = OwnerSettingsServiceChromeOSFactory::GetForBrowserContext( | 106 service_ = OwnerSettingsServiceChromeOSFactory::GetForBrowserContext( |
108 profile_.get()); | 107 profile_.get()); |
109 ASSERT_TRUE(service_); | 108 ASSERT_TRUE(service_); |
110 ASSERT_TRUE(service_->IsOwner()); | 109 ASSERT_TRUE(service_->IsOwner()); |
111 | 110 |
112 device_policy_.policy_data().set_management_mode( | 111 device_policy_.policy_data().set_management_mode( |
113 em::PolicyData::LOCAL_OWNER); | 112 em::PolicyData::LOCAL_OWNER); |
114 device_policy_.Build(); | 113 device_policy_.Build(); |
(...skipping 221 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
336 }; | 335 }; |
337 | 336 |
338 TEST_F(OwnerSettingsServiceChromeOSNoOwnerTest, SingleSetTest) { | 337 TEST_F(OwnerSettingsServiceChromeOSNoOwnerTest, SingleSetTest) { |
339 ASSERT_FALSE(service_->SetBoolean(kAccountsPrefAllowGuest, false)); | 338 ASSERT_FALSE(service_->SetBoolean(kAccountsPrefAllowGuest, false)); |
340 } | 339 } |
341 | 340 |
342 TEST_F(OwnerSettingsServiceChromeOSNoOwnerTest, TakeOwnershipForceWhitelist) { | 341 TEST_F(OwnerSettingsServiceChromeOSNoOwnerTest, TakeOwnershipForceWhitelist) { |
343 EXPECT_FALSE(FindInListValue(device_policy_.policy_data().username(), | 342 EXPECT_FALSE(FindInListValue(device_policy_.policy_data().username(), |
344 provider_->Get(kAccountsPrefUsers))); | 343 provider_->Get(kAccountsPrefUsers))); |
345 owner_key_util_->SetPrivateKey(device_policy_.GetSigningKey()); | 344 owner_key_util_->SetPrivateKey(device_policy_.GetSigningKey()); |
346 InitOwner(AccountId::FromUserEmail(device_policy_.policy_data().username()), | 345 InitOwner(device_policy_.policy_data().username(), true); |
347 true); | |
348 ReloadDeviceSettings(); | 346 ReloadDeviceSettings(); |
349 ASSERT_TRUE(service_->IsOwner()); | 347 ASSERT_TRUE(service_->IsOwner()); |
350 | 348 |
351 EXPECT_TRUE(FindInListValue(device_policy_.policy_data().username(), | 349 EXPECT_TRUE(FindInListValue(device_policy_.policy_data().username(), |
352 provider_->Get(kAccountsPrefUsers))); | 350 provider_->Get(kAccountsPrefUsers))); |
353 } | 351 } |
354 | 352 |
355 } // namespace chromeos | 353 } // namespace chromeos |
OLD | NEW |