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