Commit fea6d3ed authored by Mikel Astiz's avatar Mikel Astiz Committed by Commit Bot

[sync] Do not wait for TemplateURLService in unrelated tests

This should make tests slightly faster in general, but in particular
they may help on Mac where the wait contributes to flakes.

Change-Id: I7b8711676123a7fd1ce58505dffbd29f4043b482
Bug: 1131588
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2434329
Commit-Queue: Mikel Astiz <mastiz@chromium.org>
Reviewed-by: default avatarMarc Treib <treib@chromium.org>
Cr-Commit-Position: refs/heads/master@{#811251}
parent 2804fdc6
...@@ -3,9 +3,11 @@ ...@@ -3,9 +3,11 @@
// found in the LICENSE file. // found in the LICENSE file.
#include "base/macros.h" #include "base/macros.h"
#include "chrome/browser/search_engines/template_url_service_factory.h"
#include "chrome/browser/sync/test/integration/search_engines_helper.h" #include "chrome/browser/sync/test/integration/search_engines_helper.h"
#include "chrome/browser/sync/test/integration/sync_test.h" #include "chrome/browser/sync/test/integration/sync_test.h"
#include "chrome/browser/sync/test/integration/updated_progress_marker_checker.h" #include "chrome/browser/sync/test/integration/updated_progress_marker_checker.h"
#include "chrome/test/base/search_test_utils.h"
#include "components/search_engines/template_url_service.h" #include "components/search_engines/template_url_service.h"
#include "components/sync/driver/profile_sync_service.h" #include "components/sync/driver/profile_sync_service.h"
#include "content/public/test/browser_test.h" #include "content/public/test/browser_test.h"
...@@ -16,6 +18,20 @@ class SingleClientSearchEnginesSyncTest : public SyncTest { ...@@ -16,6 +18,20 @@ class SingleClientSearchEnginesSyncTest : public SyncTest {
~SingleClientSearchEnginesSyncTest() override {} ~SingleClientSearchEnginesSyncTest() override {}
bool SetupClients() override {
if (!SyncTest::SetupClients()) {
return false;
}
// Wait for models to load.
search_test_utils::WaitForTemplateURLServiceToLoad(
TemplateURLServiceFactory::GetForProfile(verifier()));
search_test_utils::WaitForTemplateURLServiceToLoad(
TemplateURLServiceFactory::GetForProfile(GetProfile(0)));
return true;
}
private: private:
DISALLOW_COPY_AND_ASSIGN(SingleClientSearchEnginesSyncTest); DISALLOW_COPY_AND_ASSIGN(SingleClientSearchEnginesSyncTest);
}; };
......
...@@ -26,7 +26,6 @@ ...@@ -26,7 +26,6 @@
#include "chrome/browser/net/system_network_context_manager.h" #include "chrome/browser/net/system_network_context_manager.h"
#include "chrome/browser/profiles/profile_manager.h" #include "chrome/browser/profiles/profile_manager.h"
#include "chrome/browser/profiles/profiles_state.h" #include "chrome/browser/profiles/profiles_state.h"
#include "chrome/browser/search_engines/template_url_service_factory.h"
#include "chrome/browser/signin/chrome_signin_client_factory.h" #include "chrome/browser/signin/chrome_signin_client_factory.h"
#include "chrome/browser/signin/identity_manager_factory.h" #include "chrome/browser/signin/identity_manager_factory.h"
#include "chrome/browser/sync/profile_sync_service_factory.h" #include "chrome/browser/sync/profile_sync_service_factory.h"
...@@ -39,7 +38,6 @@ ...@@ -39,7 +38,6 @@
#include "chrome/common/chrome_constants.h" #include "chrome/common/chrome_constants.h"
#include "chrome/common/chrome_paths.h" #include "chrome/common/chrome_paths.h"
#include "chrome/common/chrome_switches.h" #include "chrome/common/chrome_switches.h"
#include "chrome/test/base/search_test_utils.h"
#include "components/bookmarks/test/bookmark_test_helpers.h" #include "components/bookmarks/test/bookmark_test_helpers.h"
#include "components/gcm_driver/gcm_profile_service.h" #include "components/gcm_driver/gcm_profile_service.h"
#include "components/invalidation/impl/fake_invalidation_service.h" #include "components/invalidation/impl/fake_invalidation_service.h"
...@@ -54,7 +52,6 @@ ...@@ -54,7 +52,6 @@
#include "components/keyed_service/core/keyed_service.h" #include "components/keyed_service/core/keyed_service.h"
#include "components/os_crypt/os_crypt_mocker.h" #include "components/os_crypt/os_crypt_mocker.h"
#include "components/prefs/scoped_user_pref_update.h" #include "components/prefs/scoped_user_pref_update.h"
#include "components/search_engines/template_url_service.h"
#include "components/signin/public/identity_manager/consent_level.h" #include "components/signin/public/identity_manager/consent_level.h"
#include "components/sync/base/invalidation_helper.h" #include "components/sync/base/invalidation_helper.h"
#include "components/sync/base/sync_base_switches.h" #include "components/sync/base/sync_base_switches.h"
...@@ -1059,8 +1056,6 @@ void SyncTest::WaitForDataModels(Profile* profile) { ...@@ -1059,8 +1056,6 @@ void SyncTest::WaitForDataModels(Profile* profile) {
bookmarks::test::WaitForBookmarkModelToLoad( bookmarks::test::WaitForBookmarkModelToLoad(
BookmarkModelFactory::GetForBrowserContext(profile)); BookmarkModelFactory::GetForBrowserContext(profile));
search_test_utils::WaitForTemplateURLServiceToLoad(
TemplateURLServiceFactory::GetForProfile(profile));
#if defined(OS_CHROMEOS) #if defined(OS_CHROMEOS)
printers_helper::WaitForPrinterStoreToLoad(profile); printers_helper::WaitForPrinterStoreToLoad(profile);
#endif #endif
......
...@@ -10,6 +10,7 @@ ...@@ -10,6 +10,7 @@
#include "chrome/browser/sync/test/integration/sync_datatype_helper.h" #include "chrome/browser/sync/test/integration/sync_datatype_helper.h"
#include "chrome/browser/sync/test/integration/sync_test.h" #include "chrome/browser/sync/test/integration/sync_test.h"
#include "chrome/browser/sync/test/integration/updated_progress_marker_checker.h" #include "chrome/browser/sync/test/integration/updated_progress_marker_checker.h"
#include "chrome/test/base/search_test_utils.h"
#include "components/search_engines/template_url.h" #include "components/search_engines/template_url.h"
#include "components/search_engines/template_url_service.h" #include "components/search_engines/template_url_service.h"
#include "content/public/test/browser_test.h" #include "content/public/test/browser_test.h"
...@@ -22,6 +23,22 @@ class TwoClientSearchEnginesSyncTest : public SyncTest { ...@@ -22,6 +23,22 @@ class TwoClientSearchEnginesSyncTest : public SyncTest {
~TwoClientSearchEnginesSyncTest() override {} ~TwoClientSearchEnginesSyncTest() override {}
bool SetupClients() override {
if (!SyncTest::SetupClients()) {
return false;
}
// Wait for models to load.
search_test_utils::WaitForTemplateURLServiceToLoad(
TemplateURLServiceFactory::GetForProfile(verifier()));
search_test_utils::WaitForTemplateURLServiceToLoad(
TemplateURLServiceFactory::GetForProfile(GetProfile(0)));
search_test_utils::WaitForTemplateURLServiceToLoad(
TemplateURLServiceFactory::GetForProfile(GetProfile(1)));
return true;
}
private: private:
DISALLOW_COPY_AND_ASSIGN(TwoClientSearchEnginesSyncTest); DISALLOW_COPY_AND_ASSIGN(TwoClientSearchEnginesSyncTest);
}; };
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment