| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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/sync/profile_sync_service_harness.h" | 6 #include "chrome/browser/sync/profile_sync_service_harness.h" |
| 7 #include "chrome/browser/sync/test/integration/apps_helper.h" | 7 #include "chrome/browser/sync/test/integration/apps_helper.h" |
| 8 #include "chrome/browser/sync/test/integration/sync_test.h" | 8 #include "chrome/browser/sync/test/integration/sync_test.h" |
| 9 | 9 |
| 10 using apps_helper::AllProfilesHaveSameAppsAsVerifier; | 10 using apps_helper::AllProfilesHaveSameAppsAsVerifier; |
| 11 using apps_helper::InstallApp; | 11 using apps_helper::InstallApp; |
| 12 using apps_helper::InstallPlatformApp; |
| 12 | 13 |
| 13 class SingleClientAppsSyncTest : public SyncTest { | 14 class SingleClientAppsSyncTest : public SyncTest { |
| 14 public: | 15 public: |
| 15 SingleClientAppsSyncTest() : SyncTest(SINGLE_CLIENT) {} | 16 SingleClientAppsSyncTest() : SyncTest(SINGLE_CLIENT) {} |
| 16 | 17 |
| 17 virtual ~SingleClientAppsSyncTest() {} | 18 virtual ~SingleClientAppsSyncTest() {} |
| 18 | 19 |
| 19 private: | 20 private: |
| 20 DISALLOW_COPY_AND_ASSIGN(SingleClientAppsSyncTest); | 21 DISALLOW_COPY_AND_ASSIGN(SingleClientAppsSyncTest); |
| 21 }; | 22 }; |
| 22 | 23 |
| 23 IN_PROC_BROWSER_TEST_F(SingleClientAppsSyncTest, StartWithNoApps) { | 24 IN_PROC_BROWSER_TEST_F(SingleClientAppsSyncTest, StartWithNoApps) { |
| 24 ASSERT_TRUE(SetupSync()); | 25 ASSERT_TRUE(SetupSync()); |
| 25 | 26 |
| 26 ASSERT_TRUE(AllProfilesHaveSameAppsAsVerifier()); | 27 ASSERT_TRUE(AllProfilesHaveSameAppsAsVerifier()); |
| 27 } | 28 } |
| 28 | 29 |
| 29 IN_PROC_BROWSER_TEST_F(SingleClientAppsSyncTest, StartWithSomeApps) { | 30 IN_PROC_BROWSER_TEST_F(SingleClientAppsSyncTest, StartWithSomeLegacyApps) { |
| 30 ASSERT_TRUE(SetupClients()); | 31 ASSERT_TRUE(SetupClients()); |
| 31 | 32 |
| 32 const int kNumApps = 5; | 33 const int kNumApps = 5; |
| 33 for (int i = 0; i < kNumApps; ++i) { | 34 for (int i = 0; i < kNumApps; ++i) { |
| 34 InstallApp(GetProfile(0), i); | 35 InstallApp(GetProfile(0), i); |
| 35 InstallApp(verifier(), i); | 36 InstallApp(verifier(), i); |
| 36 } | 37 } |
| 37 | 38 |
| 38 ASSERT_TRUE(SetupSync()); | 39 ASSERT_TRUE(SetupSync()); |
| 39 | 40 |
| 40 ASSERT_TRUE(AllProfilesHaveSameAppsAsVerifier()); | 41 ASSERT_TRUE(AllProfilesHaveSameAppsAsVerifier()); |
| 41 } | 42 } |
| 42 | 43 |
| 43 IN_PROC_BROWSER_TEST_F(SingleClientAppsSyncTest, InstallSomeApps) { | 44 IN_PROC_BROWSER_TEST_F(SingleClientAppsSyncTest, StartWithSomePlatformApps) { |
| 45 ASSERT_TRUE(SetupClients()); |
| 46 |
| 47 const int kNumApps = 5; |
| 48 for (int i = 0; i < kNumApps; ++i) { |
| 49 InstallPlatformApp(GetProfile(0), i); |
| 50 InstallPlatformApp(verifier(), i); |
| 51 } |
| 52 |
| 53 ASSERT_TRUE(SetupSync()); |
| 54 |
| 55 ASSERT_TRUE(AllProfilesHaveSameAppsAsVerifier()); |
| 56 } |
| 57 |
| 58 IN_PROC_BROWSER_TEST_F(SingleClientAppsSyncTest, InstallSomeLegacyApps) { |
| 44 ASSERT_TRUE(SetupSync()); | 59 ASSERT_TRUE(SetupSync()); |
| 45 | 60 |
| 46 const int kNumApps = 5; | 61 const int kNumApps = 5; |
| 47 for (int i = 0; i < kNumApps; ++i) { | 62 for (int i = 0; i < kNumApps; ++i) { |
| 48 InstallApp(GetProfile(0), i); | 63 InstallApp(GetProfile(0), i); |
| 49 InstallApp(verifier(), i); | 64 InstallApp(verifier(), i); |
| 50 } | 65 } |
| 51 | 66 |
| 52 ASSERT_TRUE(GetClient(0)->AwaitFullSyncCompletion( | 67 ASSERT_TRUE(GetClient(0)->AwaitFullSyncCompletion( |
| 53 "Waiting for app changes.")); | 68 "Waiting for app changes.")); |
| 54 | 69 |
| 55 ASSERT_TRUE(AllProfilesHaveSameAppsAsVerifier()); | 70 ASSERT_TRUE(AllProfilesHaveSameAppsAsVerifier()); |
| 56 } | 71 } |
| 72 |
| 73 IN_PROC_BROWSER_TEST_F(SingleClientAppsSyncTest, InstallSomePlatformApps) { |
| 74 ASSERT_TRUE(SetupSync()); |
| 75 |
| 76 const int kNumApps = 5; |
| 77 for (int i = 0; i < kNumApps; ++i) { |
| 78 InstallPlatformApp(GetProfile(0), i); |
| 79 InstallPlatformApp(verifier(), i); |
| 80 } |
| 81 |
| 82 ASSERT_TRUE(GetClient(0)->AwaitFullSyncCompletion( |
| 83 "Waiting for app changes.")); |
| 84 |
| 85 ASSERT_TRUE(AllProfilesHaveSameAppsAsVerifier()); |
| 86 } |
| 87 |
| 88 IN_PROC_BROWSER_TEST_F(SingleClientAppsSyncTest, InstallSomeApps) { |
| 89 ASSERT_TRUE(SetupSync()); |
| 90 |
| 91 int i = 0; |
| 92 |
| 93 const int kNumApps = 5; |
| 94 for (int j = 0; j < kNumApps; ++i, ++j) { |
| 95 InstallApp(GetProfile(0), i); |
| 96 InstallApp(verifier(), i); |
| 97 } |
| 98 |
| 99 const int kNumPlatformApps = 5; |
| 100 for (int j = 0; j < kNumPlatformApps; ++i, ++j) { |
| 101 InstallPlatformApp(GetProfile(0), i); |
| 102 InstallPlatformApp(verifier(), i); |
| 103 } |
| 104 |
| 105 ASSERT_TRUE(GetClient(0)->AwaitFullSyncCompletion( |
| 106 "Waiting for app changes.")); |
| 107 |
| 108 ASSERT_TRUE(AllProfilesHaveSameAppsAsVerifier()); |
| 109 } |
| OLD | NEW |