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

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

Issue 11415090: Remove assumption about initial ordinals in app sync tests (Closed) Base URL: http://git.chromium.org/git/chromium.git@trunk
Patch Set: rebase 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 "chrome/browser/extensions/extension_service.h" 6 #include "chrome/browser/extensions/extension_service.h"
7 #include "chrome/browser/extensions/extension_sorting.h" 7 #include "chrome/browser/extensions/extension_sorting.h"
8 #include "chrome/browser/profiles/profile.h" 8 #include "chrome/browser/profiles/profile.h"
9 #include "chrome/browser/sync/profile_sync_service_harness.h" 9 #include "chrome/browser/sync/profile_sync_service_harness.h"
10 #include "chrome/browser/sync/test/integration/apps_helper.h" 10 #include "chrome/browser/sync/test/integration/apps_helper.h"
11 #include "chrome/browser/sync/test/integration/sync_app_helper.h" 11 #include "chrome/browser/sync/test/integration/sync_app_helper.h"
12 #include "chrome/browser/sync/test/integration/sync_test.h" 12 #include "chrome/browser/sync/test/integration/sync_test.h"
13 #include "chrome/common/extensions/extension_constants.h" 13 #include "chrome/common/extensions/extension_constants.h"
14 #include "sync/api/string_ordinal.h" 14 #include "sync/api/string_ordinal.h"
15 15
16 using apps_helper::AllProfilesHaveSameAppsAsVerifier; 16 using apps_helper::AllProfilesHaveSameAppsAsVerifier;
17 using apps_helper::CopyNTPOrdinals; 17 using apps_helper::CopyNTPOrdinals;
18 using apps_helper::DisableApp; 18 using apps_helper::DisableApp;
19 using apps_helper::EnableApp; 19 using apps_helper::EnableApp;
20 using apps_helper::FixNTPOrdinalCollisions; 20 using apps_helper::FixNTPOrdinalCollisions;
21 using apps_helper::GetAppLaunchOrdinalForApp;
21 using apps_helper::HasSameAppsAsVerifier; 22 using apps_helper::HasSameAppsAsVerifier;
22 using apps_helper::IncognitoDisableApp; 23 using apps_helper::IncognitoDisableApp;
23 using apps_helper::IncognitoEnableApp; 24 using apps_helper::IncognitoEnableApp;
24 using apps_helper::InstallApp; 25 using apps_helper::InstallApp;
25 using apps_helper::InstallAppsPendingForSync; 26 using apps_helper::InstallAppsPendingForSync;
26 using apps_helper::InstallPlatformApp; 27 using apps_helper::InstallPlatformApp;
27 using apps_helper::SetAppLaunchOrdinalForApp; 28 using apps_helper::SetAppLaunchOrdinalForApp;
28 using apps_helper::SetPageOrdinalForApp; 29 using apps_helper::SetPageOrdinalForApp;
29 using apps_helper::UninstallApp; 30 using apps_helper::UninstallApp;
30 31
(...skipping 330 matching lines...) Expand 10 before | Expand all | Expand 10 after
361 ASSERT_TRUE(AllProfilesHaveSameAppsAsVerifier()); 362 ASSERT_TRUE(AllProfilesHaveSameAppsAsVerifier());
362 } 363 }
363 364
364 // Install the same app on both clients, then sync. Change the app launch 365 // Install the same app on both clients, then sync. Change the app launch
365 // ordinal on one client and sync. Both clients should have the updated app 366 // ordinal on one client and sync. Both clients should have the updated app
366 // launch ordinal for the app. 367 // launch ordinal for the app.
367 IN_PROC_BROWSER_TEST_F(TwoClientAppsSyncTest, UpdateAppLaunchOrdinal) { 368 IN_PROC_BROWSER_TEST_F(TwoClientAppsSyncTest, UpdateAppLaunchOrdinal) {
368 ASSERT_TRUE(SetupSync()); 369 ASSERT_TRUE(SetupSync());
369 ASSERT_TRUE(AllProfilesHaveSameAppsAsVerifier()); 370 ASSERT_TRUE(AllProfilesHaveSameAppsAsVerifier());
370 371
371 syncer::StringOrdinal initial_position =
372 syncer::StringOrdinal::CreateInitialOrdinal();
373 InstallApp(GetProfile(0), 0); 372 InstallApp(GetProfile(0), 0);
374 InstallApp(GetProfile(1), 0); 373 InstallApp(GetProfile(1), 0);
375 InstallApp(verifier(), 0); 374 InstallApp(verifier(), 0);
376 ASSERT_TRUE(AwaitQuiescence()); 375 ASSERT_TRUE(AwaitQuiescence());
377 ASSERT_TRUE(AllProfilesHaveSameAppsAsVerifier()); 376 ASSERT_TRUE(AllProfilesHaveSameAppsAsVerifier());
378 377
378 syncer::StringOrdinal initial_position =
379 GetAppLaunchOrdinalForApp(GetProfile(0), 0);
380
379 syncer::StringOrdinal second_position = initial_position.CreateAfter(); 381 syncer::StringOrdinal second_position = initial_position.CreateAfter();
380 SetAppLaunchOrdinalForApp(GetProfile(0), 0, second_position); 382 SetAppLaunchOrdinalForApp(GetProfile(0), 0, second_position);
381 SetAppLaunchOrdinalForApp(verifier(), 0, second_position); 383 SetAppLaunchOrdinalForApp(verifier(), 0, second_position);
382 ASSERT_TRUE(AwaitQuiescence()); 384 ASSERT_TRUE(AwaitQuiescence());
383 ASSERT_TRUE(AllProfilesHaveSameAppsAsVerifier()); 385 ASSERT_TRUE(AllProfilesHaveSameAppsAsVerifier());
384 } 386 }
385 387
386 // Adjust the CWS location within a page on the first client and sync. Adjust 388 // Adjust the CWS location within a page on the first client and sync. Adjust
387 // which page the CWS appears on and sync. Both clients should have the same 389 // which page the CWS appears on and sync. Both clients should have the same
388 // page and app launch ordinal values for the CWS. 390 // page and app launch ordinal values for the CWS.
(...skipping 26 matching lines...) Expand all
415 verifier()->GetExtensionService()->extension_prefs()-> 417 verifier()->GetExtensionService()->extension_prefs()->
416 extension_sorting()->SetPageOrdinal(extension_misc::kWebStoreAppId, 418 extension_sorting()->SetPageOrdinal(extension_misc::kWebStoreAppId,
417 cws_page_ordinal.CreateAfter()); 419 cws_page_ordinal.CreateAfter());
418 ASSERT_TRUE(AwaitQuiescence()); 420 ASSERT_TRUE(AwaitQuiescence());
419 ASSERT_TRUE(AllProfilesHaveSameAppsAsVerifier()); 421 ASSERT_TRUE(AllProfilesHaveSameAppsAsVerifier());
420 } 422 }
421 423
422 // TODO(akalin): Add tests exercising: 424 // TODO(akalin): Add tests exercising:
423 // - Offline installation/uninstallation behavior 425 // - Offline installation/uninstallation behavior
424 // - App-specific properties 426 // - App-specific properties
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698