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
3 // found in the LICENSE file.
5 #include "base/basictypes.h"
6 #include "chrome/browser/sync/profile_sync_service.h"
7 #include "chrome/browser/sync/test/integration/apps_helper.h"
8 #include "chrome/browser/sync/test/integration/sync_integration_test_util.h"
9 #include "chrome/browser/sync/test/integration/sync_test.h"
11 using apps_helper::AllProfilesHaveSameAppsAsVerifier
;
12 using apps_helper::InstallApp
;
13 using apps_helper::InstallPlatformApp
;
14 using sync_integration_test_util::AwaitCommitActivityCompletion
;
16 class SingleClientAppsSyncTest
: public SyncTest
{
18 SingleClientAppsSyncTest() : SyncTest(SINGLE_CLIENT
) {}
20 ~SingleClientAppsSyncTest() override
{}
23 DISALLOW_COPY_AND_ASSIGN(SingleClientAppsSyncTest
);
26 IN_PROC_BROWSER_TEST_F(SingleClientAppsSyncTest
, StartWithNoApps
) {
27 ASSERT_TRUE(SetupSync());
29 ASSERT_TRUE(AllProfilesHaveSameAppsAsVerifier());
32 IN_PROC_BROWSER_TEST_F(SingleClientAppsSyncTest
, StartWithSomeLegacyApps
) {
33 ASSERT_TRUE(SetupClients());
35 const int kNumApps
= 5;
36 for (int i
= 0; i
< kNumApps
; ++i
) {
37 InstallApp(GetProfile(0), i
);
38 InstallApp(verifier(), i
);
41 ASSERT_TRUE(SetupSync());
43 ASSERT_TRUE(AllProfilesHaveSameAppsAsVerifier());
46 IN_PROC_BROWSER_TEST_F(SingleClientAppsSyncTest
, StartWithSomePlatformApps
) {
47 ASSERT_TRUE(SetupClients());
49 const int kNumApps
= 5;
50 for (int i
= 0; i
< kNumApps
; ++i
) {
51 InstallPlatformApp(GetProfile(0), i
);
52 InstallPlatformApp(verifier(), i
);
55 ASSERT_TRUE(SetupSync());
57 ASSERT_TRUE(AllProfilesHaveSameAppsAsVerifier());
60 IN_PROC_BROWSER_TEST_F(SingleClientAppsSyncTest
, InstallSomeLegacyApps
) {
61 ASSERT_TRUE(SetupSync());
63 const int kNumApps
= 5;
64 for (int i
= 0; i
< kNumApps
; ++i
) {
65 InstallApp(GetProfile(0), i
);
66 InstallApp(verifier(), i
);
69 ASSERT_TRUE(AwaitCommitActivityCompletion(GetSyncService((0))));
71 ASSERT_TRUE(AllProfilesHaveSameAppsAsVerifier());
74 IN_PROC_BROWSER_TEST_F(SingleClientAppsSyncTest
, InstallSomePlatformApps
) {
75 ASSERT_TRUE(SetupSync());
77 const int kNumApps
= 5;
78 for (int i
= 0; i
< kNumApps
; ++i
) {
79 InstallPlatformApp(GetProfile(0), i
);
80 InstallPlatformApp(verifier(), i
);
83 ASSERT_TRUE(AwaitCommitActivityCompletion(GetSyncService((0))));
85 ASSERT_TRUE(AllProfilesHaveSameAppsAsVerifier());
88 IN_PROC_BROWSER_TEST_F(SingleClientAppsSyncTest
, InstallSomeApps
) {
89 ASSERT_TRUE(SetupSync());
93 const int kNumApps
= 5;
94 for (int j
= 0; j
< kNumApps
; ++i
, ++j
) {
95 InstallApp(GetProfile(0), i
);
96 InstallApp(verifier(), i
);
99 const int kNumPlatformApps
= 5;
100 for (int j
= 0; j
< kNumPlatformApps
; ++i
, ++j
) {
101 InstallPlatformApp(GetProfile(0), i
);
102 InstallPlatformApp(verifier(), i
);
105 ASSERT_TRUE(AwaitCommitActivityCompletion(GetSyncService((0))));
107 ASSERT_TRUE(AllProfilesHaveSameAppsAsVerifier());