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

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

Issue 2468413005: Implement local storage for App List in case app sync is off. (Closed)
Patch Set: Created 4 years, 1 month 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/chrome_launcher_prefs.cc ('k') | chrome/common/pref_names.h » ('j') | 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 327 matching lines...) Expand 10 before | Expand all | Expand 10 after
338 extensions::TestExtensionSystem* extension_system( 338 extensions::TestExtensionSystem* extension_system(
339 static_cast<extensions::TestExtensionSystem*>( 339 static_cast<extensions::TestExtensionSystem*>(
340 extensions::ExtensionSystem::Get(profile()))); 340 extensions::ExtensionSystem::Get(profile())));
341 extension_service_ = extension_system->CreateExtensionService( 341 extension_service_ = extension_system->CreateExtensionService(
342 base::CommandLine::ForCurrentProcess(), base::FilePath(), false); 342 base::CommandLine::ForCurrentProcess(), base::FilePath(), false);
343 extension_service_->Init(); 343 extension_service_->Init();
344 344
345 if (auto_start_arc_test_) 345 if (auto_start_arc_test_)
346 arc_test_.SetUp(profile()); 346 arc_test_.SetUp(profile());
347 347
348 // Wait until |extension_system| is signaled as started.
349 base::RunLoop run_loop;
350 extension_system->ready().Post(FROM_HERE, run_loop.QuitClosure());
351 run_loop.Run();
352
348 app_service_ = 353 app_service_ =
349 app_list::AppListSyncableServiceFactory::GetForProfile(profile()); 354 app_list::AppListSyncableServiceFactory::GetForProfile(profile());
350 StartAppSyncService(syncer::SyncDataList()); 355 StartAppSyncService(syncer::SyncDataList());
351 356
352 std::string error; 357 std::string error;
353 extension1_ = Extension::Create(base::FilePath(), Manifest::UNPACKED, 358 extension1_ = Extension::Create(base::FilePath(), Manifest::UNPACKED,
354 manifest, 359 manifest,
355 Extension::NO_FLAGS, 360 Extension::NO_FLAGS,
356 "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa", 361 "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
357 &error); 362 &error);
(...skipping 3649 matching lines...) Expand 10 before | Expand all | Expand 10 after
4007 app_service_->GetPinPosition(extension_misc::kChromeAppId))); 4012 app_service_->GetPinPosition(extension_misc::kChromeAppId)));
4008 EXPECT_TRUE( 4013 EXPECT_TRUE(
4009 position_1.Equals(app_service_->GetPinPosition(extension1_->id()))); 4014 position_1.Equals(app_service_->GetPinPosition(extension1_->id())));
4010 EXPECT_TRUE( 4015 EXPECT_TRUE(
4011 position_1.Equals(app_service_->GetPinPosition(extension1_->id()))); 4016 position_1.Equals(app_service_->GetPinPosition(extension1_->id())));
4012 EXPECT_TRUE( 4017 EXPECT_TRUE(
4013 position_2.Equals(app_service_->GetPinPosition(extension2_->id()))); 4018 position_2.Equals(app_service_->GetPinPosition(extension2_->id())));
4014 EXPECT_TRUE( 4019 EXPECT_TRUE(
4015 position_3.Equals(app_service_->GetPinPosition(extension3_->id()))); 4020 position_3.Equals(app_service_->GetPinPosition(extension3_->id())));
4016 } 4021 }
4022
4023 // Test the case when sync app is turned off and we need to use local copy to
4024 // support user's pins.
4025 TEST_F(ChromeLauncherControllerImplTest, SyncOffLocalUpdate) {
4026 InitLauncherController();
4027
4028 extension_service_->AddExtension(extension1_.get());
4029 extension_service_->AddExtension(extension2_.get());
4030
4031 syncer::SyncChangeList sync_list;
4032 InsertAddPinChange(&sync_list, 0, extension_misc::kChromeAppId);
4033 InsertAddPinChange(&sync_list, 1, extension1_->id());
4034 InsertAddPinChange(&sync_list, 1, extension2_->id());
4035 SendPinChanges(sync_list, true);
4036
4037 EXPECT_EQ("AppList, Chrome, App1, App2", GetPinnedAppStatus());
4038
4039 syncer::SyncDataList copy_sync_list =
4040 app_service_->GetAllSyncData(syncer::APP_LIST);
4041
4042 app_service_->StopSyncing(syncer::APP_LIST);
4043 RecreateChromeLauncher();
4044
4045 // Pinned state should not change.
4046 EXPECT_EQ("AppList, Chrome, App1, App2", GetPinnedAppStatus());
4047 launcher_controller_->UnpinAppWithID(extension2_->id());
4048 EXPECT_EQ("AppList, Chrome, App1", GetPinnedAppStatus());
4049
4050 // Resume syncing and sync information overrides local copy.
4051 StartAppSyncService(copy_sync_list);
4052 EXPECT_EQ("AppList, Chrome, App1, App2", GetPinnedAppStatus());
4053 }
OLDNEW
« no previous file with comments | « chrome/browser/ui/ash/chrome_launcher_prefs.cc ('k') | chrome/common/pref_names.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698