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