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

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

Issue 229553003: Implement syncing of bookmark apps. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase Created 6 years, 8 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
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/strings/utf_string_conversions.h"
7 #include "chrome/browser/chrome_notification_types.h"
8 #include "chrome/browser/extensions/bookmark_app_helper.h"
6 #include "chrome/browser/extensions/extension_service.h" 9 #include "chrome/browser/extensions/extension_service.h"
7 #include "chrome/browser/extensions/launch_util.h" 10 #include "chrome/browser/extensions/launch_util.h"
8 #include "chrome/browser/profiles/profile.h" 11 #include "chrome/browser/profiles/profile.h"
9 #include "chrome/browser/sync/test/integration/apps_helper.h" 12 #include "chrome/browser/sync/test/integration/apps_helper.h"
10 #include "chrome/browser/sync/test/integration/profile_sync_service_harness.h" 13 #include "chrome/browser/sync/test/integration/profile_sync_service_harness.h"
11 #include "chrome/browser/sync/test/integration/sync_app_helper.h" 14 #include "chrome/browser/sync/test/integration/sync_app_helper.h"
12 #include "chrome/browser/sync/test/integration/sync_integration_test_util.h" 15 #include "chrome/browser/sync/test/integration/sync_integration_test_util.h"
13 #include "chrome/browser/sync/test/integration/sync_test.h" 16 #include "chrome/browser/sync/test/integration/sync_test.h"
14 #include "chrome/common/extensions/extension_constants.h" 17 #include "chrome/common/extensions/extension_constants.h"
18 #include "content/public/browser/notification_service.h"
19 #include "content/public/test/test_utils.h"
15 #include "extensions/browser/app_sorting.h" 20 #include "extensions/browser/app_sorting.h"
16 #include "extensions/browser/extension_prefs.h" 21 #include "extensions/browser/extension_prefs.h"
22 #include "extensions/browser/extension_registry.h"
17 #include "sync/api/string_ordinal.h" 23 #include "sync/api/string_ordinal.h"
18 24
19 using apps_helper::AllProfilesHaveSameAppsAsVerifier; 25 using apps_helper::AllProfilesHaveSameAppsAsVerifier;
20 using apps_helper::CopyNTPOrdinals; 26 using apps_helper::CopyNTPOrdinals;
21 using apps_helper::DisableApp; 27 using apps_helper::DisableApp;
22 using apps_helper::EnableApp; 28 using apps_helper::EnableApp;
23 using apps_helper::FixNTPOrdinalCollisions; 29 using apps_helper::FixNTPOrdinalCollisions;
24 using apps_helper::GetAppLaunchOrdinalForApp; 30 using apps_helper::GetAppLaunchOrdinalForApp;
25 using apps_helper::HasSameAppsAsVerifier; 31 using apps_helper::HasSameAppsAsVerifier;
26 using apps_helper::IncognitoDisableApp; 32 using apps_helper::IncognitoDisableApp;
(...skipping 471 matching lines...) Expand 10 before | Expand all | Expand 10 after
498 original_data.app_launch_ordinal(), 504 original_data.app_launch_ordinal(),
499 original_data.page_ordinal(), 505 original_data.page_ordinal(),
500 extensions::NUM_LAUNCH_TYPES); 506 extensions::NUM_LAUNCH_TYPES);
501 extension_sync_service->ProcessAppSyncData(invalid_launch_type_data); 507 extension_sync_service->ProcessAppSyncData(invalid_launch_type_data);
502 508
503 // The launch type should remain the same. 509 // The launch type should remain the same.
504 ASSERT_TRUE(AwaitQuiescence()); 510 ASSERT_TRUE(AwaitQuiescence());
505 ASSERT_TRUE(AllProfilesHaveSameAppsAsVerifier()); 511 ASSERT_TRUE(AllProfilesHaveSameAppsAsVerifier());
506 } 512 }
507 513
514 IN_PROC_BROWSER_TEST_F(TwoClientAppsSyncTest, BookmarkApp) {
515 ASSERT_TRUE(SetupSync());
516 ASSERT_TRUE(AllProfilesHaveSameAppsAsVerifier());
517
518 EXPECT_EQ(4u, GetProfile(0)->GetExtensionService()->extensions()->size());
519 EXPECT_EQ(4u, verifier()->GetExtensionService()->extensions()->size());
520 WebApplicationInfo web_app_info;
521 web_app_info.app_url = GURL("http://www.chromium.org");
522 web_app_info.title = base::UTF8ToUTF16("Test name");
523 web_app_info.description = base::UTF8ToUTF16("Test description");
524 {
525 content::WindowedNotificationObserver windowed_observer(
526 chrome::NOTIFICATION_CRX_INSTALLER_DONE,
527 content::NotificationService::AllSources());
528 extensions::CreateOrUpdateBookmarkApp(GetProfile(0)->GetExtensionService(),
529 web_app_info);
530 windowed_observer.Wait();
531 EXPECT_EQ(5u,
532 extensions::ExtensionRegistry::Get(GetProfile(0))
533 ->enabled_extensions()
534 .size());
535 }
536 {
537 content::WindowedNotificationObserver windowed_observer(
538 chrome::NOTIFICATION_CRX_INSTALLER_DONE,
539 content::NotificationService::AllSources());
540 extensions::CreateOrUpdateBookmarkApp(verifier()->GetExtensionService(),
541 web_app_info);
542 windowed_observer.Wait();
543 EXPECT_EQ(5u,
544 extensions::ExtensionRegistry::Get(verifier())
545 ->enabled_extensions()
546 .size());
547 }
548 {
549 // Wait for the synced app to install.
550 content::WindowedNotificationObserver windowed_observer(
551 chrome::NOTIFICATION_CRX_INSTALLER_DONE,
552 content::NotificationService::AllSources());
553 ASSERT_TRUE(AwaitQuiescence());
554 windowed_observer.Wait();
555 ASSERT_TRUE(AllProfilesHaveSameAppsAsVerifier());
556 }
557 }
508 // TODO(akalin): Add tests exercising: 558 // TODO(akalin): Add tests exercising:
509 // - Offline installation/uninstallation behavior 559 // - Offline installation/uninstallation behavior
510 // - App-specific properties 560 // - App-specific properties
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698