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

Side by Side Diff: chrome/browser/ui/ash/launcher/chrome_launcher_controller_impl_unittest.cc

Issue 2655553002: [Merge M57] Fix import legacy, pref based pins. (Closed)
Patch Set: Created 3 years, 11 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
« no previous file with comments | « chrome/browser/ui/ash/launcher/chrome_launcher_controller_impl.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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/ui/ash/launcher/chrome_launcher_controller_impl.h" 5 #include "chrome/browser/ui/ash/launcher/chrome_launcher_controller_impl.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 8
9 #include <algorithm> 9 #include <algorithm>
10 #include <map> 10 #include <map>
(...skipping 13 matching lines...) Expand all
24 #include "ash/common/wm/maximize_mode/maximize_mode_controller.h" 24 #include "ash/common/wm/maximize_mode/maximize_mode_controller.h"
25 #include "ash/common/wm_shell.h" 25 #include "ash/common/wm_shell.h"
26 #include "ash/display/screen_orientation_controller_chromeos.h" 26 #include "ash/display/screen_orientation_controller_chromeos.h"
27 #include "ash/shell.h" 27 #include "ash/shell.h"
28 #include "ash/test/ash_test_helper.h" 28 #include "ash/test/ash_test_helper.h"
29 #include "ash/test/test_shell_delegate.h" 29 #include "ash/test/test_shell_delegate.h"
30 #include "ash/wm/window_util.h" 30 #include "ash/wm/window_util.h"
31 #include "base/command_line.h" 31 #include "base/command_line.h"
32 #include "base/compiler_specific.h" 32 #include "base/compiler_specific.h"
33 #include "base/files/file_path.h" 33 #include "base/files/file_path.h"
34 #include "base/json/json_string_value_serializer.h"
34 #include "base/location.h" 35 #include "base/location.h"
35 #include "base/macros.h" 36 #include "base/macros.h"
36 #include "base/memory/ptr_util.h" 37 #include "base/memory/ptr_util.h"
37 #include "base/run_loop.h" 38 #include "base/run_loop.h"
38 #include "base/single_thread_task_runner.h" 39 #include "base/single_thread_task_runner.h"
39 #include "base/strings/utf_string_conversions.h" 40 #include "base/strings/utf_string_conversions.h"
40 #include "base/values.h" 41 #include "base/values.h"
41 #include "build/build_config.h" 42 #include "build/build_config.h"
42 #include "chrome/browser/chromeos/arc/arc_support_host.h" 43 #include "chrome/browser/chromeos/arc/arc_support_host.h"
43 #include "chrome/browser/chromeos/login/users/fake_chrome_user_manager.h" 44 #include "chrome/browser/chromeos/login/users/fake_chrome_user_manager.h"
44 #include "chrome/browser/chromeos/login/users/scoped_user_manager_enabler.h" 45 #include "chrome/browser/chromeos/login/users/scoped_user_manager_enabler.h"
45 #include "chrome/browser/chromeos/login/users/wallpaper/wallpaper_manager.h" 46 #include "chrome/browser/chromeos/login/users/wallpaper/wallpaper_manager.h"
46 #include "chrome/browser/extensions/extension_service.h" 47 #include "chrome/browser/extensions/extension_service.h"
47 #include "chrome/browser/extensions/test_extension_system.h" 48 #include "chrome/browser/extensions/test_extension_system.h"
48 #include "chrome/browser/lifetime/scoped_keep_alive.h" 49 #include "chrome/browser/lifetime/scoped_keep_alive.h"
50 #include "chrome/browser/prefs/browser_prefs.h"
49 #include "chrome/browser/ui/app_list/app_list_syncable_service_factory.h" 51 #include "chrome/browser/ui/app_list/app_list_syncable_service_factory.h"
50 #include "chrome/browser/ui/app_list/arc/arc_app_list_prefs.h" 52 #include "chrome/browser/ui/app_list/arc/arc_app_list_prefs.h"
51 #include "chrome/browser/ui/app_list/arc/arc_app_test.h" 53 #include "chrome/browser/ui/app_list/arc/arc_app_test.h"
52 #include "chrome/browser/ui/app_list/arc/arc_app_utils.h" 54 #include "chrome/browser/ui/app_list/arc/arc_app_utils.h"
53 #include "chrome/browser/ui/app_list/arc/arc_default_app_list.h" 55 #include "chrome/browser/ui/app_list/arc/arc_default_app_list.h"
54 #include "chrome/browser/ui/apps/chrome_app_delegate.h" 56 #include "chrome/browser/ui/apps/chrome_app_delegate.h"
55 #include "chrome/browser/ui/ash/chrome_launcher_prefs.h" 57 #include "chrome/browser/ui/ash/chrome_launcher_prefs.h"
56 #include "chrome/browser/ui/ash/launcher/app_window_launcher_controller.h" 58 #include "chrome/browser/ui/ash/launcher/app_window_launcher_controller.h"
57 #include "chrome/browser/ui/ash/launcher/arc_app_deferred_launcher_controller.h" 59 #include "chrome/browser/ui/ash/launcher/arc_app_deferred_launcher_controller.h"
58 #include "chrome/browser/ui/ash/launcher/browser_status_monitor.h" 60 #include "chrome/browser/ui/ash/launcher/browser_status_monitor.h"
(...skipping 17 matching lines...) Expand all
76 #include "chrome/common/pref_names.h" 78 #include "chrome/common/pref_names.h"
77 #include "chrome/test/base/browser_with_test_window_test.h" 79 #include "chrome/test/base/browser_with_test_window_test.h"
78 #include "chrome/test/base/test_browser_window_aura.h" 80 #include "chrome/test/base/test_browser_window_aura.h"
79 #include "chrome/test/base/testing_browser_process.h" 81 #include "chrome/test/base/testing_browser_process.h"
80 #include "chrome/test/base/testing_profile.h" 82 #include "chrome/test/base/testing_profile.h"
81 #include "chrome/test/base/testing_profile_manager.h" 83 #include "chrome/test/base/testing_profile_manager.h"
82 #include "chromeos/chromeos_switches.h" 84 #include "chromeos/chromeos_switches.h"
83 #include "components/arc/common/app.mojom.h" 85 #include "components/arc/common/app.mojom.h"
84 #include "components/arc/test/fake_app_instance.h" 86 #include "components/arc/test/fake_app_instance.h"
85 #include "components/exo/shell_surface.h" 87 #include "components/exo/shell_surface.h"
88 #include "components/prefs/pref_notifier_impl.h"
86 #include "components/signin/core/account_id/account_id.h" 89 #include "components/signin/core/account_id/account_id.h"
90 #include "components/sync/model/attachments/attachment_service_proxy_for_test.h"
87 #include "components/sync/model/fake_sync_change_processor.h" 91 #include "components/sync/model/fake_sync_change_processor.h"
88 #include "components/sync/model/sync_error_factory_mock.h" 92 #include "components/sync/model/sync_error_factory_mock.h"
89 #include "components/sync/protocol/sync.pb.h" 93 #include "components/sync/protocol/sync.pb.h"
94 #include "components/sync_preferences/pref_model_associator.h"
90 #include "components/sync_preferences/testing_pref_service_syncable.h" 95 #include "components/sync_preferences/testing_pref_service_syncable.h"
91 #include "components/user_manager/fake_user_manager.h" 96 #include "components/user_manager/fake_user_manager.h"
92 #include "content/public/browser/web_contents.h" 97 #include "content/public/browser/web_contents.h"
93 #include "content/public/browser/web_contents_observer.h" 98 #include "content/public/browser/web_contents_observer.h"
94 #include "content/public/test/test_utils.h" 99 #include "content/public/test/test_utils.h"
95 #include "content/public/test/web_contents_tester.h" 100 #include "content/public/test/web_contents_tester.h"
96 #include "extensions/browser/app_window/app_window_contents.h" 101 #include "extensions/browser/app_window/app_window_contents.h"
97 #include "extensions/browser/app_window/app_window_registry.h" 102 #include "extensions/browser/app_window/app_window_registry.h"
98 #include "extensions/browser/app_window/native_app_window.h" 103 #include "extensions/browser/app_window/native_app_window.h"
99 #include "extensions/common/extension.h" 104 #include "extensions/common/extension.h"
(...skipping 244 matching lines...) Expand 10 before | Expand all | Expand 10 after
344 // Wait until |extension_system| is signaled as started. 349 // Wait until |extension_system| is signaled as started.
345 base::RunLoop run_loop; 350 base::RunLoop run_loop;
346 extension_system->ready().Post(FROM_HERE, run_loop.QuitClosure()); 351 extension_system->ready().Post(FROM_HERE, run_loop.QuitClosure());
347 run_loop.Run(); 352 run_loop.Run();
348 353
349 app_service_ = 354 app_service_ =
350 app_list::AppListSyncableServiceFactory::GetForProfile(profile()); 355 app_list::AppListSyncableServiceFactory::GetForProfile(profile());
351 StartAppSyncService(syncer::SyncDataList()); 356 StartAppSyncService(syncer::SyncDataList());
352 357
353 std::string error; 358 std::string error;
359 extension_chrome_ = Extension::Create(base::FilePath(), Manifest::UNPACKED,
360 manifest, Extension::NO_FLAGS,
361 extension_misc::kChromeAppId, &error);
354 extension1_ = Extension::Create(base::FilePath(), Manifest::UNPACKED, 362 extension1_ = Extension::Create(base::FilePath(), Manifest::UNPACKED,
355 manifest, Extension::NO_FLAGS, 363 manifest, Extension::NO_FLAGS,
356 "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa", &error); 364 "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa", &error);
357 extension2_ = Extension::Create(base::FilePath(), Manifest::UNPACKED, 365 extension2_ = Extension::Create(base::FilePath(), Manifest::UNPACKED,
358 manifest, Extension::NO_FLAGS, 366 manifest, Extension::NO_FLAGS,
359 "bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb", &error); 367 "bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb", &error);
360 // Fake gmail extension. 368 // Fake gmail extension.
361 base::DictionaryValue manifest_gmail; 369 base::DictionaryValue manifest_gmail;
362 manifest_gmail.SetString(extensions::manifest_keys::kName, 370 manifest_gmail.SetString(extensions::manifest_keys::kName,
363 "Gmail launcher controller test extension"); 371 "Gmail launcher controller test extension");
(...skipping 25 matching lines...) Expand all
389 "eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee", &error); 397 "eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee", &error);
390 extension8_ = Extension::Create(base::FilePath(), Manifest::UNPACKED, 398 extension8_ = Extension::Create(base::FilePath(), Manifest::UNPACKED,
391 manifest, Extension::NO_FLAGS, 399 manifest, Extension::NO_FLAGS,
392 "ffffffffffffffffffffffffffffffff", &error); 400 "ffffffffffffffffffffffffffffffff", &error);
393 extension_platform_app_ = Extension::Create( 401 extension_platform_app_ = Extension::Create(
394 base::FilePath(), Manifest::UNPACKED, manifest_platform_app, 402 base::FilePath(), Manifest::UNPACKED, manifest_platform_app,
395 Extension::NO_FLAGS, "gggggggggggggggggggggggggggggggg", &error); 403 Extension::NO_FLAGS, "gggggggggggggggggggggggggggggggg", &error);
396 arc_support_host_ = Extension::Create(base::FilePath(), Manifest::UNPACKED, 404 arc_support_host_ = Extension::Create(base::FilePath(), Manifest::UNPACKED,
397 manifest, Extension::NO_FLAGS, 405 manifest, Extension::NO_FLAGS,
398 ArcSupportHost::kHostAppId, &error); 406 ArcSupportHost::kHostAppId, &error);
407 extension_service_->AddExtension(extension_chrome_.get());
399 } 408 }
400 409
401 // Creates a running platform V2 app (not pinned) of type |app_id|. 410 // Creates a running platform V2 app (not pinned) of type |app_id|.
402 virtual void CreateRunningV2App(const std::string& app_id) { 411 virtual void CreateRunningV2App(const std::string& app_id) {
403 DCHECK(!test_controller_); 412 DCHECK(!test_controller_);
404 ash::ShelfID id = 413 ash::ShelfID id =
405 launcher_controller_->CreateAppShortcutLauncherItemWithType( 414 launcher_controller_->CreateAppShortcutLauncherItemWithType(
406 ash::launcher::AppLauncherId(app_id), model_->item_count(), 415 ash::launcher::AppLauncherId(app_id), model_->item_count(),
407 ash::TYPE_APP); 416 ash::TYPE_APP);
408 DCHECK(id); 417 DCHECK(id);
(...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after
509 void StartAppSyncService(const syncer::SyncDataList& init_sync_list) { 518 void StartAppSyncService(const syncer::SyncDataList& init_sync_list) {
510 app_service_->MergeDataAndStartSyncing( 519 app_service_->MergeDataAndStartSyncing(
511 syncer::APP_LIST, init_sync_list, 520 syncer::APP_LIST, init_sync_list,
512 base::MakeUnique<syncer::FakeSyncChangeProcessor>(), 521 base::MakeUnique<syncer::FakeSyncChangeProcessor>(),
513 base::MakeUnique<syncer::SyncErrorFactoryMock>()); 522 base::MakeUnique<syncer::SyncErrorFactoryMock>());
514 EXPECT_EQ(init_sync_list.size(), app_service_->sync_items().size()); 523 EXPECT_EQ(init_sync_list.size(), app_service_->sync_items().size());
515 } 524 }
516 525
517 void StopAppSyncService() { app_service_->StopSyncing(syncer::APP_LIST); } 526 void StopAppSyncService() { app_service_->StopSyncing(syncer::APP_LIST); }
518 527
528 sync_preferences::PrefModelAssociator* GetPrefSyncService() {
529 sync_preferences::PrefServiceSyncable* pref_sync =
530 profile()->GetTestingPrefService();
531 sync_preferences::PrefModelAssociator* pref_sync_service =
532 reinterpret_cast<sync_preferences::PrefModelAssociator*>(
533 pref_sync->GetSyncableService(syncer::PREFERENCES));
534 return pref_sync_service;
535 }
536
537 void StartPrefSyncService(const syncer::SyncDataList& init_sync_list) {
538 syncer::SyncMergeResult r = GetPrefSyncService()->MergeDataAndStartSyncing(
539 syncer::PREFERENCES, init_sync_list,
540 base::MakeUnique<syncer::FakeSyncChangeProcessor>(),
541 base::MakeUnique<syncer::SyncErrorFactoryMock>());
542 EXPECT_FALSE(r.error().IsSet());
543 }
544
545 void StartPrefSyncServiceForPins(const base::ListValue& init_value) {
546 syncer::SyncDataList init_sync_list;
547 std::string serialized;
548 JSONStringValueSerializer json(&serialized);
549 json.Serialize(init_value);
550 sync_pb::EntitySpecifics one;
551 sync_pb::PreferenceSpecifics* pref_one = one.mutable_preference();
552 pref_one->set_name(prefs::kPinnedLauncherApps);
553 pref_one->set_value(serialized);
554 init_sync_list.push_back(syncer::SyncData::CreateRemoteData(
555 1, one, base::Time(), syncer::AttachmentIdList(),
556 syncer::AttachmentServiceProxyForTest::Create()));
557 StartPrefSyncService(init_sync_list);
558 }
559
560 void StopPrefSyncService() {
561 GetPrefSyncService()->StopSyncing(syncer::PREFERENCES);
562 }
563
519 void SetAppIconLoader(std::unique_ptr<AppIconLoader> loader) { 564 void SetAppIconLoader(std::unique_ptr<AppIconLoader> loader) {
520 std::vector<std::unique_ptr<AppIconLoader>> loaders; 565 std::vector<std::unique_ptr<AppIconLoader>> loaders;
521 loaders.push_back(std::move(loader)); 566 loaders.push_back(std::move(loader));
522 launcher_controller_->SetAppIconLoadersForTest(loaders); 567 launcher_controller_->SetAppIconLoadersForTest(loaders);
523 } 568 }
524 569
525 void SetAppIconLoaders(std::unique_ptr<AppIconLoader> loader1, 570 void SetAppIconLoaders(std::unique_ptr<AppIconLoader> loader1,
526 std::unique_ptr<AppIconLoader> loader2) { 571 std::unique_ptr<AppIconLoader> loader2) {
527 std::vector<std::unique_ptr<AppIconLoader>> loaders; 572 std::vector<std::unique_ptr<AppIconLoader>> loaders;
528 loaders.push_back(std::move(loader1)); 573 loaders.push_back(std::move(loader1));
(...skipping 331 matching lines...) Expand 10 before | Expand all | Expand 10 after
860 appinfo.name, std::string()); 905 appinfo.name, std::string());
861 } 906 }
862 907
863 void NotifyOnTaskOrientationLockRequested(int32_t task_id, 908 void NotifyOnTaskOrientationLockRequested(int32_t task_id,
864 OrientationLock lock) { 909 OrientationLock lock) {
865 ArcAppListPrefs* const prefs = arc_test_.arc_app_list_prefs(); 910 ArcAppListPrefs* const prefs = arc_test_.arc_app_list_prefs();
866 prefs->OnTaskOrientationLockRequested(task_id, lock); 911 prefs->OnTaskOrientationLockRequested(task_id, lock);
867 } 912 }
868 913
869 // Needed for extension service & friends to work. 914 // Needed for extension service & friends to work.
915 scoped_refptr<Extension> extension_chrome_;
870 scoped_refptr<Extension> extension1_; 916 scoped_refptr<Extension> extension1_;
871 scoped_refptr<Extension> extension2_; 917 scoped_refptr<Extension> extension2_;
872 scoped_refptr<Extension> extension3_; 918 scoped_refptr<Extension> extension3_;
873 scoped_refptr<Extension> extension4_; 919 scoped_refptr<Extension> extension4_;
874 scoped_refptr<Extension> extension5_; 920 scoped_refptr<Extension> extension5_;
875 scoped_refptr<Extension> extension6_; 921 scoped_refptr<Extension> extension6_;
876 scoped_refptr<Extension> extension7_; 922 scoped_refptr<Extension> extension7_;
877 scoped_refptr<Extension> extension8_; 923 scoped_refptr<Extension> extension8_;
878 scoped_refptr<Extension> extension_platform_app_; 924 scoped_refptr<Extension> extension_platform_app_;
879 scoped_refptr<Extension> arc_support_host_; 925 scoped_refptr<Extension> arc_support_host_;
(...skipping 1772 matching lines...) Expand 10 before | Expand all | Expand 10 after
2652 sync_list.clear(); 2698 sync_list.clear();
2653 InsertRemovePinChange(&sync_list, extension3_->id()); 2699 InsertRemovePinChange(&sync_list, extension3_->id());
2654 InsertRemovePinChange(&sync_list, extension2_->id()); 2700 InsertRemovePinChange(&sync_list, extension2_->id());
2655 SendPinChanges(sync_list, false); 2701 SendPinChanges(sync_list, false);
2656 expected_launchers.clear(); 2702 expected_launchers.clear();
2657 GetAppLaunchers(launcher_controller_.get(), &actual_launchers); 2703 GetAppLaunchers(launcher_controller_.get(), &actual_launchers);
2658 EXPECT_EQ(expected_launchers, actual_launchers); 2704 EXPECT_EQ(expected_launchers, actual_launchers);
2659 } 2705 }
2660 2706
2661 TEST_F(ChromeLauncherControllerImplTest, ImportLegacyPin) { 2707 TEST_F(ChromeLauncherControllerImplTest, ImportLegacyPin) {
2708 // Note extension3_ is actually Gmail app which is default pinned.
2709 extension_service_->AddExtension(extension3_.get());
2710 InitLauncherController();
2711
2712 // Default pins should contain Gmail. Pref is not syncing now.
2713 EXPECT_EQ("AppList, Chrome, App3", GetPinnedAppStatus());
2714
2662 extension_service_->AddExtension(extension2_.get()); 2715 extension_service_->AddExtension(extension2_.get());
2663 extension_service_->AddExtension(extension3_.get()); 2716 EXPECT_EQ("AppList, Chrome, App3", GetPinnedAppStatus());
2664 extension_service_->AddExtension(extension4_.get());
2665 2717
2666 // Initially pins are imported from legacy pref based model. 2718 // Initially pins are imported from legacy pref based model.
2667 base::ListValue value; 2719 base::ListValue value;
2668 InsertPrefValue(&value, 0, extension4_->id()); 2720 InsertPrefValue(&value, 0, extension4_->id());
2669 InsertPrefValue(&value, 1, extension2_->id()); 2721 InsertPrefValue(&value, 1, extension2_->id());
2670 profile()->GetTestingPrefService()->SetManagedPref(prefs::kPinnedLauncherApps, 2722 InsertPrefValue(&value, 2, extension3_->id());
2671 value.DeepCopy()); 2723 StartPrefSyncServiceForPins(value);
2672 2724
2673 InitLauncherController(); 2725 // Imported pins contain App2. App2 should be added to pins now.
2726 EXPECT_EQ("AppList, Chrome, App2, App3", GetPinnedAppStatus());
2674 2727
2675 EXPECT_EQ("AppList, Chrome, App4, App2", GetPinnedAppStatus()); 2728 // extension4_ is in the pin list.
2729 extension_service_->AddExtension(extension4_.get());
2730 // extension5_ is not in the pin list.
2731 extension_service_->AddExtension(extension5_.get());
2732 EXPECT_EQ("AppList, Chrome, App4, App2, App3", GetPinnedAppStatus());
2733
2734 // Apply app sync, unpin one app and pin new one.
2735 syncer::SyncChangeList sync_list;
2736 InsertAddPinChange(&sync_list, -1, extension3_->id());
2737 InsertAddPinChange(&sync_list, 3, extension5_->id());
2738 SendPinChanges(sync_list, false);
2739 EXPECT_EQ("AppList, Chrome, App4, App2, App5", GetPinnedAppStatus());
2676 2740
2677 // At this point changing old pref based model does not affect pin model. 2741 // At this point changing old pref based model does not affect pin model.
2678 InsertPrefValue(&value, 2, extension3_->id()); 2742 InsertPrefValue(&value, 3, extension5_->id());
2679 profile()->GetTestingPrefService()->SetManagedPref(prefs::kPinnedLauncherApps, 2743 StopPrefSyncService();
2680 value.DeepCopy()); 2744 StartPrefSyncServiceForPins(value);
2681 EXPECT_EQ("AppList, Chrome, App4, App2", GetPinnedAppStatus()); 2745 EXPECT_EQ("AppList, Chrome, App4, App2, App5", GetPinnedAppStatus());
2746
2747 // Next Chrome start should preserve pins.
2682 RecreateChromeLauncher(); 2748 RecreateChromeLauncher();
2683 EXPECT_EQ("AppList, Chrome, App4, App2", GetPinnedAppStatus()); 2749 StopPrefSyncService();
2750 StartPrefSyncService(syncer::SyncDataList());
2751 EXPECT_EQ("AppList, Chrome, App4, App2, App5", GetPinnedAppStatus());
2684 } 2752 }
2685 2753
2686 TEST_F(ChromeLauncherControllerImplTest, PendingInsertionOrder) { 2754 TEST_F(ChromeLauncherControllerImplTest, PendingInsertionOrder) {
2687 extension_service_->AddExtension(extension1_.get()); 2755 extension_service_->AddExtension(extension1_.get());
2688 extension_service_->AddExtension(extension3_.get()); 2756 extension_service_->AddExtension(extension3_.get());
2689 2757
2690 InitLauncherController(); 2758 InitLauncherController();
2691 2759
2692 syncer::SyncChangeList sync_list; 2760 syncer::SyncChangeList sync_list;
2693 InsertAddPinChange(&sync_list, 0, extension1_->id()); 2761 InsertAddPinChange(&sync_list, 0, extension1_->id());
(...skipping 888 matching lines...) Expand 10 before | Expand all | Expand 10 after
3582 EXPECT_EQ(AppListControllerDelegate::PIN_FIXED, 3650 EXPECT_EQ(AppListControllerDelegate::PIN_FIXED,
3583 GetPinnableForAppID(app_id, profile())); 3651 GetPinnableForAppID(app_id, profile()));
3584 } 3652 }
3585 3653
3586 TEST_F(ChromeLauncherControllerImplWithArcTest, ArcManaged) { 3654 TEST_F(ChromeLauncherControllerImplWithArcTest, ArcManaged) {
3587 extension_service_->AddExtension(arc_support_host_.get()); 3655 extension_service_->AddExtension(arc_support_host_.get());
3588 // Test enables Arc, so turn it off for initial values. 3656 // Test enables Arc, so turn it off for initial values.
3589 EnableArc(false); 3657 EnableArc(false);
3590 3658
3591 InitLauncherController(); 3659 InitLauncherController();
3660
3661 // To prevent import legacy pins each time.
3662 // Initially pins are imported from legacy pref based model.
3663 StartPrefSyncService(syncer::SyncDataList());
3664
3592 arc::ArcSessionManager::SetShelfDelegateForTesting( 3665 arc::ArcSessionManager::SetShelfDelegateForTesting(
3593 launcher_controller_.get()); 3666 launcher_controller_.get());
3594 3667
3595 // Initial run, Arc is not managed and disabled, Play Store pin should be 3668 // Initial run, Arc is not managed and disabled, Play Store pin should be
3596 // available. 3669 // available.
3597 ValidateArcState(false, false, arc::ArcSessionManager::State::STOPPED, 3670 ValidateArcState(false, false, arc::ArcSessionManager::State::STOPPED,
3598 "AppList, Chrome, Play Store"); 3671 "AppList, Chrome, Play Store");
3599 3672
3600 // Arc is managed and enabled, Play Store pin should be available. 3673 // Arc is managed and enabled, Play Store pin should be available.
3601 // Note: SHOWING_TERMS_OF_SERVICE here means that opt-in flow starts. 3674 // Note: SHOWING_TERMS_OF_SERVICE here means that opt-in flow starts.
(...skipping 461 matching lines...) Expand 10 before | Expand all | Expand 10 after
4063 4136
4064 // Pinned state should not change. 4137 // Pinned state should not change.
4065 EXPECT_EQ("AppList, Chrome, App1, App2", GetPinnedAppStatus()); 4138 EXPECT_EQ("AppList, Chrome, App1, App2", GetPinnedAppStatus());
4066 launcher_controller_->UnpinAppWithID(extension2_->id()); 4139 launcher_controller_->UnpinAppWithID(extension2_->id());
4067 EXPECT_EQ("AppList, Chrome, App1", GetPinnedAppStatus()); 4140 EXPECT_EQ("AppList, Chrome, App1", GetPinnedAppStatus());
4068 4141
4069 // Resume syncing and sync information overrides local copy. 4142 // Resume syncing and sync information overrides local copy.
4070 StartAppSyncService(copy_sync_list); 4143 StartAppSyncService(copy_sync_list);
4071 EXPECT_EQ("AppList, Chrome, App1, App2", GetPinnedAppStatus()); 4144 EXPECT_EQ("AppList, Chrome, App1, App2", GetPinnedAppStatus());
4072 } 4145 }
OLDNEW
« no previous file with comments | « chrome/browser/ui/ash/launcher/chrome_launcher_controller_impl.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698