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