Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(105)

Side by Side Diff: chrome/browser/sync/test/integration/two_client_apps_sync_test.cc

Issue 11117011: Keep browser process alive while there are platform apps with background pages running. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: And another test Created 8 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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"
6 #include "chrome/browser/extensions/extension_service.h" 7 #include "chrome/browser/extensions/extension_service.h"
7 #include "chrome/browser/extensions/extension_sorting.h" 8 #include "chrome/browser/extensions/extension_sorting.h"
8 #include "chrome/browser/profiles/profile.h" 9 #include "chrome/browser/profiles/profile.h"
9 #include "chrome/browser/sync/profile_sync_service_harness.h" 10 #include "chrome/browser/sync/profile_sync_service_harness.h"
10 #include "chrome/browser/sync/test/integration/apps_helper.h" 11 #include "chrome/browser/sync/test/integration/apps_helper.h"
11 #include "chrome/browser/sync/test/integration/sync_app_helper.h" 12 #include "chrome/browser/sync/test/integration/sync_app_helper.h"
12 #include "chrome/browser/sync/test/integration/sync_test.h" 13 #include "chrome/browser/sync/test/integration/sync_test.h"
14 #include "chrome/common/chrome_switches.h"
13 #include "chrome/common/extensions/extension_constants.h" 15 #include "chrome/common/extensions/extension_constants.h"
14 #include "sync/api/string_ordinal.h" 16 #include "sync/api/string_ordinal.h"
15 17
16 using apps_helper::AllProfilesHaveSameAppsAsVerifier; 18 using apps_helper::AllProfilesHaveSameAppsAsVerifier;
17 using apps_helper::CopyNTPOrdinals; 19 using apps_helper::CopyNTPOrdinals;
18 using apps_helper::DisableApp; 20 using apps_helper::DisableApp;
19 using apps_helper::EnableApp; 21 using apps_helper::EnableApp;
20 using apps_helper::FixNTPOrdinalCollisions; 22 using apps_helper::FixNTPOrdinalCollisions;
21 using apps_helper::GetAppLaunchOrdinalForApp; 23 using apps_helper::GetAppLaunchOrdinalForApp;
22 using apps_helper::HasSameAppsAsVerifier; 24 using apps_helper::HasSameAppsAsVerifier;
23 using apps_helper::IncognitoDisableApp; 25 using apps_helper::IncognitoDisableApp;
24 using apps_helper::IncognitoEnableApp; 26 using apps_helper::IncognitoEnableApp;
25 using apps_helper::InstallApp; 27 using apps_helper::InstallApp;
26 using apps_helper::InstallAppsPendingForSync; 28 using apps_helper::InstallAppsPendingForSync;
27 using apps_helper::InstallPlatformApp; 29 using apps_helper::InstallPlatformApp;
28 using apps_helper::SetAppLaunchOrdinalForApp; 30 using apps_helper::SetAppLaunchOrdinalForApp;
29 using apps_helper::SetPageOrdinalForApp; 31 using apps_helper::SetPageOrdinalForApp;
30 using apps_helper::UninstallApp; 32 using apps_helper::UninstallApp;
33 using apps_helper::WaitForPlatformAppsToUnload;
31 34
32 class TwoClientAppsSyncTest : public SyncTest { 35 class TwoClientAppsSyncTest : public SyncTest {
33 public: 36 public:
34 TwoClientAppsSyncTest() : SyncTest(TWO_CLIENT) {} 37 TwoClientAppsSyncTest() : SyncTest(TWO_CLIENT) {}
35 38
36 virtual ~TwoClientAppsSyncTest() {} 39 virtual ~TwoClientAppsSyncTest() {}
37 40
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
38 private: 49 private:
39 DISALLOW_COPY_AND_ASSIGN(TwoClientAppsSyncTest); 50 DISALLOW_COPY_AND_ASSIGN(TwoClientAppsSyncTest);
40 }; 51 };
41 52
42 IN_PROC_BROWSER_TEST_F(TwoClientAppsSyncTest, StartWithNoApps) { 53 IN_PROC_BROWSER_TEST_F(TwoClientAppsSyncTest, StartWithNoApps) {
43 ASSERT_TRUE(SetupSync()); 54 ASSERT_TRUE(SetupSync());
44 55
45 ASSERT_TRUE(AllProfilesHaveSameAppsAsVerifier()); 56 ASSERT_TRUE(AllProfilesHaveSameAppsAsVerifier());
46 } 57 }
47 58
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after
101 FixNTPOrdinalCollisions(verifier()); 112 FixNTPOrdinalCollisions(verifier());
102 113
103 ASSERT_TRUE(SetupSync()); 114 ASSERT_TRUE(SetupSync());
104 115
105 ASSERT_TRUE(AwaitQuiescence()); 116 ASSERT_TRUE(AwaitQuiescence());
106 117
107 InstallAppsPendingForSync(GetProfile(0)); 118 InstallAppsPendingForSync(GetProfile(0));
108 InstallAppsPendingForSync(GetProfile(1)); 119 InstallAppsPendingForSync(GetProfile(1));
109 120
110 ASSERT_TRUE(AllProfilesHaveSameAppsAsVerifier()); 121 ASSERT_TRUE(AllProfilesHaveSameAppsAsVerifier());
122
123 WaitForPlatformAppsToUnload();
111 } 124 }
112 125
113 // Install some apps on both clients, then sync. Then install some apps on only 126 // Install some apps on both clients, then sync. Then install some apps on only
114 // one client, some on only the other, and then sync again. Both clients should 127 // one client, some on only the other, and then sync again. Both clients should
115 // end up with all apps, and the app and page ordinals should be identical. 128 // end up with all apps, and the app and page ordinals should be identical.
116 IN_PROC_BROWSER_TEST_F(TwoClientAppsSyncTest, InstallDifferentApps) { 129 IN_PROC_BROWSER_TEST_F(TwoClientAppsSyncTest, InstallDifferentApps) {
117 ASSERT_TRUE(SetupClients()); 130 ASSERT_TRUE(SetupClients());
118 131
119 int i = 0; 132 int i = 0;
120 133
(...skipping 296 matching lines...) Expand 10 before | Expand all | Expand 10 after
417 verifier()->GetExtensionService()->extension_prefs()-> 430 verifier()->GetExtensionService()->extension_prefs()->
418 extension_sorting()->SetPageOrdinal(extension_misc::kWebStoreAppId, 431 extension_sorting()->SetPageOrdinal(extension_misc::kWebStoreAppId,
419 cws_page_ordinal.CreateAfter()); 432 cws_page_ordinal.CreateAfter());
420 ASSERT_TRUE(AwaitQuiescence()); 433 ASSERT_TRUE(AwaitQuiescence());
421 ASSERT_TRUE(AllProfilesHaveSameAppsAsVerifier()); 434 ASSERT_TRUE(AllProfilesHaveSameAppsAsVerifier());
422 } 435 }
423 436
424 // TODO(akalin): Add tests exercising: 437 // TODO(akalin): Add tests exercising:
425 // - Offline installation/uninstallation behavior 438 // - Offline installation/uninstallation behavior
426 // - App-specific properties 439 // - App-specific properties
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698