Chromium Code Reviews| 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 void MoveChromeAppToEnd(AppListExtensionSorting* ordering) { | |
|
xiyuan
2013/07/05 06:06:18
nit: insert an empty line before and shift left tw
calamity
2013/07/11 03:31:00
Done.
| |
| 34 ordering->Erase(extension_misc::kChromeAppId); | |
| 35 ordering->InsertAtBack(extension_misc::kChromeAppId); | |
| 36 } | |
| 37 } | |
| 38 | |
| 32 class TwoClientAppsSyncTest : public SyncTest { | 39 class TwoClientAppsSyncTest : public SyncTest { |
| 33 public: | 40 public: |
| 34 TwoClientAppsSyncTest() : SyncTest(TWO_CLIENT) {} | 41 TwoClientAppsSyncTest() : SyncTest(TWO_CLIENT) {} |
| 35 | 42 |
| 36 virtual ~TwoClientAppsSyncTest() {} | 43 virtual ~TwoClientAppsSyncTest() {} |
| 37 | 44 |
| 38 private: | 45 private: |
| 39 DISALLOW_COPY_AND_ASSIGN(TwoClientAppsSyncTest); | 46 DISALLOW_COPY_AND_ASSIGN(TwoClientAppsSyncTest); |
| 40 }; | 47 }; |
| 41 | 48 |
| (...skipping 373 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 415 GetProfile(1)->GetExtensionService()->extension_prefs()-> | 422 GetProfile(1)->GetExtensionService()->extension_prefs()-> |
| 416 extension_sorting()->SetPageOrdinal(extension_misc::kWebStoreAppId, | 423 extension_sorting()->SetPageOrdinal(extension_misc::kWebStoreAppId, |
| 417 cws_page_ordinal.CreateAfter()); | 424 cws_page_ordinal.CreateAfter()); |
| 418 verifier()->GetExtensionService()->extension_prefs()-> | 425 verifier()->GetExtensionService()->extension_prefs()-> |
| 419 extension_sorting()->SetPageOrdinal(extension_misc::kWebStoreAppId, | 426 extension_sorting()->SetPageOrdinal(extension_misc::kWebStoreAppId, |
| 420 cws_page_ordinal.CreateAfter()); | 427 cws_page_ordinal.CreateAfter()); |
| 421 ASSERT_TRUE(AwaitQuiescence()); | 428 ASSERT_TRUE(AwaitQuiescence()); |
| 422 ASSERT_TRUE(AllProfilesHaveSameAppsAsVerifier()); | 429 ASSERT_TRUE(AllProfilesHaveSameAppsAsVerifier()); |
| 423 } | 430 } |
| 424 | 431 |
| 432 // Adjust the chrome app location within the app list on the first client and | |
| 433 // sync. Both clients should have the same app list ordinal values for the | |
| 434 // chrome app. | |
| 435 IN_PROC_BROWSER_TEST_F(TwoClientAppsSyncTest, UpdateChromeAppAppListOrdinal) { | |
| 436 ASSERT_TRUE(SetupSync()); | |
| 437 ASSERT_TRUE(AllProfilesHaveSameAppsAsVerifier()); | |
| 438 | |
| 439 // Change the app list ordinal. | |
| 440 AppListExtensionSorting* ordering = | |
| 441 GetProfile(0)->GetExtensionService()->extension_prefs()-> | |
| 442 app_list_extension_sorting(); | |
| 443 AppListExtensionSorting* verifier_ordering = | |
| 444 verifier()->GetExtensionService()->extension_prefs()-> | |
| 445 app_list_extension_sorting(); | |
| 446 | |
| 447 MoveChromeAppToEnd(ordering); | |
| 448 MoveChromeAppToEnd(verifier_ordering); | |
| 449 | |
| 450 ASSERT_TRUE(AwaitQuiescence()); | |
| 451 ASSERT_TRUE(AllProfilesHaveSameAppsAsVerifier()); | |
| 452 } | |
| 453 | |
| 425 // TODO(akalin): Add tests exercising: | 454 // TODO(akalin): Add tests exercising: |
| 426 // - Offline installation/uninstallation behavior | 455 // - Offline installation/uninstallation behavior |
| 427 // - App-specific properties | 456 // - App-specific properties |
| OLD | NEW |