Upstream version 10.39.225.0
[platform/framework/web/crosswalk.git] / src / chrome / browser / sync / test / integration / two_client_apps_sync_test.cc
index 4e1464a..cf43cd1 100644 (file)
@@ -5,8 +5,10 @@
 #include "base/basictypes.h"
 #include "base/strings/utf_string_conversions.h"
 #include "chrome/browser/chrome_notification_types.h"
+#include "chrome/browser/extensions/app_sync_data.h"
 #include "chrome/browser/extensions/bookmark_app_helper.h"
 #include "chrome/browser/extensions/extension_service.h"
+#include "chrome/browser/extensions/extension_sync_service.h"
 #include "chrome/browser/extensions/launch_util.h"
 #include "chrome/browser/profiles/profile.h"
 #include "chrome/browser/sync/test/integration/apps_helper.h"
 #include "chrome/browser/sync/test/integration/sync_app_helper.h"
 #include "chrome/browser/sync/test/integration/sync_integration_test_util.h"
 #include "chrome/browser/sync/test/integration/sync_test.h"
-#include "chrome/common/extensions/extension_constants.h"
 #include "content/public/browser/notification_service.h"
 #include "content/public/test/test_utils.h"
 #include "extensions/browser/app_sorting.h"
 #include "extensions/browser/extension_prefs.h"
 #include "extensions/browser/extension_registry.h"
+#include "extensions/browser/extension_system.h"
+#include "extensions/common/constants.h"
 #include "sync/api/string_ordinal.h"
 
 using apps_helper::AllProfilesHaveSameAppsAsVerifier;
@@ -32,12 +35,23 @@ using apps_helper::HasSameAppsAsVerifier;
 using apps_helper::IncognitoDisableApp;
 using apps_helper::IncognitoEnableApp;
 using apps_helper::InstallApp;
-using apps_helper::InstallAppsPendingForSync;
 using apps_helper::InstallPlatformApp;
 using apps_helper::SetAppLaunchOrdinalForApp;
 using apps_helper::SetPageOrdinalForApp;
 using apps_helper::UninstallApp;
