OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/extensions/extension_service.h" | 6 #include "chrome/browser/extensions/extension_service.h" |
8 #include "chrome/browser/extensions/extension_sorting.h" | 7 #include "chrome/browser/extensions/extension_sorting.h" |
9 #include "chrome/browser/profiles/profile.h" | 8 #include "chrome/browser/profiles/profile.h" |
10 #include "chrome/browser/sync/profile_sync_service_harness.h" | 9 #include "chrome/browser/sync/profile_sync_service_harness.h" |
11 #include "chrome/browser/sync/test/integration/apps_helper.h" | 10 #include "chrome/browser/sync/test/integration/apps_helper.h" |
12 #include "chrome/browser/sync/test/integration/sync_app_helper.h" | 11 #include "chrome/browser/sync/test/integration/sync_app_helper.h" |
13 #include "chrome/browser/sync/test/integration/sync_test.h" | 12 #include "chrome/browser/sync/test/integration/sync_test.h" |
14 #include "chrome/common/chrome_switches.h" | |
15 #include "chrome/common/extensions/extension_constants.h" | 13 #include "chrome/common/extensions/extension_constants.h" |
16 #include "sync/api/string_ordinal.h" | 14 #include "sync/api/string_ordinal.h" |
17 | 15 |
18 using apps_helper::AllProfilesHaveSameAppsAsVerifier; | 16 using apps_helper::AllProfilesHaveSameAppsAsVerifier; |
19 using apps_helper::CopyNTPOrdinals; | 17 using apps_helper::CopyNTPOrdinals; |
20 using apps_helper::DisableApp; | 18 using apps_helper::DisableApp; |
21 using apps_helper::EnableApp; | 19 using apps_helper::EnableApp; |
22 using apps_helper::FixNTPOrdinalCollisions; | 20 using apps_helper::FixNTPOrdinalCollisions; |
23 using apps_helper::GetAppLaunchOrdinalForApp; | 21 using apps_helper::GetAppLaunchOrdinalForApp; |
24 using apps_helper::HasSameAppsAsVerifier; | 22 using apps_helper::HasSameAppsAsVerifier; |
25 using apps_helper::IncognitoDisableApp; | 23 using apps_helper::IncognitoDisableApp; |
26 using apps_helper::IncognitoEnableApp; | 24 using apps_helper::IncognitoEnableApp; |
27 using apps_helper::InstallApp; | 25 using apps_helper::InstallApp; |
28 using apps_helper::InstallAppsPendingForSync; | 26 using apps_helper::InstallAppsPendingForSync; |
29 using apps_helper::InstallPlatformApp; | 27 using apps_helper::InstallPlatformApp; |
30 using apps_helper::SetAppLaunchOrdinalForApp; | 28 using apps_helper::SetAppLaunchOrdinalForApp; |
31 using apps_helper::SetPageOrdinalForApp; | 29 using apps_helper::SetPageOrdinalForApp; |
32 using apps_helper::UninstallApp; | 30 using apps_helper::UninstallApp; |
33 using apps_helper::WaitForPlatformAppsToUnload; | |
34 | 31 |
35 class TwoClientAppsSyncTest : public SyncTest { | 32 class TwoClientAppsSyncTest : public SyncTest { |
36 public: | 33 public: |
37 TwoClientAppsSyncTest() : SyncTest(TWO_CLIENT) {} | 34 TwoClientAppsSyncTest() : SyncTest(TWO_CLIENT) {} |
38 | 35 |
39 virtual ~TwoClientAppsSyncTest() {} | 36 virtual ~TwoClientAppsSyncTest() {} |
40 | 37 |
41 protected: | |
42 virtual void SetUpCommandLine(CommandLine* command_line) OVERRIDE { | |
43 SyncTest::SetUpCommandLine(command_line); | |
44 // Make event pages get suspended quicker. | |
45 command_line->AppendSwitchASCII(switches::kEventPageIdleTime, "1"); | |
46 command_line->AppendSwitchASCII(switches::kEventPageUnloadingTime, "1"); | |
47 } | |
48 | |
49 private: | 38 private: |
50 DISALLOW_COPY_AND_ASSIGN(TwoClientAppsSyncTest); | 39 DISALLOW_COPY_AND_ASSIGN(TwoClientAppsSyncTest); |
51 }; | 40 }; |
52 | 41 |
53 IN_PROC_BROWSER_TEST_F(TwoClientAppsSyncTest, StartWithNoApps) { | 42 IN_PROC_BROWSER_TEST_F(TwoClientAppsSyncTest, StartWithNoApps) { |
54 ASSERT_TRUE(SetupSync()); | 43 ASSERT_TRUE(SetupSync()); |
55 | 44 |
56 ASSERT_TRUE(AllProfilesHaveSameAppsAsVerifier()); | 45 ASSERT_TRUE(AllProfilesHaveSameAppsAsVerifier()); |
57 } | 46 } |
58 | 47 |
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
112 FixNTPOrdinalCollisions(verifier()); | 101 FixNTPOrdinalCollisions(verifier()); |
113 | 102 |
114 ASSERT_TRUE(SetupSync()); | 103 ASSERT_TRUE(SetupSync()); |
115 | 104 |
116 ASSERT_TRUE(AwaitQuiescence()); | 105 ASSERT_TRUE(AwaitQuiescence()); |
117 | 106 |
118 InstallAppsPendingForSync(GetProfile(0)); | 107 InstallAppsPendingForSync(GetProfile(0)); |
119 InstallAppsPendingForSync(GetProfile(1)); | 108 InstallAppsPendingForSync(GetProfile(1)); |
120 | 109 |
121 ASSERT_TRUE(AllProfilesHaveSameAppsAsVerifier()); | 110 ASSERT_TRUE(AllProfilesHaveSameAppsAsVerifier()); |
122 | |
123 WaitForPlatformAppsToUnload(); | |
124 } | 111 } |
125 | 112 |
126 // Install some apps on both clients, then sync. Then install some apps on only | 113 // Install some apps on both clients, then sync. Then install some apps on only |
127 // one client, some on only the other, and then sync again. Both clients should | 114 // one client, some on only the other, and then sync again. Both clients should |
128 // end up with all apps, and the app and page ordinals should be identical. | 115 // end up with all apps, and the app and page ordinals should be identical. |
129 IN_PROC_BROWSER_TEST_F(TwoClientAppsSyncTest, InstallDifferentApps) { | 116 IN_PROC_BROWSER_TEST_F(TwoClientAppsSyncTest, InstallDifferentApps) { |
130 ASSERT_TRUE(SetupClients()); | 117 ASSERT_TRUE(SetupClients()); |
131 | 118 |
132 int i = 0; | 119 int i = 0; |
133 | 120 |
(...skipping 296 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
430 verifier()->GetExtensionService()->extension_prefs()-> | 417 verifier()->GetExtensionService()->extension_prefs()-> |
431 extension_sorting()->SetPageOrdinal(extension_misc::kWebStoreAppId, | 418 extension_sorting()->SetPageOrdinal(extension_misc::kWebStoreAppId, |
432 cws_page_ordinal.CreateAfter()); | 419 cws_page_ordinal.CreateAfter()); |
433 ASSERT_TRUE(AwaitQuiescence()); | 420 ASSERT_TRUE(AwaitQuiescence()); |
434 ASSERT_TRUE(AllProfilesHaveSameAppsAsVerifier()); | 421 ASSERT_TRUE(AllProfilesHaveSameAppsAsVerifier()); |
435 } | 422 } |
436 | 423 |
437 // TODO(akalin): Add tests exercising: | 424 // TODO(akalin): Add tests exercising: |
438 // - Offline installation/uninstallation behavior | 425 // - Offline installation/uninstallation behavior |
439 // - App-specific properties | 426 // - App-specific properties |
OLD | NEW |