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 "base/command_line.h" | |
7 #include "chrome/browser/sync/profile_sync_service_harness.h" | 6 #include "chrome/browser/sync/profile_sync_service_harness.h" |
8 #include "chrome/browser/sync/test/integration/apps_helper.h" | 7 #include "chrome/browser/sync/test/integration/apps_helper.h" |
9 #include "chrome/browser/sync/test/integration/sync_test.h" | 8 #include "chrome/browser/sync/test/integration/sync_test.h" |
10 #include "chrome/common/chrome_switches.h" | |
11 | 9 |
12 using apps_helper::AllProfilesHaveSameAppsAsVerifier; | 10 using apps_helper::AllProfilesHaveSameAppsAsVerifier; |
13 using apps_helper::InstallApp; | 11 using apps_helper::InstallApp; |
14 using apps_helper::InstallPlatformApp; | 12 using apps_helper::InstallPlatformApp; |
15 using apps_helper::WaitForPlatformAppsToUnload; | |
16 | 13 |
17 class SingleClientAppsSyncTest : public SyncTest { | 14 class SingleClientAppsSyncTest : public SyncTest { |
18 public: | 15 public: |
19 SingleClientAppsSyncTest() : SyncTest(SINGLE_CLIENT) {} | 16 SingleClientAppsSyncTest() : SyncTest(SINGLE_CLIENT) {} |
20 | 17 |
21 virtual ~SingleClientAppsSyncTest() {} | 18 virtual ~SingleClientAppsSyncTest() {} |
22 | 19 |
23 protected: | |
24 virtual void SetUpCommandLine(CommandLine* command_line) OVERRIDE { | |
25 SyncTest::SetUpCommandLine(command_line); | |
26 // Make event pages get suspended quicker. | |
27 command_line->AppendSwitchASCII(switches::kEventPageIdleTime, "1"); | |
28 command_line->AppendSwitchASCII(switches::kEventPageUnloadingTime, "1"); | |
29 } | |
30 | |
31 private: | 20 private: |
32 DISALLOW_COPY_AND_ASSIGN(SingleClientAppsSyncTest); | 21 DISALLOW_COPY_AND_ASSIGN(SingleClientAppsSyncTest); |
33 }; | 22 }; |
34 | 23 |
35 IN_PROC_BROWSER_TEST_F(SingleClientAppsSyncTest, StartWithNoApps) { | 24 IN_PROC_BROWSER_TEST_F(SingleClientAppsSyncTest, StartWithNoApps) { |
36 ASSERT_TRUE(SetupSync()); | 25 ASSERT_TRUE(SetupSync()); |
37 | 26 |
38 ASSERT_TRUE(AllProfilesHaveSameAppsAsVerifier()); | 27 ASSERT_TRUE(AllProfilesHaveSameAppsAsVerifier()); |
39 } | 28 } |
40 | 29 |
(...skipping 16 matching lines...) Expand all Loading... |
57 | 46 |
58 const int kNumApps = 5; | 47 const int kNumApps = 5; |
59 for (int i = 0; i < kNumApps; ++i) { | 48 for (int i = 0; i < kNumApps; ++i) { |
60 InstallPlatformApp(GetProfile(0), i); | 49 InstallPlatformApp(GetProfile(0), i); |
61 InstallPlatformApp(verifier(), i); | 50 InstallPlatformApp(verifier(), i); |
62 } | 51 } |
63 | 52 |
64 ASSERT_TRUE(SetupSync()); | 53 ASSERT_TRUE(SetupSync()); |
65 | 54 |
66 ASSERT_TRUE(AllProfilesHaveSameAppsAsVerifier()); | 55 ASSERT_TRUE(AllProfilesHaveSameAppsAsVerifier()); |
67 | |
68 WaitForPlatformAppsToUnload(); | |
69 } | 56 } |
70 | 57 |
71 IN_PROC_BROWSER_TEST_F(SingleClientAppsSyncTest, InstallSomeLegacyApps) { | 58 IN_PROC_BROWSER_TEST_F(SingleClientAppsSyncTest, InstallSomeLegacyApps) { |
72 ASSERT_TRUE(SetupSync()); | 59 ASSERT_TRUE(SetupSync()); |
73 | 60 |
74 const int kNumApps = 5; | 61 const int kNumApps = 5; |
75 for (int i = 0; i < kNumApps; ++i) { | 62 for (int i = 0; i < kNumApps; ++i) { |
76 InstallApp(GetProfile(0), i); | 63 InstallApp(GetProfile(0), i); |
77 InstallApp(verifier(), i); | 64 InstallApp(verifier(), i); |
78 } | 65 } |
(...skipping 10 matching lines...) Expand all Loading... |
89 const int kNumApps = 5; | 76 const int kNumApps = 5; |
90 for (int i = 0; i < kNumApps; ++i) { | 77 for (int i = 0; i < kNumApps; ++i) { |
91 InstallPlatformApp(GetProfile(0), i); | 78 InstallPlatformApp(GetProfile(0), i); |
92 InstallPlatformApp(verifier(), i); | 79 InstallPlatformApp(verifier(), i); |
93 } | 80 } |
94 | 81 |
95 ASSERT_TRUE(GetClient(0)->AwaitFullSyncCompletion( | 82 ASSERT_TRUE(GetClient(0)->AwaitFullSyncCompletion( |
96 "Waiting for app changes.")); | 83 "Waiting for app changes.")); |
97 | 84 |
98 ASSERT_TRUE(AllProfilesHaveSameAppsAsVerifier()); | 85 ASSERT_TRUE(AllProfilesHaveSameAppsAsVerifier()); |
99 | |
100 WaitForPlatformAppsToUnload(); | |
101 } | 86 } |
102 | 87 |
103 IN_PROC_BROWSER_TEST_F(SingleClientAppsSyncTest, InstallSomeApps) { | 88 IN_PROC_BROWSER_TEST_F(SingleClientAppsSyncTest, InstallSomeApps) { |
104 ASSERT_TRUE(SetupSync()); | 89 ASSERT_TRUE(SetupSync()); |
105 | 90 |
106 int i = 0; | 91 int i = 0; |
107 | 92 |
108 const int kNumApps = 5; | 93 const int kNumApps = 5; |
109 for (int j = 0; j < kNumApps; ++i, ++j) { | 94 for (int j = 0; j < kNumApps; ++i, ++j) { |
110 InstallApp(GetProfile(0), i); | 95 InstallApp(GetProfile(0), i); |
111 InstallApp(verifier(), i); | 96 InstallApp(verifier(), i); |
112 } | 97 } |
113 | 98 |
114 const int kNumPlatformApps = 5; | 99 const int kNumPlatformApps = 5; |
115 for (int j = 0; j < kNumPlatformApps; ++i, ++j) { | 100 for (int j = 0; j < kNumPlatformApps; ++i, ++j) { |
116 InstallPlatformApp(GetProfile(0), i); | 101 InstallPlatformApp(GetProfile(0), i); |
117 InstallPlatformApp(verifier(), i); | 102 InstallPlatformApp(verifier(), i); |
118 } | 103 } |
119 | 104 |
120 ASSERT_TRUE(GetClient(0)->AwaitFullSyncCompletion( | 105 ASSERT_TRUE(GetClient(0)->AwaitFullSyncCompletion( |
121 "Waiting for app changes.")); | 106 "Waiting for app changes.")); |
122 | 107 |
123 ASSERT_TRUE(AllProfilesHaveSameAppsAsVerifier()); | 108 ASSERT_TRUE(AllProfilesHaveSameAppsAsVerifier()); |
124 | |
125 WaitForPlatformAppsToUnload(); | |
126 } | 109 } |
OLD | NEW |