OLD | NEW |
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" | |
23 #include "extensions/browser/extension_registry.h" | 22 #include "extensions/browser/extension_registry.h" |
24 #include "extensions/browser/extension_system.h" | 23 #include "extensions/browser/extension_system.h" |
25 #include "extensions/common/constants.h" | 24 #include "extensions/common/constants.h" |
26 #include "sync/api/string_ordinal.h" | 25 #include "sync/api/string_ordinal.h" |
27 | 26 |
28 using apps_helper::AllProfilesHaveSameAppsAsVerifier; | 27 using apps_helper::AllProfilesHaveSameAppsAsVerifier; |
29 using apps_helper::CopyNTPOrdinals; | 28 using apps_helper::CopyNTPOrdinals; |
30 using apps_helper::DisableApp; | 29 using apps_helper::DisableApp; |
31 using apps_helper::EnableApp; | 30 using apps_helper::EnableApp; |
32 using apps_helper::FixNTPOrdinalCollisions; | 31 using apps_helper::FixNTPOrdinalCollisions; |
(...skipping 294 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
327 | 326 |
328 // Adjust the CWS location within a page on the first client and sync. Adjust | 327 // 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 | 328 // which page the CWS appears on and sync. Both clients should have the same |
330 // page and app launch ordinal values for the CWS. | 329 // page and app launch ordinal values for the CWS. |
331 IN_PROC_BROWSER_TEST_F(TwoClientAppsSyncTest, UpdateCWSOrdinals) { | 330 IN_PROC_BROWSER_TEST_F(TwoClientAppsSyncTest, UpdateCWSOrdinals) { |
332 ASSERT_TRUE(SetupSync()); | 331 ASSERT_TRUE(SetupSync()); |
333 ASSERT_TRUE(AllProfilesHaveSameAppsAsVerifier()); | 332 ASSERT_TRUE(AllProfilesHaveSameAppsAsVerifier()); |
334 | 333 |
335 // Change the app launch ordinal. | 334 // Change the app launch ordinal. |
336 syncer::StringOrdinal cws_app_launch_ordinal = | 335 syncer::StringOrdinal cws_app_launch_ordinal = |
337 extensions::ExtensionPrefs::Get(GetProfile(0)) | 336 extensions::ExtensionSystem::Get(GetProfile(0)) |
338 ->app_sorting() | 337 ->app_sorting() |
339 ->GetAppLaunchOrdinal(extensions::kWebStoreAppId); | 338 ->GetAppLaunchOrdinal(extensions::kWebStoreAppId); |
340 extensions::ExtensionPrefs::Get(GetProfile(0)) | 339 extensions::ExtensionSystem::Get(GetProfile(0)) |
341 ->app_sorting() | 340 ->app_sorting() |
342 ->SetAppLaunchOrdinal(extensions::kWebStoreAppId, | 341 ->SetAppLaunchOrdinal(extensions::kWebStoreAppId, |
343 cws_app_launch_ordinal.CreateAfter()); | 342 cws_app_launch_ordinal.CreateAfter()); |
344 extensions::ExtensionPrefs::Get(verifier()) | 343 extensions::ExtensionSystem::Get(verifier()) |
345 ->app_sorting() | 344 ->app_sorting() |
346 ->SetAppLaunchOrdinal(extensions::kWebStoreAppId, | 345 ->SetAppLaunchOrdinal(extensions::kWebStoreAppId, |
347 cws_app_launch_ordinal.CreateAfter()); | 346 cws_app_launch_ordinal.CreateAfter()); |
348 ASSERT_TRUE(AwaitAllProfilesHaveSameApps()); | 347 ASSERT_TRUE(AwaitAllProfilesHaveSameApps()); |
349 | 348 |
350 // Change the page ordinal. | 349 // Change the page ordinal. |
351 syncer::StringOrdinal cws_page_ordinal = | 350 syncer::StringOrdinal cws_page_ordinal = |
352 extensions::ExtensionPrefs::Get(GetProfile(1)) | 351 extensions::ExtensionSystem::Get(GetProfile(1)) |
353 ->app_sorting() | 352 ->app_sorting() |
354 ->GetPageOrdinal(extensions::kWebStoreAppId); | 353 ->GetPageOrdinal(extensions::kWebStoreAppId); |
355 extensions::ExtensionPrefs::Get(GetProfile(1))->app_sorting()->SetPageOrdinal( | 354 extensions::ExtensionSystem::Get(GetProfile(1)) |
356 extensions::kWebStoreAppId, cws_page_ordinal.CreateAfter()); | 355 ->app_sorting() |
357 extensions::ExtensionPrefs::Get(verifier())->app_sorting()->SetPageOrdinal( | 356 ->SetPageOrdinal(extensions::kWebStoreAppId, |
358 extensions::kWebStoreAppId, cws_page_ordinal.CreateAfter()); | 357 cws_page_ordinal.CreateAfter()); |
| 358 extensions::ExtensionSystem::Get(verifier()) |
| 359 ->app_sorting() |
| 360 ->SetPageOrdinal(extensions::kWebStoreAppId, |
| 361 cws_page_ordinal.CreateAfter()); |
359 ASSERT_TRUE(AwaitAllProfilesHaveSameApps()); | 362 ASSERT_TRUE(AwaitAllProfilesHaveSameApps()); |
360 } | 363 } |
361 | 364 |
362 // Adjust the launch type on the first client and sync. Both clients should | 365 // Adjust the launch type on the first client and sync. Both clients should |
363 // have the same launch type values for the CWS. | 366 // have the same launch type values for the CWS. |
364 IN_PROC_BROWSER_TEST_F(TwoClientAppsSyncTest, UpdateLaunchType) { | 367 IN_PROC_BROWSER_TEST_F(TwoClientAppsSyncTest, UpdateLaunchType) { |
365 ASSERT_TRUE(SetupSync()); | 368 ASSERT_TRUE(SetupSync()); |
366 ASSERT_TRUE(AllProfilesHaveSameAppsAsVerifier()); | 369 ASSERT_TRUE(AllProfilesHaveSameAppsAsVerifier()); |
367 | 370 |
368 // Change the launch type to window. | 371 // Change the launch type to window. |
(...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
459 content::WindowedNotificationObserver windowed_observer( | 462 content::WindowedNotificationObserver windowed_observer( |
460 extensions::NOTIFICATION_CRX_INSTALLER_DONE, | 463 extensions::NOTIFICATION_CRX_INSTALLER_DONE, |
461 base::Bind(&AllProfilesHaveSameAppsAsVerifier)); | 464 base::Bind(&AllProfilesHaveSameAppsAsVerifier)); |
462 windowed_observer.Wait(); | 465 windowed_observer.Wait(); |
463 } | 466 } |
464 } | 467 } |
465 | 468 |
466 // TODO(akalin): Add tests exercising: | 469 // TODO(akalin): Add tests exercising: |
467 // - Offline installation/uninstallation behavior | 470 // - Offline installation/uninstallation behavior |
468 // - App-specific properties | 471 // - App-specific properties |
OLD | NEW |