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

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

Issue 10920017: [Sync] Generalize StringOrdinal to handle ordinal_in_parent field (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Relax tests Created 8 years, 3 months 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 "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 15
15 using apps_helper::AllProfilesHaveSameAppsAsVerifier; 16 using apps_helper::AllProfilesHaveSameAppsAsVerifier;
16 using apps_helper::CopyNTPOrdinals; 17 using apps_helper::CopyNTPOrdinals;
17 using apps_helper::DisableApp; 18 using apps_helper::DisableApp;
18 using apps_helper::EnableApp; 19 using apps_helper::EnableApp;
19 using apps_helper::FixNTPOrdinalCollisions; 20 using apps_helper::FixNTPOrdinalCollisions;
20 using apps_helper::HasSameAppsAsVerifier; 21 using apps_helper::HasSameAppsAsVerifier;
21 using apps_helper::IncognitoDisableApp; 22 using apps_helper::IncognitoDisableApp;
22 using apps_helper::IncognitoEnableApp; 23 using apps_helper::IncognitoEnableApp;
23 using apps_helper::InstallApp; 24 using apps_helper::InstallApp;
(...skipping 306 matching lines...) Expand 10 before | Expand all | Expand 10 after
330 ASSERT_TRUE(AllProfilesHaveSameAppsAsVerifier()); 331 ASSERT_TRUE(AllProfilesHaveSameAppsAsVerifier());
331 } 332 }
332 333
333 // Install the same app on both clients, then sync. Change the page ordinal on 334 // Install the same app on both clients, then sync. Change the page ordinal on
334 // one client and sync. Both clients should have the updated page ordinal for 335 // one client and sync. Both clients should have the updated page ordinal for
335 // the app. 336 // the app.
336 IN_PROC_BROWSER_TEST_F(TwoClientAppsSyncTest, UpdatePageOrdinal) { 337 IN_PROC_BROWSER_TEST_F(TwoClientAppsSyncTest, UpdatePageOrdinal) {
337 ASSERT_TRUE(SetupSync()); 338 ASSERT_TRUE(SetupSync());
338 ASSERT_TRUE(AllProfilesHaveSameAppsAsVerifier()); 339 ASSERT_TRUE(AllProfilesHaveSameAppsAsVerifier());
339 340
340 StringOrdinal initial_page = StringOrdinal::CreateInitialOrdinal(); 341 syncer::StringOrdinal initial_page =
342 syncer::StringOrdinal::CreateInitialOrdinal();
341 InstallApp(GetProfile(0), 0); 343 InstallApp(GetProfile(0), 0);
342 InstallApp(GetProfile(1), 0); 344 InstallApp(GetProfile(1), 0);
343 InstallApp(verifier(), 0); 345 InstallApp(verifier(), 0);
344 ASSERT_TRUE(AwaitQuiescence()); 346 ASSERT_TRUE(AwaitQuiescence());
345 ASSERT_TRUE(AllProfilesHaveSameAppsAsVerifier()); 347 ASSERT_TRUE(AllProfilesHaveSameAppsAsVerifier());
346 348
347 StringOrdinal second_page = initial_page.CreateAfter(); 349 syncer::StringOrdinal second_page = initial_page.CreateAfter();
348 SetPageOrdinalForApp(GetProfile(0), 0, second_page); 350 SetPageOrdinalForApp(GetProfile(0), 0, second_page);
349 SetPageOrdinalForApp(verifier(), 0, second_page); 351 SetPageOrdinalForApp(verifier(), 0, second_page);
350 ASSERT_TRUE(AwaitQuiescence()); 352 ASSERT_TRUE(AwaitQuiescence());
351 ASSERT_TRUE(AllProfilesHaveSameAppsAsVerifier()); 353 ASSERT_TRUE(AllProfilesHaveSameAppsAsVerifier());
352 } 354 }
353 355
354 // Install the same app on both clients, then sync. Change the app launch 356 // Install the same app on both clients, then sync. Change the app launch
355 // ordinal on one client and sync. Both clients should have the updated app 357 // ordinal on one client and sync. Both clients should have the updated app
356 // launch ordinal for the app. 358 // launch ordinal for the app.
357 IN_PROC_BROWSER_TEST_F(TwoClientAppsSyncTest, UpdateAppLaunchOrdinal) { 359 IN_PROC_BROWSER_TEST_F(TwoClientAppsSyncTest, UpdateAppLaunchOrdinal) {
358 ASSERT_TRUE(SetupSync()); 360 ASSERT_TRUE(SetupSync());
359 ASSERT_TRUE(AllProfilesHaveSameAppsAsVerifier()); 361 ASSERT_TRUE(AllProfilesHaveSameAppsAsVerifier());
360 362
361 StringOrdinal initial_position = StringOrdinal::CreateInitialOrdinal(); 363 syncer::StringOrdinal initial_position =
364 syncer::StringOrdinal::CreateInitialOrdinal();
362 InstallApp(GetProfile(0), 0); 365 InstallApp(GetProfile(0), 0);
363 InstallApp(GetProfile(1), 0); 366 InstallApp(GetProfile(1), 0);
364 InstallApp(verifier(), 0); 367 InstallApp(verifier(), 0);
365 ASSERT_TRUE(AwaitQuiescence()); 368 ASSERT_TRUE(AwaitQuiescence());
366 ASSERT_TRUE(AllProfilesHaveSameAppsAsVerifier()); 369 ASSERT_TRUE(AllProfilesHaveSameAppsAsVerifier());
367 370
368 StringOrdinal second_position = initial_position.CreateAfter(); 371 syncer::StringOrdinal second_position = initial_position.CreateAfter();
369 SetAppLaunchOrdinalForApp(GetProfile(0), 0, second_position); 372 SetAppLaunchOrdinalForApp(GetProfile(0), 0, second_position);
370 SetAppLaunchOrdinalForApp(verifier(), 0, second_position); 373 SetAppLaunchOrdinalForApp(verifier(), 0, second_position);
371 ASSERT_TRUE(AwaitQuiescence()); 374 ASSERT_TRUE(AwaitQuiescence());
372 ASSERT_TRUE(AllProfilesHaveSameAppsAsVerifier()); 375 ASSERT_TRUE(AllProfilesHaveSameAppsAsVerifier());
373 } 376 }
374 377
375 // Adjust the CWS location within a page on the first client and sync. Adjust 378 // Adjust the CWS location within a page on the first client and sync. Adjust
376 // which page the CWS appears on and sync. Both clients should have the same 379 // which page the CWS appears on and sync. Both clients should have the same
377 // page and app launch ordinal values for the CWS. 380 // page and app launch ordinal values for the CWS.
378 IN_PROC_BROWSER_TEST_F(TwoClientAppsSyncTest, UpdateCWSOrdinals) { 381 IN_PROC_BROWSER_TEST_F(TwoClientAppsSyncTest, UpdateCWSOrdinals) {
379 ASSERT_TRUE(SetupSync()); 382 ASSERT_TRUE(SetupSync());
380 ASSERT_TRUE(AllProfilesHaveSameAppsAsVerifier()); 383 ASSERT_TRUE(AllProfilesHaveSameAppsAsVerifier());
381 384
382 // Change the app launch ordinal. 385 // Change the app launch ordinal.
383 StringOrdinal cws_app_launch_ordinal = GetProfile(0)->GetExtensionService()-> 386 syncer::StringOrdinal cws_app_launch_ordinal =
387 GetProfile(0)->GetExtensionService()->
384 extension_prefs()->extension_sorting()->GetAppLaunchOrdinal( 388 extension_prefs()->extension_sorting()->GetAppLaunchOrdinal(
385 extension_misc::kWebStoreAppId); 389 extension_misc::kWebStoreAppId);
386 GetProfile(0)->GetExtensionService()->extension_prefs()->extension_sorting()-> 390 GetProfile(0)->GetExtensionService()->extension_prefs()->extension_sorting()->
387 SetAppLaunchOrdinal( 391 SetAppLaunchOrdinal(
388 extension_misc::kWebStoreAppId, cws_app_launch_ordinal.CreateAfter()); 392 extension_misc::kWebStoreAppId, cws_app_launch_ordinal.CreateAfter());
389 verifier()->GetExtensionService()->extension_prefs()->extension_sorting()-> 393 verifier()->GetExtensionService()->extension_prefs()->extension_sorting()->
390 SetAppLaunchOrdinal( 394 SetAppLaunchOrdinal(
391 extension_misc::kWebStoreAppId, cws_app_launch_ordinal.CreateAfter()); 395 extension_misc::kWebStoreAppId, cws_app_launch_ordinal.CreateAfter());
392 ASSERT_TRUE(AwaitQuiescence()); 396 ASSERT_TRUE(AwaitQuiescence());
393 ASSERT_TRUE(AllProfilesHaveSameAppsAsVerifier()); 397 ASSERT_TRUE(AllProfilesHaveSameAppsAsVerifier());
394 398
395 // Change the page ordinal. 399 // Change the page ordinal.
396 StringOrdinal cws_page_ordinal = GetProfile(1)->GetExtensionService()-> 400 syncer::StringOrdinal cws_page_ordinal =
401 GetProfile(1)->GetExtensionService()->
397 extension_prefs()->extension_sorting()->GetPageOrdinal( 402 extension_prefs()->extension_sorting()->GetPageOrdinal(
398 extension_misc::kWebStoreAppId); 403 extension_misc::kWebStoreAppId);
399 GetProfile(1)->GetExtensionService()->extension_prefs()-> 404 GetProfile(1)->GetExtensionService()->extension_prefs()->
400 extension_sorting()->SetPageOrdinal(extension_misc::kWebStoreAppId, 405 extension_sorting()->SetPageOrdinal(extension_misc::kWebStoreAppId,
401 cws_page_ordinal.CreateAfter()); 406 cws_page_ordinal.CreateAfter());
402 verifier()->GetExtensionService()->extension_prefs()-> 407 verifier()->GetExtensionService()->extension_prefs()->
403 extension_sorting()->SetPageOrdinal(extension_misc::kWebStoreAppId, 408 extension_sorting()->SetPageOrdinal(extension_misc::kWebStoreAppId,
404 cws_page_ordinal.CreateAfter()); 409 cws_page_ordinal.CreateAfter());
405 ASSERT_TRUE(AwaitQuiescence()); 410 ASSERT_TRUE(AwaitQuiescence());
406 ASSERT_TRUE(AllProfilesHaveSameAppsAsVerifier()); 411 ASSERT_TRUE(AllProfilesHaveSameAppsAsVerifier());
407 } 412 }
408 413
409 // TODO(akalin): Add tests exercising: 414 // TODO(akalin): Add tests exercising:
410 // - Offline installation/uninstallation behavior 415 // - Offline installation/uninstallation behavior
411 // - App-specific properties 416 // - App-specific properties
OLDNEW
« no previous file with comments | « chrome/browser/sync/test/integration/sync_extension_helper.cc ('k') | chrome/browser/ui/panels/base_panel_browser_test.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698