-using sync_integration_test_util::AwaitCommitActivityCompletion;
+using apps_helper::AwaitAllProfilesHaveSameAppsAsVerifier;
+
+namespace {
+
+extensions::ExtensionRegistry* GetExtensionRegistry(Profile* profile) {
+  return extensions::ExtensionRegistry::Get(profile);
+}
+
+ExtensionService* GetExtensionService(Profile* profile) {
+  return extensions::ExtensionSystem::Get(profile)->extension_service();
+}
+
+}  // namespace
 
 class TwoClientAppsSyncTest : public SyncTest {
  public:
@@ -45,24 +59,16 @@ class TwoClientAppsSyncTest : public SyncTest {
 
   virtual ~TwoClientAppsSyncTest() {}
 
- private:
-  DISALLOW_COPY_AND_ASSIGN(TwoClientAppsSyncTest);
-};
-
-class LegacyTwoClientAppsSyncTest : public SyncTest {
- public:
-  LegacyTwoClientAppsSyncTest() : SyncTest(TWO_CLIENT_LEGACY) {}
-
-  virtual ~LegacyTwoClientAppsSyncTest() {}
+  virtual bool TestUsesSelfNotifications() OVERRIDE { return false; }
 
  private:
-  DISALLOW_COPY_AND_ASSIGN(LegacyTwoClientAppsSyncTest);
+  DISALLOW_COPY_AND_ASSIGN(TwoClientAppsSyncTest);
 };
 
 IN_PROC_BROWSER_TEST_F(TwoClientAppsSyncTest, StartWithNoApps) {
   ASSERT_TRUE(SetupSync());
 
-  ASSERT_TRUE(AllProfilesHaveSameAppsAsVerifier());
+  ASSERT_TRUE(AwaitAllProfilesHaveSameAppsAsVerifier());
 }
 
 IN_PROC_BROWSER_TEST_F(TwoClientAppsSyncTest, StartWithSameApps) {
@@ -77,9 +83,7 @@ IN_PROC_BROWSER_TEST_F(TwoClientAppsSyncTest, StartWithSameApps) {
 
   ASSERT_TRUE(SetupSync());
 
-  ASSERT_TRUE(AwaitQuiescence());
-
-  ASSERT_TRUE(AllProfilesHaveSameAppsAsVerifier());
+  ASSERT_TRUE(AwaitAllProfilesHaveSameAppsAsVerifier());
 }
 
 // Install some apps on both clients, some on only one client, some on only the
@@ -122,12 +126,7 @@ IN_PROC_BROWSER_TEST_F(TwoClientAppsSyncTest, StartWithDifferentApps) {
 
   ASSERT_TRUE(SetupSync());
 
-  ASSERT_TRUE(AwaitQuiescence());
-
-  InstallAppsPendingForSync(GetProfile(0));
-  InstallAppsPendingForSync(GetProfile(1));
-
-  ASSERT_TRUE(AllProfilesHaveSameAppsAsVerifier());
+  ASSERT_TRUE(AwaitAllProfilesHaveSameAppsAsVerifier());
 }
 
 // Install some apps on both clients, then sync.  Then install some apps on only
@@ -147,8 +146,6 @@ IN_PROC_BROWSER_TEST_F(TwoClientAppsSyncTest, InstallDifferentApps) {
 
   ASSERT_TRUE(SetupSync());
 
-  ASSERT_TRUE(AwaitQuiescence());
-
   const int kNumProfile0Apps = 10;
   for (int j = 0; j < kNumProfile0Apps; ++i, ++j) {
     InstallApp(GetProfile(0), i);
@@ -165,12 +162,7 @@ IN_PROC_BROWSER_TEST_F(TwoClientAppsSyncTest, InstallDifferentApps) {
 
   FixNTPOrdinalCollisions(verifier());
 
-  ASSERT_TRUE(AwaitQuiescence());
-
-  InstallAppsPendingForSync(GetProfile(0));
-  InstallAppsPendingForSync(GetProfile(1));
-
-  ASSERT_TRUE(AllProfilesHaveSameAppsAsVerifier());
+  ASSERT_TRUE(AwaitAllProfilesHaveSameAppsAsVerifier());
 }
 
 // TCM ID - 3711279.
@@ -180,11 +172,8 @@ IN_PROC_BROWSER_TEST_F(TwoClientAppsSyncTest, Add) {
 
   InstallApp(GetProfile(0), 0);
   InstallApp(verifier(), 0);
-  ASSERT_TRUE(AwaitQuiescence());
 
-  InstallAppsPendingForSync(GetProfile(0));
-  InstallAppsPendingForSync(GetProfile(1));
-  ASSERT_TRUE(AllProfilesHaveSameAppsAsVerifier());
+  ASSERT_TRUE(AwaitAllProfilesHaveSameAppsAsVerifier());
 }
 
 // TCM ID - 3706267.
@@ -194,16 +183,11 @@ IN_PROC_BROWSER_TEST_F(TwoClientAppsSyncTest, Uninstall) {
 
   InstallApp(GetProfile(0), 0);
   InstallApp(verifier(), 0);
-  ASSERT_TRUE(AwaitQuiescence());
-
-  InstallAppsPendingForSync(GetProfile(0));
-  InstallAppsPendingForSync(GetProfile(1));
-  ASSERT_TRUE(AllProfilesHaveSameAppsAsVerifier());
+  ASSERT_TRUE(AwaitAllProfilesHaveSameAppsAsVerifier());
 
   UninstallApp(GetProfile(0), 0);
   UninstallApp(verifier(), 0);
-  ASSERT_TRUE(AwaitQuiescence());
-  ASSERT_TRUE(AllProfilesHaveSameAppsAsVerifier());
+  ASSERT_TRUE(AwaitAllProfilesHaveSameAppsAsVerifier());
 }
 
 // Install an app on one client, then sync. Then uninstall the app on the first
@@ -212,40 +196,34 @@ IN_PROC_BROWSER_TEST_F(TwoClientAppsSyncTest, Uninstall) {
 // ordinals.
 IN_PROC_BROWSER_TEST_F(TwoClientAppsSyncTest, UninstallThenInstall) {
   ASSERT_TRUE(SetupSync());
+
   ASSERT_TRUE(AllProfilesHaveSameAppsAsVerifier());
 
   InstallApp(GetProfile(0), 0);
   InstallApp(verifier(), 0);
-  ASSERT_TRUE(AwaitQuiescence());
-
-  InstallAppsPendingForSync(GetProfile(0));
-  InstallAppsPendingForSync(GetProfile(1));
-  ASSERT_TRUE(AllProfilesHaveSameAppsAsVerifier());
+  ASSERT_TRUE(AwaitAllProfilesHaveSameAppsAsVerifier());
 
   UninstallApp(GetProfile(0), 0);
   UninstallApp(verifier(), 0);
-  ASSERT_TRUE(AwaitQuiescence());
-  ASSERT_TRUE(AllProfilesHaveSameAppsAsVerifier());
+  ASSERT_TRUE(AwaitAllProfilesHaveSameAppsAsVerifier());
 
   InstallApp(GetProfile(0), 1);
   InstallApp(verifier(), 1);
-  ASSERT_TRUE(AwaitQuiescence());
-  InstallAppsPendingForSync(GetProfile(0));
-  InstallAppsPendingForSync(GetProfile(1));
-  ASSERT_TRUE(AllProfilesHaveSameAppsAsVerifier());
+  ASSERT_TRUE(AwaitAllProfilesHaveSameAppsAsVerifier());
 }
 
 // TCM ID - 3699295.
-// Flaky: http://crbug.com/226055
-IN_PROC_BROWSER_TEST_F(TwoClientAppsSyncTest, DISABLED_Merge) {
+IN_PROC_BROWSER_TEST_F(TwoClientAppsSyncTest, Merge) {
   ASSERT_TRUE(SetupSync());
   ASSERT_TRUE(AllProfilesHaveSameAppsAsVerifier());
 
   InstallApp(GetProfile(0), 0);
-  InstallApp(GetProfile(1), 0);
-  ASSERT_TRUE(AwaitQuiescence());
+  InstallApp(verifier(), 0);
+  ASSERT_TRUE(AwaitAllProfilesHaveSameAppsAsVerifier());
 
   UninstallApp(GetProfile(0), 0);
+  UninstallApp(verifier(), 0);
+
   InstallApp(GetProfile(0), 1);
   InstallApp(verifier(), 1);
 
@@ -256,10 +234,7 @@ IN_PROC_BROWSER_TEST_F(TwoClientAppsSyncTest, DISABLED_Merge) {
   InstallApp(GetProfile(1), 3);
   InstallApp(verifier(), 3);
 
-  ASSERT_TRUE(AwaitQuiescence());
-  InstallAppsPendingForSync(GetProfile(0));
-  InstallAppsPendingForSync(GetProfile(1));
-  ASSERT_TRUE(AllProfilesHaveSameAppsAsVerifier());
+  ASSERT_TRUE(AwaitAllProfilesHaveSameAppsAsVerifier());
 }
 
 // TCM ID - 7723126.
@@ -268,26 +243,22 @@ IN_PROC_BROWSER_TEST_F(TwoClientAppsSyncTest, UpdateEnableDisableApp) {
   ASSERT_TRUE(AllProfilesHaveSameAppsAsVerifier());
 
   InstallApp(GetProfile(0), 0);
-  InstallApp(GetProfile(1), 0);
   InstallApp(verifier(), 0);
-  ASSERT_TRUE(AwaitQuiescence());
-  ASSERT_TRUE(AllProfilesHaveSameAppsAsVerifier());
+  ASSERT_TRUE(AwaitAllProfilesHaveSameAppsAsVerifier());
 
   DisableApp(GetProfile(0), 0);
   DisableApp(verifier(), 0);
   ASSERT_TRUE(HasSameAppsAsVerifier(0));
   ASSERT_FALSE(HasSameAppsAsVerifier(1));
 
-  ASSERT_TRUE(AwaitQuiescence());
-  ASSERT_TRUE(AllProfilesHaveSameAppsAsVerifier());
+  ASSERT_TRUE(AwaitAllProfilesHaveSameAppsAsVerifier());
 
   EnableApp(GetProfile(1), 0);
   EnableApp(verifier(), 0);
   ASSERT_TRUE(HasSameAppsAsVerifier(1));
   ASSERT_FALSE(HasSameAppsAsVerifier(0));
 
-  ASSERT_TRUE(AwaitQuiescence());
-  ASSERT_TRUE(AllProfilesHaveSameAppsAsVerifier());
+  ASSERT_TRUE(AwaitAllProfilesHaveSameAppsAsVerifier());
 }
 
 // TCM ID - 7706637.
@@ -296,69 +267,22 @@ IN_PROC_BROWSER_TEST_F(TwoClientAppsSyncTest, UpdateIncognitoEnableDisable) {
   ASSERT_TRUE(AllProfilesHaveSameAppsAsVerifier());
 
   InstallApp(GetProfile(0), 0);
-  InstallApp(GetProfile(1), 0);
   InstallApp(verifier(), 0);
-  ASSERT_TRUE(AwaitQuiescence());
-  ASSERT_TRUE(AllProfilesHaveSameAppsAsVerifier());
+  ASSERT_TRUE(AwaitAllProfilesHaveSameAppsAsVerifier());
 
   IncognitoEnableApp(GetProfile(0), 0);
   IncognitoEnableApp(verifier(), 0);
   ASSERT_TRUE(HasSameAppsAsVerifier(0));
   ASSERT_FALSE(HasSameAppsAsVerifier(1));
 
-  ASSERT_TRUE(AwaitQuiescence());
-  ASSERT_TRUE(AllProfilesHaveSameAppsAsVerifier());
+  ASSERT_TRUE(AwaitAllProfilesHaveSameAppsAsVerifier());
 
   IncognitoDisableApp(GetProfile(1), 0);
   IncognitoDisableApp(verifier(), 0);
   ASSERT_TRUE(HasSameAppsAsVerifier(1));
   ASSERT_FALSE(HasSameAppsAsVerifier(0));
 
-  ASSERT_TRUE(AwaitQuiescence());
-  ASSERT_TRUE(AllProfilesHaveSameAppsAsVerifier());
-}
-
-// TCM ID - 3718276.
-IN_PROC_BROWSER_TEST_F(LegacyTwoClientAppsSyncTest, DisableApps) {
-  ASSERT_TRUE(SetupSync());
-  ASSERT_TRUE(AllProfilesHaveSameAppsAsVerifier());
-
-  ASSERT_TRUE(GetClient(1)->DisableSyncForDatatype(syncer::APPS));
-  InstallApp(GetProfile(0), 0);
-  InstallApp(verifier(), 0);
-  ASSERT_TRUE(AwaitCommitActivityCompletion(GetSyncService((0))));
-  ASSERT_TRUE(HasSameAppsAsVerifier(0));
-  ASSERT_FALSE(HasSameAppsAsVerifier(1));
-
-  ASSERT_TRUE(GetClient(1)->EnableSyncForDatatype(syncer::APPS));
-  ASSERT_TRUE(AwaitQuiescence());
-
-  InstallAppsPendingForSync(GetProfile(0));
-  InstallAppsPendingForSync(GetProfile(1));
-  ASSERT_TRUE(AllProfilesHaveSameAppsAsVerifier());
-}
-
-// Disable sync for the second client and then install an app on the first
-// client, then enable sync on the second client. Both clients should have the
-// same app with identical app and page ordinals.
-// TCM ID - 3720303.
-IN_PROC_BROWSER_TEST_F(TwoClientAppsSyncTest, DisableSync) {
-  ASSERT_TRUE(SetupSync());
-  ASSERT_TRUE(AllProfilesHaveSameAppsAsVerifier());
-
-  ASSERT_TRUE(GetClient(1)->DisableSyncForAllDatatypes());
-  InstallApp(GetProfile(0), 0);
-  InstallApp(verifier(), 0);
-  ASSERT_TRUE(AwaitCommitActivityCompletion(GetSyncService((0))));
-  ASSERT_TRUE(HasSameAppsAsVerifier(0));
-  ASSERT_FALSE(HasSameAppsAsVerifier(1));
-
-  ASSERT_TRUE(GetClient(1)->EnableSyncForAllDatatypes());
-  ASSERT_TRUE(AwaitQuiescence());
-
-  InstallAppsPendingForSync(GetProfile(0));
-  InstallAppsPendingForSync(GetProfile(1));
-  ASSERT_TRUE(AllProfilesHaveSameAppsAsVerifier());
+  ASSERT_TRUE(AwaitAllProfilesHaveSameAppsAsVerifier());
 }
 
 // Install the same app on both clients, then sync. Change the page ordinal on
@@ -371,16 +295,13 @@ IN_PROC_BROWSER_TEST_F(TwoClientAppsSyncTest, UpdatePageOrdinal) {
   syncer::StringOrdinal initial_page =
       syncer::StringOrdinal::CreateInitialOrdinal();
   InstallApp(GetProfile(0), 0);
-  InstallApp(GetProfile(1), 0);
   InstallApp(verifier(), 0);
-  ASSERT_TRUE(AwaitQuiescence());
-  ASSERT_TRUE(AllProfilesHaveSameAppsAsVerifier());
+  ASSERT_TRUE(AwaitAllProfilesHaveSameAppsAsVerifier());
 
   syncer::StringOrdinal second_page = initial_page.CreateAfter();
   SetPageOrdinalForApp(GetProfile(0), 0, second_page);
   SetPageOrdinalForApp(verifier(), 0, second_page);
-  ASSERT_TRUE(AwaitQuiescence());
-  ASSERT_TRUE(AllProfilesHaveSameAppsAsVerifier());
+  ASSERT_TRUE(AwaitAllProfilesHaveSameAppsAsVerifier());
 }
 
 // Install the same app on both clients, then sync. Change the app launch
@@ -391,10 +312,8 @@ IN_PROC_BROWSER_TEST_F(TwoClientAppsSyncTest, UpdateAppLaunchOrdinal) {
   ASSERT_TRUE(AllProfilesHaveSameAppsAsVerifier());
 
   InstallApp(GetProfile(0), 0);
-  InstallApp(GetProfile(1), 0);
   InstallApp(verifier(), 0);
-  ASSERT_TRUE(AwaitQuiescence());
-  ASSERT_TRUE(AllProfilesHaveSameAppsAsVerifier());
+  ASSERT_TRUE(AwaitAllProfilesHaveSameAppsAsVerifier());
 
   syncer::StringOrdinal initial_position =
       GetAppLaunchOrdinalForApp(GetProfile(0), 0);
@@ -402,8 +321,7 @@ IN_PROC_BROWSER_TEST_F(TwoClientAppsSyncTest, UpdateAppLaunchOrdinal) {
   syncer::StringOrdinal second_position = initial_position.CreateAfter();
   SetAppLaunchOrdinalForApp(GetProfile(0), 0, second_position);
   SetAppLaunchOrdinalForApp(verifier(), 0, second_position);
-  ASSERT_TRUE(AwaitQuiescence());
-  ASSERT_TRUE(AllProfilesHaveSameAppsAsVerifier());
+  ASSERT_TRUE(AwaitAllProfilesHaveSameAppsAsVerifier());
 }
 
 // Adjust the CWS location within a page on the first client and sync. Adjust
@@ -417,29 +335,27 @@ IN_PROC_BROWSER_TEST_F(TwoClientAppsSyncTest, UpdateCWSOrdinals) {
   syncer::StringOrdinal cws_app_launch_ordinal =
       extensions::ExtensionPrefs::Get(GetProfile(0))
           ->app_sorting()
-          ->GetAppLaunchOrdinal(extension_misc::kWebStoreAppId);
+          ->GetAppLaunchOrdinal(extensions::kWebStoreAppId);
   extensions::ExtensionPrefs::Get(GetProfile(0))
       ->app_sorting()
-      ->SetAppLaunchOrdinal(extension_misc::kWebStoreAppId,
+      ->SetAppLaunchOrdinal(extensions::kWebStoreAppId,
                             cws_app_launch_ordinal.CreateAfter());
   extensions::ExtensionPrefs::Get(verifier())
       ->app_sorting()
-      ->SetAppLaunchOrdinal(extension_misc::kWebStoreAppId,
+      ->SetAppLaunchOrdinal(extensions::kWebStoreAppId,
                             cws_app_launch_ordinal.CreateAfter());
-  ASSERT_TRUE(AwaitQuiescence());
-  ASSERT_TRUE(AllProfilesHaveSameAppsAsVerifier());
+  ASSERT_TRUE(AwaitAllProfilesHaveSameAppsAsVerifier());
 
   // Change the page ordinal.
   syncer::StringOrdinal cws_page_ordinal =
       extensions::ExtensionPrefs::Get(GetProfile(1))
           ->app_sorting()
-          ->GetPageOrdinal(extension_misc::kWebStoreAppId);
+          ->GetPageOrdinal(extensions::kWebStoreAppId);
   extensions::ExtensionPrefs::Get(GetProfile(1))->app_sorting()->SetPageOrdinal(
-      extension_misc::kWebStoreAppId, cws_page_ordinal.CreateAfter());
+      extensions::kWebStoreAppId, cws_page_ordinal.CreateAfter());
   extensions::ExtensionPrefs::Get(verifier())->app_sorting()->SetPageOrdinal(
-      extension_misc::kWebStoreAppId, cws_page_ordinal.CreateAfter());
-  ASSERT_TRUE(AwaitQuiescence());
-  ASSERT_TRUE(AllProfilesHaveSameAppsAsVerifier());
+      extensions::kWebStoreAppId, cws_page_ordinal.CreateAfter());
+  ASSERT_TRUE(AwaitAllProfilesHaveSameAppsAsVerifier());
 }
 
 // Adjust the launch type on the first client and sync. Both clients should
@@ -449,43 +365,41 @@ IN_PROC_BROWSER_TEST_F(TwoClientAppsSyncTest, UpdateLaunchType) {
   ASSERT_TRUE(AllProfilesHaveSameAppsAsVerifier());
 
   // Change the launch type to window.
-  extensions::SetLaunchType(GetProfile(1)->GetExtensionService(),
-                            extension_misc::kWebStoreAppId,
+  extensions::SetLaunchType(GetExtensionService(GetProfile(1)),
+                            extensions::kWebStoreAppId,
                             extensions::LAUNCH_TYPE_WINDOW);
-  extensions::SetLaunchType(verifier()->GetExtensionService(),
-                            extension_misc::kWebStoreAppId,
+  extensions::SetLaunchType(GetExtensionService(verifier()),
+                            extensions::kWebStoreAppId,
                             extensions::LAUNCH_TYPE_WINDOW);
-  ASSERT_TRUE(AwaitQuiescence());
-  ASSERT_TRUE(AllProfilesHaveSameAppsAsVerifier());
+  ASSERT_TRUE(AwaitAllProfilesHaveSameAppsAsVerifier());
 
   // Change the launch type to regular tab.
-  extensions::SetLaunchType(GetProfile(1)->GetExtensionService(),
-                            extension_misc::kWebStoreAppId,
+  extensions::SetLaunchType(GetExtensionService(GetProfile(1)),
+                            extensions::kWebStoreAppId,
                             extensions::LAUNCH_TYPE_REGULAR);
   ASSERT_FALSE(HasSameAppsAsVerifier(1));
-  extensions::SetLaunchType(verifier()->GetExtensionService(),
-                            extension_misc::kWebStoreAppId,
+  extensions::SetLaunchType(GetExtensionService(verifier()),
+                            extensions::kWebStoreAppId,
                             extensions::LAUNCH_TYPE_REGULAR);
-  ASSERT_TRUE(AwaitQuiescence());
-  ASSERT_TRUE(AllProfilesHaveSameAppsAsVerifier());
+  ASSERT_TRUE(AwaitAllProfilesHaveSameAppsAsVerifier());
 }
 
 IN_PROC_BROWSER_TEST_F(TwoClientAppsSyncTest, UnexpectedLaunchType) {
   ASSERT_TRUE(SetupSync());
   ASSERT_TRUE(AllProfilesHaveSameAppsAsVerifier());
 
-  extensions::SetLaunchType(GetProfile(1)->GetExtensionService(),
-                            extension_misc::kWebStoreAppId,
+  extensions::SetLaunchType(GetExtensionService(GetProfile(1)),
+                            extensions::kWebStoreAppId,
                             extensions::LAUNCH_TYPE_REGULAR);
-  extensions::SetLaunchType(verifier()->GetExtensionService(),
-                            extension_misc::kWebStoreAppId,
+  extensions::SetLaunchType(GetExtensionService(verifier()),
+                            extensions::kWebStoreAppId,
                             extensions::LAUNCH_TYPE_REGULAR);
-  ASSERT_TRUE(AwaitQuiescence());
-  ASSERT_TRUE(AllProfilesHaveSameAppsAsVerifier());
+  ASSERT_TRUE(AwaitAllProfilesHaveSameAppsAsVerifier());
 
   const extensions::Extension* extension =
-      GetProfile(1)->GetExtensionService()->
-          GetInstalledExtension(extension_misc::kWebStoreAppId);
+      GetExtensionRegistry(GetProfile(1))->GetExtensionById(
+          extensions::kWebStoreAppId,
+          extensions::ExtensionRegistry::EVERYTHING);
   ASSERT_TRUE(extension);
 
   ExtensionSyncService* extension_sync_service =
@@ -501,14 +415,14 @@ IN_PROC_BROWSER_TEST_F(TwoClientAppsSyncTest, UnexpectedLaunchType) {
       *extension,
       original_data.extension_sync_data().enabled(),
       original_data.extension_sync_data().incognito_enabled(),
+      original_data.extension_sync_data().remote_install(),
       original_data.app_launch_ordinal(),
       original_data.page_ordinal(),
       extensions::NUM_LAUNCH_TYPES);
   extension_sync_service->ProcessAppSyncData(invalid_launch_type_data);
 
   // The launch type should remain the same.
-  ASSERT_TRUE(AwaitQuiescence());
-  ASSERT_TRUE(AllProfilesHaveSameAppsAsVerifier());
+  ASSERT_TRUE(AwaitAllProfilesHaveSameAppsAsVerifier());
 }
 
 IN_PROC_BROWSER_TEST_F(TwoClientAppsSyncTest, BookmarkApp) {
@@ -516,7 +430,7 @@ IN_PROC_BROWSER_TEST_F(TwoClientAppsSyncTest, BookmarkApp) {
   ASSERT_TRUE(AllProfilesHaveSameAppsAsVerifier());
 
   size_t num_extensions =
-      GetProfile(0)->GetExtensionService()->extensions()->size();
+      GetExtensionRegistry(GetProfile(0))->enabled_extensions().size();
 
   WebApplicationInfo web_app_info;
   web_app_info.app_url = GURL("http://www.chromium.org");
@@ -525,38 +439,33 @@ IN_PROC_BROWSER_TEST_F(TwoClientAppsSyncTest, BookmarkApp) {
   ++num_extensions;
   {
     content::WindowedNotificationObserver windowed_observer(
-        chrome::NOTIFICATION_CRX_INSTALLER_DONE,
+        extensions::NOTIFICATION_CRX_INSTALLER_DONE,
         content::NotificationService::AllSources());
-    extensions::CreateOrUpdateBookmarkApp(GetProfile(0)->GetExtensionService(),
+    extensions::CreateOrUpdateBookmarkApp(GetExtensionService(GetProfile(0)),
                                           web_app_info);
     windowed_observer.Wait();
     EXPECT_EQ(num_extensions,
-              extensions::ExtensionRegistry::Get(GetProfile(0))
-                  ->enabled_extensions()
-                  .size());
+              GetExtensionRegistry(GetProfile(0))->enabled_extensions().size());
   }
   {
     content::WindowedNotificationObserver windowed_observer(
-        chrome::NOTIFICATION_CRX_INSTALLER_DONE,
+        extensions::NOTIFICATION_CRX_INSTALLER_DONE,
         content::NotificationService::AllSources());
-    extensions::CreateOrUpdateBookmarkApp(verifier()->GetExtensionService(),
+    extensions::CreateOrUpdateBookmarkApp(GetExtensionService(verifier()),
                                           web_app_info);
     windowed_observer.Wait();
     EXPECT_EQ(num_extensions,
-              extensions::ExtensionRegistry::Get(verifier())
-                  ->enabled_extensions()
-                  .size());
+              GetExtensionRegistry(verifier())->enabled_extensions().size());
   }
   {
     // Wait for the synced app to install.
     content::WindowedNotificationObserver windowed_observer(
-        chrome::NOTIFICATION_CRX_INSTALLER_DONE,
-        content::NotificationService::AllSources());
-    ASSERT_TRUE(AwaitQuiescence());
+        extensions::NOTIFICATION_CRX_INSTALLER_DONE,
+        base::Bind(&AllProfilesHaveSameAppsAsVerifier));
     windowed_observer.Wait();
-    ASSERT_TRUE(AllProfilesHaveSameAppsAsVerifier());
   }
 }
+
 // TODO(akalin): Add tests exercising:
 //   - Offline installation/uninstallation behavior
 //   - App-specific properties