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

Side by Side Diff: chrome/browser/sync/test/integration/two_client_apps_sync_test.cc

Issue 1419823011: app_sorting() calls should go via ExtensionSystem intsead of prefs. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 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
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 "base/basictypes.h" 5 #include "base/basictypes.h"
6 #include "base/strings/utf_string_conversions.h" 6 #include "base/strings/utf_string_conversions.h"
7 #include "chrome/browser/chrome_notification_types.h" 7 #include "chrome/browser/chrome_notification_types.h"
8 #include "chrome/browser/extensions/bookmark_app_helper.h" 8 #include "chrome/browser/extensions/bookmark_app_helper.h"
9 #include "chrome/browser/extensions/extension_service.h" 9 #include "chrome/browser/extensions/extension_service.h"
10 #include "chrome/browser/extensions/extension_sync_data.h" 10 #include "chrome/browser/extensions/extension_sync_data.h"
11 #include "chrome/browser/extensions/extension_sync_service.h" 11 #include "chrome/browser/extensions/extension_sync_service.h"
12 #include "chrome/browser/extensions/launch_util.h" 12 #include "chrome/browser/extensions/launch_util.h"
13 #include "chrome/browser/profiles/profile.h" 13 #include "chrome/browser/profiles/profile.h"
14 #include "chrome/browser/sync/test/integration/apps_helper.h" 14 #include "chrome/browser/sync/test/integration/apps_helper.h"
15 #include "chrome/browser/sync/test/integration/profile_sync_service_harness.h" 15 #include "chrome/browser/sync/test/integration/profile_sync_service_harness.h"
16 #include "chrome/browser/sync/test/integration/sync_app_helper.h" 16 #include "chrome/browser/sync/test/integration/sync_app_helper.h"
17 #include "chrome/browser/sync/test/integration/sync_integration_test_util.h" 17 #include "chrome/browser/sync/test/integration/sync_integration_test_util.h"
18 #include "chrome/browser/sync/test/integration/sync_test.h" 18 #include "chrome/browser/sync/test/integration/sync_test.h"
19 #include "content/public/browser/notification_service.h" 19 #include "content/public/browser/notification_service.h"
20 #include "content/public/test/test_utils.h" 20 #include "content/public/test/test_utils.h"
21 #include "extensions/browser/app_sorting.h" 21 #include "extensions/browser/app_sorting.h"
22 #include "extensions/browser/extension_prefs.h" 22 #include "extensions/browser/extension_prefs.h"
benwells 2015/11/06 01:04:38 Nit: is this include still needed?
Deepak 2015/11/06 06:13:47 Done.
23 #include "extensions/browser/extension_registry.h" 23 #include "extensions/browser/extension_registry.h"
24 #include "extensions/browser/extension_system.h" 24 #include "extensions/browser/extension_system.h"
25 #include "extensions/common/constants.h" 25 #include "extensions/common/constants.h"
26 #include "sync/api/string_ordinal.h" 26 #include "sync/api/string_ordinal.h"
27 27
28 using apps_helper::AllProfilesHaveSameAppsAsVerifier; 28 using apps_helper::AllProfilesHaveSameAppsAsVerifier;
29 using apps_helper::CopyNTPOrdinals; 29 using apps_helper::CopyNTPOrdinals;
30 using apps_helper::DisableApp; 30 using apps_helper::DisableApp;
31 using apps_helper::EnableApp; 31 using apps_helper::EnableApp;
32 using apps_helper::FixNTPOrdinalCollisions; 32 using apps_helper::FixNTPOrdinalCollisions;
(...skipping 294 matching lines...) Expand 10 before | Expand all | Expand 10 after
327 327
328 // Adjust the CWS location within a page on the first client and sync. Adjust 328 // Adjust the CWS location within a page on the first client and sync. Adjust
329 // which page the CWS appears on and sync. Both clients should have the same 329 // which page the CWS appears on and sync. Both clients should have the same
330 // page and app launch ordinal values for the CWS. 330 // page and app launch ordinal values for the CWS.
331 IN_PROC_BROWSER_TEST_F(TwoClientAppsSyncTest, UpdateCWSOrdinals) { 331 IN_PROC_BROWSER_TEST_F(TwoClientAppsSyncTest, UpdateCWSOrdinals) {
332 ASSERT_TRUE(SetupSync()); 332 ASSERT_TRUE(SetupSync());
333 ASSERT_TRUE(AllProfilesHaveSameAppsAsVerifier()); 333 ASSERT_TRUE(AllProfilesHaveSameAppsAsVerifier());
334 334
335 // Change the app launch ordinal. 335 // Change the app launch ordinal.
336 syncer::StringOrdinal cws_app_launch_ordinal = 336 syncer::StringOrdinal cws_app_launch_ordinal =
337 extensions::ExtensionPrefs::Get(GetProfile(0)) 337 extensions::ExtensionSystem::Get(GetProfile(0))
338 ->app_sorting() 338 ->app_sorting()
339 ->GetAppLaunchOrdinal(extensions::kWebStoreAppId); 339 ->GetAppLaunchOrdinal(extensions::kWebStoreAppId);
340 extensions::ExtensionPrefs::Get(GetProfile(0)) 340 extensions::ExtensionSystem::Get(GetProfile(0))
341 ->app_sorting() 341 ->app_sorting()
342 ->SetAppLaunchOrdinal(extensions::kWebStoreAppId, 342 ->SetAppLaunchOrdinal(extensions::kWebStoreAppId,
343 cws_app_launch_ordinal.CreateAfter()); 343 cws_app_launch_ordinal.CreateAfter());
344 extensions::ExtensionPrefs::Get(verifier()) 344 extensions::ExtensionSystem::Get(verifier())
345 ->app_sorting() 345 ->app_sorting()
346 ->SetAppLaunchOrdinal(extensions::kWebStoreAppId, 346 ->SetAppLaunchOrdinal(extensions::kWebStoreAppId,
347 cws_app_launch_ordinal.CreateAfter()); 347 cws_app_launch_ordinal.CreateAfter());
348 ASSERT_TRUE(AwaitAllProfilesHaveSameApps()); 348 ASSERT_TRUE(AwaitAllProfilesHaveSameApps());
349 349
350 // Change the page ordinal. 350 // Change the page ordinal.
351 syncer::StringOrdinal cws_page_ordinal = 351 syncer::StringOrdinal cws_page_ordinal =
352 extensions::ExtensionPrefs::Get(GetProfile(1)) 352 extensions::ExtensionSystem::Get(GetProfile(1))
353 ->app_sorting() 353 ->app_sorting()
354 ->GetPageOrdinal(extensions::kWebStoreAppId); 354 ->GetPageOrdinal(extensions::kWebStoreAppId);
355 extensions::ExtensionPrefs::Get(GetProfile(1))->app_sorting()->SetPageOrdinal( 355 extensions::ExtensionSystem::Get(GetProfile(1))
356 extensions::kWebStoreAppId, cws_page_ordinal.CreateAfter()); 356 ->app_sorting()
357 extensions::ExtensionPrefs::Get(verifier())->app_sorting()->SetPageOrdinal( 357 ->SetPageOrdinal(extensions::kWebStoreAppId,
358 extensions::kWebStoreAppId, cws_page_ordinal.CreateAfter()); 358 cws_page_ordinal.CreateAfter());
359 extensions::ExtensionSystem::Get(verifier())
360 ->app_sorting()
361 ->SetPageOrdinal(extensions::kWebStoreAppId,
362 cws_page_ordinal.CreateAfter());
359 ASSERT_TRUE(AwaitAllProfilesHaveSameApps()); 363 ASSERT_TRUE(AwaitAllProfilesHaveSameApps());
360 } 364 }
361 365
362 // Adjust the launch type on the first client and sync. Both clients should 366 // Adjust the launch type on the first client and sync. Both clients should
363 // have the same launch type values for the CWS. 367 // have the same launch type values for the CWS.
364 IN_PROC_BROWSER_TEST_F(TwoClientAppsSyncTest, UpdateLaunchType) { 368 IN_PROC_BROWSER_TEST_F(TwoClientAppsSyncTest, UpdateLaunchType) {
365 ASSERT_TRUE(SetupSync()); 369 ASSERT_TRUE(SetupSync());
366 ASSERT_TRUE(AllProfilesHaveSameAppsAsVerifier()); 370 ASSERT_TRUE(AllProfilesHaveSameAppsAsVerifier());
367 371
368 // Change the launch type to window. 372 // Change the launch type to window.
(...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after
459 content::WindowedNotificationObserver windowed_observer( 463 content::WindowedNotificationObserver windowed_observer(
460 extensions::NOTIFICATION_CRX_INSTALLER_DONE, 464 extensions::NOTIFICATION_CRX_INSTALLER_DONE,
461 base::Bind(&AllProfilesHaveSameAppsAsVerifier)); 465 base::Bind(&AllProfilesHaveSameAppsAsVerifier));
462 windowed_observer.Wait(); 466 windowed_observer.Wait();
463 } 467 }
464 } 468 }
465 469
466 // TODO(akalin): Add tests exercising: 470 // TODO(akalin): Add tests exercising:
467 // - Offline installation/uninstallation behavior 471 // - Offline installation/uninstallation behavior
468 // - App-specific properties 472 // - App-specific properties
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698