| 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/common/extensions/extension_constants.h" | 6 #include "chrome/common/extensions/extension_constants.h" |
| 7 #include "chrome/browser/extensions/extension_service.h" | 7 #include "chrome/browser/extensions/extension_service.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" |
| 13 | 14 |
| 14 using apps_helper::AllProfilesHaveSameAppsAsVerifier; | 15 using apps_helper::AllProfilesHaveSameAppsAsVerifier; |
| 15 using apps_helper::CopyNTPOrdinals; | 16 using apps_helper::CopyNTPOrdinals; |
| 16 using apps_helper::DisableApp; | 17 using apps_helper::DisableApp; |
| 17 using apps_helper::EnableApp; | 18 using apps_helper::EnableApp; |
| (...skipping 354 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 372 } | 373 } |
| 373 | 374 |
| 374 // Adjust the CWS location within a page on the first client and sync. Adjust | 375 // Adjust the CWS location within a page on the first client and sync. Adjust |
| 375 // which page the CWS appears on and sync. Both clients should have the same | 376 // which page the CWS appears on and sync. Both clients should have the same |
| 376 // page and app launch ordinal values for the CWS. | 377 // page and app launch ordinal values for the CWS. |
| 377 IN_PROC_BROWSER_TEST_F(TwoClientAppsSyncTest, UpdateCWSOrdinals) { | 378 IN_PROC_BROWSER_TEST_F(TwoClientAppsSyncTest, UpdateCWSOrdinals) { |
| 378 ASSERT_TRUE(SetupSync()); | 379 ASSERT_TRUE(SetupSync()); |
| 379 ASSERT_TRUE(AllProfilesHaveSameAppsAsVerifier()); | 380 ASSERT_TRUE(AllProfilesHaveSameAppsAsVerifier()); |
| 380 | 381 |
| 381 // Change the app launch ordinal. | 382 // Change the app launch ordinal. |
| 382 StringOrdinal cws_app_launch_ordinal = | 383 StringOrdinal cws_app_launch_ordinal = GetProfile(0)->GetExtensionService()-> |
| 383 GetProfile(0)->GetExtensionService()->GetAppLaunchOrdinal( | 384 extension_prefs()->extension_sorting()->GetAppLaunchOrdinal( |
| 384 extension_misc::kWebStoreAppId); | 385 extension_misc::kWebStoreAppId); |
| 385 GetProfile(0)->GetExtensionService()->SetAppLaunchOrdinal( | 386 GetProfile(0)->GetExtensionService()->extension_prefs()->extension_sorting()-> |
| 386 extension_misc::kWebStoreAppId, cws_app_launch_ordinal.CreateAfter()); | 387 SetAppLaunchOrdinal( |
| 387 verifier()->GetExtensionService()->SetAppLaunchOrdinal( | 388 extension_misc::kWebStoreAppId, cws_app_launch_ordinal.CreateAfter()); |
| 388 extension_misc::kWebStoreAppId, cws_app_launch_ordinal.CreateAfter()); | 389 verifier()->GetExtensionService()->extension_prefs()->extension_sorting()-> |
| 390 SetAppLaunchOrdinal( |
| 391 extension_misc::kWebStoreAppId, cws_app_launch_ordinal.CreateAfter()); |
| 389 ASSERT_TRUE(AwaitQuiescence()); | 392 ASSERT_TRUE(AwaitQuiescence()); |
| 390 ASSERT_TRUE(AllProfilesHaveSameAppsAsVerifier()); | 393 ASSERT_TRUE(AllProfilesHaveSameAppsAsVerifier()); |
| 391 | 394 |
| 392 // Change the page ordinal. | 395 // Change the page ordinal. |
| 393 StringOrdinal cws_page_ordinal = | 396 StringOrdinal cws_page_ordinal = GetProfile(1)->GetExtensionService()-> |
| 394 GetProfile(1)->GetExtensionService()->GetPageOrdinal( | 397 extension_prefs()->extension_sorting()->GetPageOrdinal( |
| 395 extension_misc::kWebStoreAppId); | 398 extension_misc::kWebStoreAppId); |
| 396 GetProfile(1)->GetExtensionService()->SetPageOrdinal( | 399 GetProfile(1)->GetExtensionService()->extension_prefs()-> |
| 397 extension_misc::kWebStoreAppId, cws_page_ordinal.CreateAfter()); | 400 extension_sorting()->SetPageOrdinal(extension_misc::kWebStoreAppId, |
| 398 verifier()->GetExtensionService()->SetPageOrdinal( | 401 cws_page_ordinal.CreateAfter()); |
| 399 extension_misc::kWebStoreAppId, cws_page_ordinal.CreateAfter()); | 402 verifier()->GetExtensionService()->extension_prefs()-> |
| 403 extension_sorting()->SetPageOrdinal(extension_misc::kWebStoreAppId, |
| 404 cws_page_ordinal.CreateAfter()); |
| 400 ASSERT_TRUE(AwaitQuiescence()); | 405 ASSERT_TRUE(AwaitQuiescence()); |
| 401 ASSERT_TRUE(AllProfilesHaveSameAppsAsVerifier()); | 406 ASSERT_TRUE(AllProfilesHaveSameAppsAsVerifier()); |
| 402 } | 407 } |
| 403 | 408 |
| 404 // TODO(akalin): Add tests exercising: | 409 // TODO(akalin): Add tests exercising: |
| 405 // - Offline installation/uninstallation behavior | 410 // - Offline installation/uninstallation behavior |
| 406 // - App-specific properties | 411 // - App-specific properties |
| OLD | NEW |