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 "chrome/browser/extensions/extension_service.h" | 6 #include "chrome/browser/extensions/extension_service.h" |
7 #include "chrome/browser/extensions/launch_util.h" | 7 #include "chrome/browser/extensions/launch_util.h" |
8 #include "chrome/browser/profiles/profile.h" | 8 #include "chrome/browser/profiles/profile.h" |
9 #include "chrome/browser/sync/test/integration/apps_helper.h" | 9 #include "chrome/browser/sync/test/integration/apps_helper.h" |
10 #include "chrome/browser/sync/test/integration/profile_sync_service_harness.h" | 10 #include "chrome/browser/sync/test/integration/profile_sync_service_harness.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 "extensions/browser/app_sorting.h" | 14 #include "extensions/browser/app_sorting.h" |
| 15 #include "extensions/browser/extension_prefs.h" |
15 #include "sync/api/string_ordinal.h" | 16 #include "sync/api/string_ordinal.h" |
16 | 17 |
17 using apps_helper::AllProfilesHaveSameAppsAsVerifier; | 18 using apps_helper::AllProfilesHaveSameAppsAsVerifier; |
18 using apps_helper::CopyNTPOrdinals; | 19 using apps_helper::CopyNTPOrdinals; |
19 using apps_helper::DisableApp; | 20 using apps_helper::DisableApp; |
20 using apps_helper::EnableApp; | 21 using apps_helper::EnableApp; |
21 using apps_helper::FixNTPOrdinalCollisions; | 22 using apps_helper::FixNTPOrdinalCollisions; |
22 using apps_helper::GetAppLaunchOrdinalForApp; | 23 using apps_helper::GetAppLaunchOrdinalForApp; |
23 using apps_helper::HasSameAppsAsVerifier; | 24 using apps_helper::HasSameAppsAsVerifier; |
24 using apps_helper::IncognitoDisableApp; | 25 using apps_helper::IncognitoDisableApp; |
(...skipping 364 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
389 | 390 |
390 // Adjust the CWS location within a page on the first client and sync. Adjust | 391 // Adjust the CWS location within a page on the first client and sync. Adjust |
391 // which page the CWS appears on and sync. Both clients should have the same | 392 // which page the CWS appears on and sync. Both clients should have the same |
392 // page and app launch ordinal values for the CWS. | 393 // page and app launch ordinal values for the CWS. |
393 IN_PROC_BROWSER_TEST_F(TwoClientAppsSyncTest, UpdateCWSOrdinals) { | 394 IN_PROC_BROWSER_TEST_F(TwoClientAppsSyncTest, UpdateCWSOrdinals) { |
394 ASSERT_TRUE(SetupSync()); | 395 ASSERT_TRUE(SetupSync()); |
395 ASSERT_TRUE(AllProfilesHaveSameAppsAsVerifier()); | 396 ASSERT_TRUE(AllProfilesHaveSameAppsAsVerifier()); |
396 | 397 |
397 // Change the app launch ordinal. | 398 // Change the app launch ordinal. |
398 syncer::StringOrdinal cws_app_launch_ordinal = | 399 syncer::StringOrdinal cws_app_launch_ordinal = |
399 GetProfile(0)->GetExtensionService()-> | 400 extensions::ExtensionPrefs::Get(GetProfile(0)) |
400 extension_prefs()->app_sorting()->GetAppLaunchOrdinal( | 401 ->app_sorting() |
401 extension_misc::kWebStoreAppId); | 402 ->GetAppLaunchOrdinal(extension_misc::kWebStoreAppId); |
402 GetProfile(0)->GetExtensionService()->extension_prefs()->app_sorting()-> | 403 extensions::ExtensionPrefs::Get(GetProfile(0)) |
403 SetAppLaunchOrdinal( | 404 ->app_sorting() |
404 extension_misc::kWebStoreAppId, cws_app_launch_ordinal.CreateAfter()); | 405 ->SetAppLaunchOrdinal(extension_misc::kWebStoreAppId, |
405 verifier()->GetExtensionService()->extension_prefs()->app_sorting()-> | 406 cws_app_launch_ordinal.CreateAfter()); |
406 SetAppLaunchOrdinal( | 407 extensions::ExtensionPrefs::Get(verifier()) |
407 extension_misc::kWebStoreAppId, cws_app_launch_ordinal.CreateAfter()); | 408 ->app_sorting() |
| 409 ->SetAppLaunchOrdinal(extension_misc::kWebStoreAppId, |
| 410 cws_app_launch_ordinal.CreateAfter()); |
408 ASSERT_TRUE(AwaitQuiescence()); | 411 ASSERT_TRUE(AwaitQuiescence()); |
409 ASSERT_TRUE(AllProfilesHaveSameAppsAsVerifier()); | 412 ASSERT_TRUE(AllProfilesHaveSameAppsAsVerifier()); |
410 | 413 |
411 // Change the page ordinal. | 414 // Change the page ordinal. |
412 syncer::StringOrdinal cws_page_ordinal = | 415 syncer::StringOrdinal cws_page_ordinal = |
413 GetProfile(1)->GetExtensionService()-> | 416 extensions::ExtensionPrefs::Get(GetProfile(1)) |
414 extension_prefs()->app_sorting()->GetPageOrdinal( | 417 ->app_sorting() |
415 extension_misc::kWebStoreAppId); | 418 ->GetPageOrdinal(extension_misc::kWebStoreAppId); |
416 GetProfile(1)->GetExtensionService()->extension_prefs()-> | 419 extensions::ExtensionPrefs::Get(GetProfile(1))->app_sorting()->SetPageOrdinal( |
417 app_sorting()->SetPageOrdinal(extension_misc::kWebStoreAppId, | 420 extension_misc::kWebStoreAppId, cws_page_ordinal.CreateAfter()); |
418 cws_page_ordinal.CreateAfter()); | 421 extensions::ExtensionPrefs::Get(verifier())->app_sorting()->SetPageOrdinal( |
419 verifier()->GetExtensionService()->extension_prefs()-> | 422 extension_misc::kWebStoreAppId, cws_page_ordinal.CreateAfter()); |
420 app_sorting()->SetPageOrdinal(extension_misc::kWebStoreAppId, | |
421 cws_page_ordinal.CreateAfter()); | |
422 ASSERT_TRUE(AwaitQuiescence()); | 423 ASSERT_TRUE(AwaitQuiescence()); |
423 ASSERT_TRUE(AllProfilesHaveSameAppsAsVerifier()); | 424 ASSERT_TRUE(AllProfilesHaveSameAppsAsVerifier()); |
424 } | 425 } |
425 | 426 |
426 // Adjust the launch type on the first client and sync. Both clients should | 427 // Adjust the launch type on the first client and sync. Both clients should |
427 // have the same launch type values for the CWS. | 428 // have the same launch type values for the CWS. |
428 IN_PROC_BROWSER_TEST_F(TwoClientAppsSyncTest, UpdateLaunchType) { | 429 IN_PROC_BROWSER_TEST_F(TwoClientAppsSyncTest, UpdateLaunchType) { |
429 ASSERT_TRUE(SetupSync()); | 430 ASSERT_TRUE(SetupSync()); |
430 ASSERT_TRUE(AllProfilesHaveSameAppsAsVerifier()); | 431 ASSERT_TRUE(AllProfilesHaveSameAppsAsVerifier()); |
431 | 432 |
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
488 extension_sync_service->ProcessAppSyncData(invalid_launch_type_data); | 489 extension_sync_service->ProcessAppSyncData(invalid_launch_type_data); |
489 | 490 |
490 // The launch type should remain the same. | 491 // The launch type should remain the same. |
491 ASSERT_TRUE(AwaitQuiescence()); | 492 ASSERT_TRUE(AwaitQuiescence()); |
492 ASSERT_TRUE(AllProfilesHaveSameAppsAsVerifier()); | 493 ASSERT_TRUE(AllProfilesHaveSameAppsAsVerifier()); |
493 } | 494 } |
494 | 495 |
495 // TODO(akalin): Add tests exercising: | 496 // TODO(akalin): Add tests exercising: |
496 // - Offline installation/uninstallation behavior | 497 // - Offline installation/uninstallation behavior |
497 // - App-specific properties | 498 // - App-specific properties |
OLD | NEW |