OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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/app_mode/kiosk_app_manager.h" | 5 #include "chrome/browser/chromeos/app_mode/kiosk_app_manager.h" |
6 | 6 |
7 #include "base/at_exit.h" | 7 #include "base/at_exit.h" |
8 #include "base/command_line.h" | 8 #include "base/command_line.h" |
9 #include "base/message_loop.h" | 9 #include "base/message_loop.h" |
10 #include "base/path_service.h" | 10 #include "base/path_service.h" |
11 #include "base/stringprintf.h" | 11 #include "base/stringprintf.h" |
12 #include "base/values.h" | 12 #include "base/values.h" |
13 #include "chrome/browser/browser_process.h" | 13 #include "chrome/browser/browser_process.h" |
14 #include "chrome/browser/chromeos/app_mode/kiosk_app_manager_observer.h" | 14 #include "chrome/browser/chromeos/app_mode/kiosk_app_manager_observer.h" |
| 15 #include "chrome/browser/chromeos/policy/device_local_account.h" |
15 #include "chrome/browser/chromeos/settings/cros_settings.h" | 16 #include "chrome/browser/chromeos/settings/cros_settings.h" |
16 #include "chrome/browser/chromeos/settings/cros_settings_names.h" | 17 #include "chrome/browser/chromeos/settings/cros_settings_names.h" |
17 #include "chrome/browser/prefs/scoped_user_pref_update.h" | 18 #include "chrome/browser/prefs/scoped_user_pref_update.h" |
18 #include "chrome/common/chrome_paths.h" | 19 #include "chrome/common/chrome_paths.h" |
19 #include "chrome/common/chrome_switches.h" | 20 #include "chrome/common/chrome_switches.h" |
20 #include "chrome/test/base/in_process_browser_test.h" | 21 #include "chrome/test/base/in_process_browser_test.h" |
21 #include "net/base/host_port_pair.h" | 22 #include "net/base/host_port_pair.h" |
22 #include "net/dns/mock_host_resolver.h" | 23 #include "net/dns/mock_host_resolver.h" |
23 | 24 |
24 namespace chromeos { | 25 namespace chromeos { |
(...skipping 171 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
196 dict_update->Set(KioskAppManager::kKeyApps, apps_dict.release()); | 197 dict_update->Set(KioskAppManager::kKeyApps, apps_dict.release()); |
197 | 198 |
198 // Make the app appear in device settings. | 199 // Make the app appear in device settings. |
199 base::ListValue device_local_accounts; | 200 base::ListValue device_local_accounts; |
200 scoped_ptr<base::DictionaryValue> entry(new base::DictionaryValue); | 201 scoped_ptr<base::DictionaryValue> entry(new base::DictionaryValue); |
201 entry->SetStringWithoutPathExpansion( | 202 entry->SetStringWithoutPathExpansion( |
202 kAccountsPrefDeviceLocalAccountsKeyId, | 203 kAccountsPrefDeviceLocalAccountsKeyId, |
203 "app_1_id"); | 204 "app_1_id"); |
204 entry->SetIntegerWithoutPathExpansion( | 205 entry->SetIntegerWithoutPathExpansion( |
205 kAccountsPrefDeviceLocalAccountsKeyType, | 206 kAccountsPrefDeviceLocalAccountsKeyType, |
206 DEVICE_LOCAL_ACCOUNT_TYPE_KIOSK_APP); | 207 policy::DeviceLocalAccount::TYPE_KIOSK_APP); |
207 entry->SetStringWithoutPathExpansion( | 208 entry->SetStringWithoutPathExpansion( |
208 kAccountsPrefDeviceLocalAccountsKeyKioskAppId, | 209 kAccountsPrefDeviceLocalAccountsKeyKioskAppId, |
209 "app_1"); | 210 "app_1"); |
210 device_local_accounts.Append(entry.release()); | 211 device_local_accounts.Append(entry.release()); |
211 CrosSettings::Get()->Set(kAccountsPrefDeviceLocalAccounts, | 212 CrosSettings::Get()->Set(kAccountsPrefDeviceLocalAccounts, |
212 device_local_accounts); | 213 device_local_accounts); |
213 | 214 |
214 AppDataLoadWaiter waiter(manager()); | 215 AppDataLoadWaiter waiter(manager()); |
215 waiter.Wait(); | 216 waiter.Wait(); |
216 EXPECT_TRUE(waiter.loaded()); | 217 EXPECT_TRUE(waiter.loaded()); |
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
267 | 268 |
268 base::FilePath expected_icon_path; | 269 base::FilePath expected_icon_path; |
269 ASSERT_TRUE(PathService::Get(chrome::DIR_USER_DATA, &expected_icon_path)); | 270 ASSERT_TRUE(PathService::Get(chrome::DIR_USER_DATA, &expected_icon_path)); |
270 expected_icon_path = expected_icon_path. | 271 expected_icon_path = expected_icon_path. |
271 AppendASCII(KioskAppManager::kIconCacheDir). | 272 AppendASCII(KioskAppManager::kIconCacheDir). |
272 AppendASCII(apps[0].id).AddExtension(".png"); | 273 AppendASCII(apps[0].id).AddExtension(".png"); |
273 EXPECT_EQ(expected_icon_path.value(), icon_path_string); | 274 EXPECT_EQ(expected_icon_path.value(), icon_path_string); |
274 } | 275 } |
275 | 276 |
276 } // namespace chromeos | 277 } // namespace chromeos |
OLD | NEW |