| 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" |
| 11 #include "chrome/browser/sync/test/integration/sync_app_helper.h" | 11 #include "chrome/browser/sync/test/integration/sync_app_helper.h" |
| 12 #include "chrome/browser/sync/test/integration/sync_test.h" | 12 #include "chrome/browser/sync/test/integration/sync_test.h" |
| 13 #include "chrome/common/extensions/extension_constants.h" | 13 #include "chrome/common/extensions/extension_constants.h" |
| 14 #include "sync/api/string_ordinal.h" | 14 #include "sync/api/string_ordinal.h" |
| 15 | 15 |
| 16 using apps_helper::AllProfilesHaveSameAppsAsVerifier; | 16 using apps_helper::AllProfilesHaveSameAppsAsVerifier; |
| 17 using apps_helper::CopyNTPOrdinals; | 17 using apps_helper::CopyNTPOrdinals; |
| 18 using apps_helper::DisableApp; | 18 using apps_helper::DisableApp; |
| 19 using apps_helper::EnableApp; | 19 using apps_helper::EnableApp; |
| 20 using apps_helper::FixNTPOrdinalCollisions; | 20 using apps_helper::FixNTPOrdinalCollisions; |
| 21 using apps_helper::HasSameAppsAsVerifier; | 21 using apps_helper::HasSameAppsAsVerifier; |
| 22 using apps_helper::IncognitoDisableApp; | 22 using apps_helper::IncognitoDisableApp; |
| 23 using apps_helper::IncognitoEnableApp; | 23 using apps_helper::IncognitoEnableApp; |
| 24 using apps_helper::InstallApp; | 24 using apps_helper::InstallApp; |
| 25 using apps_helper::InstallAppsPendingForSync; | 25 using apps_helper::InstallAppsPendingForSync; |
| 26 using apps_helper::InstallPlatformApp; |
| 26 using apps_helper::SetAppLaunchOrdinalForApp; | 27 using apps_helper::SetAppLaunchOrdinalForApp; |
| 27 using apps_helper::SetPageOrdinalForApp; | 28 using apps_helper::SetPageOrdinalForApp; |
| 28 using apps_helper::UninstallApp; | 29 using apps_helper::UninstallApp; |
| 29 | 30 |
| 30 class TwoClientAppsSyncTest : public SyncTest { | 31 class TwoClientAppsSyncTest : public SyncTest { |
| 31 public: | 32 public: |
| 32 TwoClientAppsSyncTest() : SyncTest(TWO_CLIENT) {} | 33 TwoClientAppsSyncTest() : SyncTest(TWO_CLIENT) {} |
| 33 | 34 |
| 34 virtual ~TwoClientAppsSyncTest() {} | 35 virtual ~TwoClientAppsSyncTest() {} |
| 35 | 36 |
| (...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 82 CopyNTPOrdinals(GetProfile(0), verifier(), i); | 83 CopyNTPOrdinals(GetProfile(0), verifier(), i); |
| 83 } | 84 } |
| 84 | 85 |
| 85 const int kNumProfile1Apps = 10; | 86 const int kNumProfile1Apps = 10; |
| 86 for (int j = 0; j < kNumProfile1Apps; ++i, ++j) { | 87 for (int j = 0; j < kNumProfile1Apps; ++i, ++j) { |
| 87 InstallApp(GetProfile(1), i); | 88 InstallApp(GetProfile(1), i); |
| 88 InstallApp(verifier(), i); | 89 InstallApp(verifier(), i); |
| 89 CopyNTPOrdinals(GetProfile(1), verifier(), i); | 90 CopyNTPOrdinals(GetProfile(1), verifier(), i); |
| 90 } | 91 } |
| 91 | 92 |
| 93 const int kNumPlatformApps = 5; |
| 94 for (int j = 0; j < kNumPlatformApps; ++i, ++j) { |
| 95 InstallPlatformApp(GetProfile(1), i); |
| 96 InstallPlatformApp(verifier(), i); |
| 97 CopyNTPOrdinals(GetProfile(1), verifier(), i); |
| 98 } |
| 99 |
| 92 FixNTPOrdinalCollisions(verifier()); | 100 FixNTPOrdinalCollisions(verifier()); |
| 93 | 101 |
| 94 ASSERT_TRUE(SetupSync()); | 102 ASSERT_TRUE(SetupSync()); |
| 95 | 103 |
| 96 ASSERT_TRUE(AwaitQuiescence()); | 104 ASSERT_TRUE(AwaitQuiescence()); |
| 97 | 105 |
| 98 InstallAppsPendingForSync(GetProfile(0)); | 106 InstallAppsPendingForSync(GetProfile(0)); |
| 99 InstallAppsPendingForSync(GetProfile(1)); | 107 InstallAppsPendingForSync(GetProfile(1)); |
| 100 | 108 |
| 101 ASSERT_TRUE(AllProfilesHaveSameAppsAsVerifier()); | 109 ASSERT_TRUE(AllProfilesHaveSameAppsAsVerifier()); |
| (...skipping 305 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 407 verifier()->GetExtensionService()->extension_prefs()-> | 415 verifier()->GetExtensionService()->extension_prefs()-> |
| 408 extension_sorting()->SetPageOrdinal(extension_misc::kWebStoreAppId, | 416 extension_sorting()->SetPageOrdinal(extension_misc::kWebStoreAppId, |
| 409 cws_page_ordinal.CreateAfter()); | 417 cws_page_ordinal.CreateAfter()); |
| 410 ASSERT_TRUE(AwaitQuiescence()); | 418 ASSERT_TRUE(AwaitQuiescence()); |
| 411 ASSERT_TRUE(AllProfilesHaveSameAppsAsVerifier()); | 419 ASSERT_TRUE(AllProfilesHaveSameAppsAsVerifier()); |
| 412 } | 420 } |
| 413 | 421 |
| 414 // TODO(akalin): Add tests exercising: | 422 // TODO(akalin): Add tests exercising: |
| 415 // - Offline installation/uninstallation behavior | 423 // - Offline installation/uninstallation behavior |
| 416 // - App-specific properties | 424 // - App-specific properties |
| OLD | NEW |