| 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 "chrome/browser/extensions/extension_service.h" | 6 #include "chrome/browser/extensions/extension_service.h" |
| 7 #include "chrome/browser/extensions/extension_sorting.h" | 7 #include "chrome/browser/extensions/extension_sorting.h" |
| 8 #include "chrome/browser/profiles/profile.h" | 8 #include "chrome/browser/profiles/profile.h" |
| 9 #include "chrome/browser/sync/profile_sync_service_harness.h" | 9 #include "chrome/browser/sync/profile_sync_service_harness.h" |
| 10 #include "chrome/browser/sync/test/integration/apps_helper.h" | 10 #include "chrome/browser/sync/test/integration/apps_helper.h" |
| (...skipping 11 matching lines...) Expand all Loading... |
| 22 using apps_helper::HasSameAppsAsVerifier; | 22 using apps_helper::HasSameAppsAsVerifier; |
| 23 using apps_helper::IncognitoDisableApp; | 23 using apps_helper::IncognitoDisableApp; |
| 24 using apps_helper::IncognitoEnableApp; | 24 using apps_helper::IncognitoEnableApp; |
| 25 using apps_helper::InstallApp; | 25 using apps_helper::InstallApp; |
| 26 using apps_helper::InstallAppsPendingForSync; | 26 using apps_helper::InstallAppsPendingForSync; |
| 27 using apps_helper::InstallPlatformApp; | 27 using apps_helper::InstallPlatformApp; |
| 28 using apps_helper::SetAppLaunchOrdinalForApp; | 28 using apps_helper::SetAppLaunchOrdinalForApp; |
| 29 using apps_helper::SetPageOrdinalForApp; | 29 using apps_helper::SetPageOrdinalForApp; |
| 30 using apps_helper::UninstallApp; | 30 using apps_helper::UninstallApp; |
| 31 | 31 |
| 32 namespace { |
| 33 |
| 34 void MoveChromeAppToEnd(AppListExtensionSorting* ordering) { |
| 35 ordering->Erase(extension_misc::kChromeAppId); |
| 36 ordering->InsertAtBack(extension_misc::kChromeAppId); |
| 37 } |
| 38 |
| 39 } // namespace |
| 40 |
| 32 class TwoClientAppsSyncTest : public SyncTest { | 41 class TwoClientAppsSyncTest : public SyncTest { |
| 33 public: | 42 public: |
| 34 TwoClientAppsSyncTest() : SyncTest(TWO_CLIENT) {} | 43 TwoClientAppsSyncTest() : SyncTest(TWO_CLIENT) {} |
| 35 | 44 |
| 36 virtual ~TwoClientAppsSyncTest() {} | 45 virtual ~TwoClientAppsSyncTest() {} |
| 37 | 46 |
| 38 private: | 47 private: |
| 39 DISALLOW_COPY_AND_ASSIGN(TwoClientAppsSyncTest); | 48 DISALLOW_COPY_AND_ASSIGN(TwoClientAppsSyncTest); |
| 40 }; | 49 }; |
| 41 | 50 |
| (...skipping 373 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 415 GetProfile(1)->GetExtensionService()->extension_prefs()-> | 424 GetProfile(1)->GetExtensionService()->extension_prefs()-> |
| 416 extension_sorting()->SetPageOrdinal(extension_misc::kWebStoreAppId, | 425 extension_sorting()->SetPageOrdinal(extension_misc::kWebStoreAppId, |
| 417 cws_page_ordinal.CreateAfter()); | 426 cws_page_ordinal.CreateAfter()); |
| 418 verifier()->GetExtensionService()->extension_prefs()-> | 427 verifier()->GetExtensionService()->extension_prefs()-> |
| 419 extension_sorting()->SetPageOrdinal(extension_misc::kWebStoreAppId, | 428 extension_sorting()->SetPageOrdinal(extension_misc::kWebStoreAppId, |
| 420 cws_page_ordinal.CreateAfter()); | 429 cws_page_ordinal.CreateAfter()); |
| 421 ASSERT_TRUE(AwaitQuiescence()); | 430 ASSERT_TRUE(AwaitQuiescence()); |
| 422 ASSERT_TRUE(AllProfilesHaveSameAppsAsVerifier()); | 431 ASSERT_TRUE(AllProfilesHaveSameAppsAsVerifier()); |
| 423 } | 432 } |
| 424 | 433 |
| 434 // Adjust the chrome app location within the app list on the first client and |
| 435 // sync. Both clients should have the same app list ordinal values for the |
| 436 // chrome app. |
| 437 IN_PROC_BROWSER_TEST_F(TwoClientAppsSyncTest, UpdateChromeAppAppListOrdinal) { |
| 438 ASSERT_TRUE(SetupSync()); |
| 439 ASSERT_TRUE(AllProfilesHaveSameAppsAsVerifier()); |
| 440 |
| 441 // Change the app list ordinal. |
| 442 AppListExtensionSorting* ordering = |
| 443 GetProfile(0)->GetExtensionService()->extension_prefs()-> |
| 444 app_list_extension_sorting(); |
| 445 AppListExtensionSorting* verifier_ordering = |
| 446 verifier()->GetExtensionService()->extension_prefs()-> |
| 447 app_list_extension_sorting(); |
| 448 |
| 449 MoveChromeAppToEnd(ordering); |
| 450 MoveChromeAppToEnd(verifier_ordering); |
| 451 |
| 452 ASSERT_TRUE(AwaitQuiescence()); |
| 453 ASSERT_TRUE(AllProfilesHaveSameAppsAsVerifier()); |
| 454 } |
| 455 |
| 425 // TODO(akalin): Add tests exercising: | 456 // TODO(akalin): Add tests exercising: |
| 426 // - Offline installation/uninstallation behavior | 457 // - Offline installation/uninstallation behavior |
| 427 // - App-specific properties | 458 // - App-specific properties |
| OLD | NEW |