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

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: fix test 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 size_t num_extensions =
519 GetProfile(0)->GetExtensionService()->extensions()->size();
520
521 WebApplicationInfo web_app_info;
522 web_app_info.app_url = GURL("http://www.chromium.org");
523 web_app_info.title = base::UTF8ToUTF16("Test name");
524 web_app_info.description = base::UTF8ToUTF16("Test description");
525 ++num_extensions;
526 {
527 content::WindowedNotificationObserver windowed_observer(
528 chrome::NOTIFICATION_CRX_INSTALLER_DONE,
529 content::NotificationService::AllSources());
530 extensions::CreateOrUpdateBookmarkApp(GetProfile(0)->GetExtensionService(),
531 web_app_info);
532 windowed_observer.Wait();
533 EXPECT_EQ(num_extensions,
534 extensions::ExtensionRegistry::Get(GetProfile(0))
535 ->enabled_extensions()
536 .size());
537 }
538 {
539 content::WindowedNotificationObserver windowed_observer(
540 chrome::NOTIFICATION_CRX_INSTALLER_DONE,
541 content::NotificationService::AllSources());
542 extensions::CreateOrUpdateBookmarkApp(verifier()->GetExtensionService(),
543 web_app_info);
544 windowed_observer.Wait();
545 EXPECT_EQ(num_extensions,
546 extensions::ExtensionRegistry::Get(verifier())
547 ->enabled_extensions()
548 .size());
549 }
550 {
551 // Wait for the synced app to install.
552 content::WindowedNotificationObserver windowed_observer(
553 chrome::NOTIFICATION_CRX_INSTALLER_DONE,
554 content::NotificationService::AllSources());
555 ASSERT_TRUE(AwaitQuiescence());
556 windowed_observer.Wait();
557 ASSERT_TRUE(AllProfilesHaveSameAppsAsVerifier());
558 }
559 }
508 // TODO(akalin): Add tests exercising: 560 // TODO(akalin): Add tests exercising:
509 // - Offline installation/uninstallation behavior 561 // - Offline installation/uninstallation behavior
510 // - App-specific properties 562 // - App-specific properties
OLDNEW
« no previous file with comments | « chrome/browser/sync/test/integration/sync_app_helper.cc ('k') | sync/protocol/app_specifics.proto » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698