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 "chrome/browser/chromeos/ownership/owner_settings_service_chromeos.h" |
| 6 |
| 7 #include <memory> |
5 #include <queue> | 8 #include <queue> |
6 #include <utility> | 9 #include <utility> |
7 | 10 |
8 #include "base/macros.h" | 11 #include "base/macros.h" |
9 #include "base/memory/linked_ptr.h" | 12 #include "base/memory/linked_ptr.h" |
10 #include "base/memory/scoped_ptr.h" | |
11 #include "base/run_loop.h" | 13 #include "base/run_loop.h" |
12 #include "base/test/scoped_path_override.h" | 14 #include "base/test/scoped_path_override.h" |
13 #include "base/values.h" | 15 #include "base/values.h" |
14 #include "chrome/browser/chromeos/ownership/owner_settings_service_chromeos.h" | |
15 #include "chrome/browser/chromeos/ownership/owner_settings_service_chromeos_fact
ory.h" | 16 #include "chrome/browser/chromeos/ownership/owner_settings_service_chromeos_fact
ory.h" |
16 #include "chrome/browser/chromeos/settings/device_settings_provider.h" | 17 #include "chrome/browser/chromeos/settings/device_settings_provider.h" |
17 #include "chrome/browser/chromeos/settings/device_settings_test_helper.h" | 18 #include "chrome/browser/chromeos/settings/device_settings_test_helper.h" |
18 #include "chrome/common/chrome_paths.h" | 19 #include "chrome/common/chrome_paths.h" |
19 #include "chrome/test/base/scoped_testing_local_state.h" | 20 #include "chrome/test/base/scoped_testing_local_state.h" |
20 #include "chrome/test/base/testing_browser_process.h" | 21 #include "chrome/test/base/testing_browser_process.h" |
21 #include "chrome/test/base/testing_profile.h" | 22 #include "chrome/test/base/testing_profile.h" |
22 #include "chromeos/settings/cros_settings_names.h" | 23 #include "chromeos/settings/cros_settings_names.h" |
23 #include "testing/gtest/include/gtest/gtest.h" | 24 #include "testing/gtest/include/gtest/gtest.h" |
24 | 25 |
(...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
127 checker.Wait(); | 128 checker.Wait(); |
128 } | 129 } |
129 | 130 |
130 void OnManagementSettingsSet(bool success) { | 131 void OnManagementSettingsSet(bool success) { |
131 management_settings_set_ = success; | 132 management_settings_set_ = success; |
132 } | 133 } |
133 | 134 |
134 protected: | 135 protected: |
135 OwnerSettingsServiceChromeOS* service_; | 136 OwnerSettingsServiceChromeOS* service_; |
136 ScopedTestingLocalState local_state_; | 137 ScopedTestingLocalState local_state_; |
137 scoped_ptr<DeviceSettingsProvider> provider_; | 138 std::unique_ptr<DeviceSettingsProvider> provider_; |
138 base::ScopedPathOverride user_data_dir_override_; | 139 base::ScopedPathOverride user_data_dir_override_; |
139 bool management_settings_set_; | 140 bool management_settings_set_; |
140 | 141 |
141 private: | 142 private: |
142 DISALLOW_COPY_AND_ASSIGN(OwnerSettingsServiceChromeOSTest); | 143 DISALLOW_COPY_AND_ASSIGN(OwnerSettingsServiceChromeOSTest); |
143 }; | 144 }; |
144 | 145 |
145 TEST_F(OwnerSettingsServiceChromeOSTest, SingleSetTest) { | 146 TEST_F(OwnerSettingsServiceChromeOSTest, SingleSetTest) { |
146 TestSingleSet(service_, kReleaseChannel, base::StringValue("dev-channel")); | 147 TestSingleSet(service_, kReleaseChannel, base::StringValue("dev-channel")); |
147 TestSingleSet(service_, kReleaseChannel, base::StringValue("beta-channel")); | 148 TestSingleSet(service_, kReleaseChannel, base::StringValue("beta-channel")); |
(...skipping 198 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
346 InitOwner(AccountId::FromUserEmail(device_policy_.policy_data().username()), | 347 InitOwner(AccountId::FromUserEmail(device_policy_.policy_data().username()), |
347 true); | 348 true); |
348 ReloadDeviceSettings(); | 349 ReloadDeviceSettings(); |
349 ASSERT_TRUE(service_->IsOwner()); | 350 ASSERT_TRUE(service_->IsOwner()); |
350 | 351 |
351 EXPECT_TRUE(FindInListValue(device_policy_.policy_data().username(), | 352 EXPECT_TRUE(FindInListValue(device_policy_.policy_data().username(), |
352 provider_->Get(kAccountsPrefUsers))); | 353 provider_->Get(kAccountsPrefUsers))); |
353 } | 354 } |
354 | 355 |
355 } // namespace chromeos | 356 } // namespace chromeos |
OLD | NEW |