Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(222)

Side by Side Diff: chrome/browser/chromeos/app_mode/kiosk_app_manager_browsertest.cc

Issue 2778053002: Fetch ARC Kiosk app name and icon from Android side. (Closed)
Patch Set: some nits Created 3 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 <stddef.h> 7 #include <stddef.h>
8 8
9 #include <memory> 9 #include <memory>
10 #include <utility> 10 #include <utility>
(...skipping 307 matching lines...) Expand 10 before | Expand all | Expand 10 after
318 318
319 std::unique_ptr<base::DictionaryValue> apps_dict(new base::DictionaryValue); 319 std::unique_ptr<base::DictionaryValue> apps_dict(new base::DictionaryValue);
320 apps_dict->SetString(app_id + ".name", app_name); 320 apps_dict->SetString(app_id + ".name", app_name);
321 apps_dict->SetString(app_id + ".icon", icon_path.MaybeAsASCII()); 321 apps_dict->SetString(app_id + ".icon", icon_path.MaybeAsASCII());
322 apps_dict->SetString(app_id + ".required_platform_version", 322 apps_dict->SetString(app_id + ".required_platform_version",
323 required_platform_version); 323 required_platform_version);
324 324
325 PrefService* local_state = g_browser_process->local_state(); 325 PrefService* local_state = g_browser_process->local_state();
326 DictionaryPrefUpdate dict_update(local_state, 326 DictionaryPrefUpdate dict_update(local_state,
327 KioskAppManager::kKioskDictionaryName); 327 KioskAppManager::kKioskDictionaryName);
328 dict_update->Set(KioskAppManager::kKeyApps, std::move(apps_dict)); 328 dict_update->Set(KioskAppDataBase::kKeyApps, std::move(apps_dict));
329 329
330 // Make the app appear in device settings. 330 // Make the app appear in device settings.
331 base::ListValue device_local_accounts; 331 base::ListValue device_local_accounts;
332 std::unique_ptr<base::DictionaryValue> entry(new base::DictionaryValue); 332 std::unique_ptr<base::DictionaryValue> entry(new base::DictionaryValue);
333 // Fake an account id. Note this needs to match GenerateKioskAppAccountId 333 // Fake an account id. Note this needs to match GenerateKioskAppAccountId
334 // in kiosk_app_manager.cc to make SetAutoLaunchApp work with the 334 // in kiosk_app_manager.cc to make SetAutoLaunchApp work with the
335 // existing app entry created here. 335 // existing app entry created here.
336 entry->SetStringWithoutPathExpansion(kAccountsPrefDeviceLocalAccountsKeyId, 336 entry->SetStringWithoutPathExpansion(kAccountsPrefDeviceLocalAccountsKeyId,
337 app_id + "@kiosk-apps"); 337 app_id + "@kiosk-apps");
338 entry->SetIntegerWithoutPathExpansion( 338 entry->SetIntegerWithoutPathExpansion(
(...skipping 196 matching lines...) Expand 10 before | Expand all | Expand 10 after
535 CheckAppData("app_1", "Cached App1 Name", "1234"); 535 CheckAppData("app_1", "Cached App1 Name", "1234");
536 } 536 }
537 537
538 IN_PROC_BROWSER_TEST_F(KioskAppManagerTest, ClearAppData) { 538 IN_PROC_BROWSER_TEST_F(KioskAppManagerTest, ClearAppData) {
539 SetExistingApp("app_1", "Cached App1 Name", "red16x16.png", ""); 539 SetExistingApp("app_1", "Cached App1 Name", "red16x16.png", "");
540 540
541 PrefService* local_state = g_browser_process->local_state(); 541 PrefService* local_state = g_browser_process->local_state();
542 const base::DictionaryValue* dict = 542 const base::DictionaryValue* dict =
543 local_state->GetDictionary(KioskAppManager::kKioskDictionaryName); 543 local_state->GetDictionary(KioskAppManager::kKioskDictionaryName);
544 const base::DictionaryValue* apps_dict; 544 const base::DictionaryValue* apps_dict;
545 EXPECT_TRUE(dict->GetDictionary(KioskAppManager::kKeyApps, &apps_dict)); 545 EXPECT_TRUE(dict->GetDictionary(KioskAppDataBase::kKeyApps, &apps_dict));
546 EXPECT_TRUE(apps_dict->HasKey("app_1")); 546 EXPECT_TRUE(apps_dict->HasKey("app_1"));
547 547
548 manager()->ClearAppData("app_1"); 548 manager()->ClearAppData("app_1");
549 549
550 EXPECT_FALSE(apps_dict->HasKey("app_1")); 550 EXPECT_FALSE(apps_dict->HasKey("app_1"));
551 } 551 }
552 552
553 IN_PROC_BROWSER_TEST_F(KioskAppManagerTest, UpdateAppDataFromProfile) { 553 IN_PROC_BROWSER_TEST_F(KioskAppManagerTest, UpdateAppDataFromProfile) {
554 SetExistingApp("app_1", "Cached App1 Name", "red16x16.png", ""); 554 SetExistingApp("app_1", "Cached App1 Name", "red16x16.png", "");
555 555
(...skipping 385 matching lines...) Expand 10 before | Expand all | Expand 10 after
941 MakeKioskApp("App Name", "1.0", kNoneAutoLaucnhedAppId, 941 MakeKioskApp("App Name", "1.0", kNoneAutoLaucnhedAppId,
942 kTestCases[i].required_platform_version); 942 kTestCases[i].required_platform_version);
943 EXPECT_TRUE(manager()->IsPlatformCompliantWithApp(app.get())) 943 EXPECT_TRUE(manager()->IsPlatformCompliantWithApp(app.get()))
944 << "Test case for non auto launch app: " << i 944 << "Test case for non auto launch app: " << i
945 << ", required_platform_version=" 945 << ", required_platform_version="
946 << kTestCases[i].required_platform_version; 946 << kTestCases[i].required_platform_version;
947 } 947 }
948 } 948 }
949 949
950 } // namespace chromeos 950 } // namespace chromeos
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698