summaryrefslogtreecommitdiffstats
path: root/chrome
diff options
context:
space:
mode:
authorstevet@chromium.org <stevet@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-09-23 21:29:06 +0000
committerstevet@chromium.org <stevet@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-09-23 21:29:06 +0000
commit1d447cc35c56c2972e5b4cd661d3749b162c6951 (patch)
tree7e7ee41d9f3b12a474eb7a6336fff0c9e8a64091 /chrome
parentf04f5068d969ba2caf835a0593489a8b37e78a29 (diff)
downloadchromium_src-1d447cc35c56c2972e5b4cd661d3749b162c6951.zip
chromium_src-1d447cc35c56c2972e5b4cd661d3749b162c6951.tar.gz
chromium_src-1d447cc35c56c2972e5b4cd661d3749b162c6951.tar.bz2
Add first round of integration tests for the search engines sync datatype.
TEST=Ensure that all sync integration tests pass. BUG=none Review URL: http://codereview.chromium.org/7910006 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@102580 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome')
-rw-r--r--chrome/browser/sync/test/integration/search_engines_helper.cc173
-rw-r--r--chrome/browser/sync/test/integration/search_engines_helper.h49
-rw-r--r--chrome/browser/sync/test/integration/single_client_search_engines_sync_test.cc36
-rw-r--r--chrome/browser/sync/test/integration/sync_test.cc11
-rw-r--r--chrome/browser/sync/test/integration/two_client_sessions_sync_test.cc29
-rw-r--r--chrome/chrome_tests.gypi5
-rw-r--r--chrome/test/base/ui_test_utils.cc10
-rw-r--r--chrome/test/base/ui_test_utils.h4
8 files changed, 304 insertions, 13 deletions
diff --git a/chrome/browser/sync/test/integration/search_engines_helper.cc b/chrome/browser/sync/test/integration/search_engines_helper.cc
new file mode 100644
index 0000000..45a49d6
--- /dev/null
+++ b/chrome/browser/sync/test/integration/search_engines_helper.cc
@@ -0,0 +1,173 @@
+// Copyright (c) 2011 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "chrome/browser/sync/test/integration/search_engines_helper.h"
+
+#include <vector>
+
+#include "base/string_util.h"
+#include "base/stringprintf.h"
+#include "base/time.h"
+#include "base/utf_string_conversions.h"
+#include "chrome/browser/profiles/profile.h"
+#include "chrome/browser/search_engines/template_url.h"
+#include "chrome/browser/search_engines/template_url_service.h"
+#include "chrome/browser/search_engines/template_url_service_factory.h"
+#include "chrome/browser/sync/profile_sync_service_harness.h"
+#include "chrome/browser/sync/test/integration/sync_datatype_helper.h"
+#include "chrome/browser/sync/test/integration/sync_test.h"
+
+using sync_datatype_helper::test;
+
+namespace search_engines_helper {
+
+TemplateURLService* GetServiceForProfile(int index) {
+ return TemplateURLServiceFactory::GetForProfile(test()->GetProfile(index));
+}
+
+TemplateURLService* GetVerifierService() {
+ return TemplateURLServiceFactory::GetForProfile(test()->verifier());
+}
+
+GUIDToTURLMap CreateGUIDToTURLMap(TemplateURLService* service) {
+ CHECK(service);
+
+ GUIDToTURLMap map;
+ std::vector<const TemplateURL*> turls = service->GetTemplateURLs();
+ for (std::vector<const TemplateURL*>::iterator it = turls.begin();
+ it != turls.end(); ++it) {
+ CHECK(*it);
+ CHECK(map.find((*it)->sync_guid()) == map.end());
+ map[(*it)->sync_guid()] = *it;
+ }
+
+ return map;
+}
+
+std::string GetTURLInfoString(const TemplateURL* turl) {
+ DCHECK(turl);
+ std::string shortname = UTF16ToASCII(turl->short_name());
+ std::string keyword = UTF16ToASCII(turl->keyword());
+ return StringPrintf("TemplateURL: shortname: %s keyword: %s url: %s",
+ shortname.c_str(), keyword.c_str(),
+ (turl->url() ? turl->url()->url().c_str() : "NULL"));
+}
+
+bool TURLsMatch(const TemplateURL* turl1, const TemplateURL* turl2) {
+ CHECK(turl1);
+ CHECK(turl2);
+
+ // Either both TemplateURLRefs are NULL or they're both valid and have the
+ // same raw URL value.
+ bool urls_match = ((!turl1->url() && !turl1->url()) ||
+ (turl1->url() && turl2->url() &&
+ turl1->url()->url() == turl2->url()->url()));
+
+ // Compare all major fields.
+ bool result = (urls_match && turl1->keyword() == turl2->keyword() &&
+ turl1->short_name() == turl2->short_name());
+
+ // Print some useful debug info.
+ if (!result) {
+ LOG(ERROR) << "TemplateURLs did not match: " << GetTURLInfoString(turl1)
+ << " vs " << GetTURLInfoString(turl2);
+ }
+
+ return result;
+}
+
+bool ServiceMatchesVerifier(int profile) {
+ TemplateURLService* verifier = GetVerifierService();
+ TemplateURLService* other = GetServiceForProfile(profile);
+
+ CHECK(verifier);
+ CHECK(other);
+
+ std::vector<const TemplateURL*> verifier_turls = verifier->GetTemplateURLs();
+ if (verifier_turls.size() != other->GetTemplateURLs().size()) {
+ LOG(ERROR) << "verifier and other service have a different count of TURLs: "
+ << verifier_turls.size() << " vs "
+ << other->GetTemplateURLs().size() << " respectively.";
+ return false;
+ }
+
+ for (size_t i = 0; i < verifier_turls.size(); ++i) {
+ const TemplateURL* verifier_turl = verifier_turls.at(i);
+ CHECK(verifier_turl);
+ const TemplateURL* other_turl = other->GetTemplateURLForKeyword(
+ verifier_turl->keyword());
+
+ if (!other_turl) {
+ LOG(ERROR) << "The other service did not contain a TURL with keyword: "
+ << verifier_turl->keyword();
+ return false;
+ }
+ if (!TURLsMatch(verifier_turl, other_turl))
+ return false;
+ }
+
+ return true;
+}
+
+bool ServicesMatch(int profile_a, int profile_b) {
+ TemplateURLService* service_a = GetServiceForProfile(profile_a);
+ TemplateURLService* service_b = GetServiceForProfile(profile_b);
+ CHECK(service_a);
+ CHECK(service_b);
+
+ // Services that have synced should have identical TURLs, including the GUIDs.
+ // Make sure we compare those fields in addition to the user-visible fields.
+ GUIDToTURLMap a_turls = CreateGUIDToTURLMap(service_a);
+ GUIDToTURLMap b_turls = CreateGUIDToTURLMap(service_b);
+
+ if (a_turls.size() != b_turls.size()) {
+ LOG(ERROR) << "Service a and b do not match in size: " << a_turls.size()
+ << " vs " << b_turls.size() << " respectively.";
+ return false;
+ }
+
+ for (GUIDToTURLMap::iterator it = a_turls.begin();
+ it != a_turls.end(); ++it) {
+ if (b_turls.find(it->first) == b_turls.end()) {
+ LOG(ERROR) << "TURL GUID from a not found in b's TURLs: " << it->first;
+ return false;
+ }
+ if (!TURLsMatch(b_turls[it->first], it->second))
+ return false;
+ }
+
+ return true;
+}
+
+bool AllServicesMatch() {
+ // Use 0 as the baseline.
+ if (!ServiceMatchesVerifier(0))
+ return false;
+
+ for (int it = 0; it < test()->num_clients(); ++it) {
+ if (!ServicesMatch(0, it)) {
+ LOG(ERROR) << "TemplateURLService " << it << " does not match with "
+ << "service 0.";
+ return false;
+ }
+ }
+ return true;
+}
+
+TemplateURL* CreateTestTemplateURL(int seed) {
+ TemplateURL* turl = new TemplateURL();
+ turl->SetURL(base::StringPrintf("http://www.test%d.com/", seed), 0, 0);
+ turl->set_keyword(ASCIIToUTF16(base::StringPrintf("test%d", seed)));
+ turl->set_short_name(ASCIIToUTF16(base::StringPrintf("test%d", seed)));
+ turl->set_safe_for_autoreplace(true);
+ GURL favicon_url("http://favicon.url");
+ turl->SetFaviconURL(favicon_url);
+ turl->set_date_created(base::Time::FromTimeT(100));
+ turl->set_last_modified(base::Time::FromTimeT(100));
+ turl->SetPrepopulateId(999999);
+ turl->set_sync_guid(base::StringPrintf("0000-0000-0000-%04d", seed));
+ return turl;
+}
+
+} // namespace search_engines_helper
diff --git a/chrome/browser/sync/test/integration/search_engines_helper.h b/chrome/browser/sync/test/integration/search_engines_helper.h
new file mode 100644
index 0000000..dc620b6
--- /dev/null
+++ b/chrome/browser/sync/test/integration/search_engines_helper.h
@@ -0,0 +1,49 @@
+// Copyright (c) 2011 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef CHROME_BROWSER_SYNC_TEST_INTEGRATION_SEARCH_ENGINES_HELPER_H_
+#define CHROME_BROWSER_SYNC_TEST_INTEGRATION_SEARCH_ENGINES_HELPER_H_
+#pragma once
+
+#include <map>
+#include <string>
+
+class TemplateURL;
+class TemplateURLService;
+
+typedef std::map<std::string, const TemplateURL*> GUIDToTURLMap;
+
+namespace search_engines_helper {
+
+// Used to access the search engines within a particular sync profile.
+TemplateURLService* GetServiceForProfile(int index);
+
+// Used to access the search engines within the verifier sync profile.
+TemplateURLService* GetVerifierService();
+
+// Returns a mapping of |service|'s TemplateURL collection with their sync
+// GUIDs as keys.
+GUIDToTURLMap CreateGUIDToTURLMap(TemplateURLService* service);
+
+// Returns true iff the major user-visible fields of |turl1| and |turl2| match.
+bool TURLsMatch(const TemplateURL* turl1, const TemplateURL* turl2);
+
+// Compared a single TemplateURLService for a given profile to the verifier.
+// Retrns true iff their user-visible fields match.
+bool ServiceMatchesVerifier(int profile);
+
+// Returns true iff |other|'s TemplateURLs matches the verifier's TemplateURLs
+// by sync GUIDs and user-visible fields.
+bool ServicesMatch(TemplateURLService* other);
+
+// Returns true iff all TemplateURLServices match with the verifier.
+bool AllServicesMatch();
+
+// Create a TemplateURL with some test values based on |seed|. The caller owns
+// the returned TemplateURL*.
+TemplateURL* CreateTestTemplateURL(int seed);
+
+} // namespace search_engines_helper
+
+#endif // CHROME_BROWSER_SYNC_TEST_INTEGRATION_SEARCH_ENGINES_HELPER_H_
diff --git a/chrome/browser/sync/test/integration/single_client_search_engines_sync_test.cc b/chrome/browser/sync/test/integration/single_client_search_engines_sync_test.cc
new file mode 100644
index 0000000..1351a53
--- /dev/null
+++ b/chrome/browser/sync/test/integration/single_client_search_engines_sync_test.cc
@@ -0,0 +1,36 @@
+// Copyright (c) 2011 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "chrome/browser/search_engines/template_url_service.h"
+#include "chrome/browser/sync/profile_sync_service_harness.h"
+#include "chrome/browser/sync/test/integration/search_engines_helper.h"
+#include "chrome/browser/sync/test/integration/sync_test.h"
+
+using search_engines_helper::CreateTestTemplateURL;
+using search_engines_helper::GetServiceForProfile;
+using search_engines_helper::GetVerifierService;
+using search_engines_helper::ServiceMatchesVerifier;
+
+class SingleClientSearchEnginesSyncTest : public SyncTest {
+ public:
+ SingleClientSearchEnginesSyncTest() : SyncTest(SINGLE_CLIENT) {}
+ virtual ~SingleClientSearchEnginesSyncTest() {}
+
+ private:
+ DISALLOW_COPY_AND_ASSIGN(SingleClientSearchEnginesSyncTest);
+};
+
+IN_PROC_BROWSER_TEST_F(SingleClientSearchEnginesSyncTest, Sanity) {
+ ASSERT_TRUE(SetupSync()) << "SetupSync() failed.";
+ ASSERT_TRUE(ServiceMatchesVerifier(0));
+
+ // TODO(stevet): Write a helper that adds a new search engine entry to both
+ // the verifier and a particular profile.
+ GetServiceForProfile(0)->Add(CreateTestTemplateURL(0));
+ GetVerifierService()->Add(CreateTestTemplateURL(0));
+
+ ASSERT_TRUE(GetClient(0)->AwaitSyncCycleCompletion(
+ "Waiting for search engines to update."));
+ ASSERT_TRUE(ServiceMatchesVerifier(0));
+}
diff --git a/chrome/browser/sync/test/integration/sync_test.cc b/chrome/browser/sync/test/integration/sync_test.cc
index 2fe48b4..4157578 100644
--- a/chrome/browser/sync/test/integration/sync_test.cc
+++ b/chrome/browser/sync/test/integration/sync_test.cc
@@ -21,6 +21,8 @@
#include "chrome/browser/password_manager/encryptor.h"
#include "chrome/browser/profiles/profile.h"
#include "chrome/browser/profiles/profile_manager.h"
+#include "chrome/browser/search_engines/template_url_service.h"
+#include "chrome/browser/search_engines/template_url_service_factory.h"
#include "chrome/browser/sync/notifier/p2p_notifier.h"
#include "chrome/browser/sync/profile_sync_service_harness.h"
#include "chrome/browser/sync/protocol/sync.pb.h"
@@ -221,6 +223,10 @@ void SyncTest::AddOptionalTypesToCommandLine(CommandLine* cl) {
// TODO(sync): Remove this once sessions sync is enabled by default.
if (!cl->HasSwitch(switches::kEnableSyncTabs))
cl->AppendSwitch(switches::kEnableSyncTabs);
+
+ // TODO(stevet): Remove this once search engines sync is enabled by default.
+ if (!cl->HasSwitch(switches::kEnableSyncSearchEngines))
+ cl->AppendSwitch(switches::kEnableSyncSearchEngines);
}
// static
@@ -295,11 +301,16 @@ bool SyncTest::SetupClients() {
ui_test_utils::WaitForBookmarkModelToLoad(
GetProfile(i)->GetBookmarkModel());
+
+ ui_test_utils::WaitForTemplateURLServiceToLoad(
+ TemplateURLServiceFactory::GetForProfile(GetProfile(i)));
}
// Create the verifier profile.
verifier_ = MakeProfile(FILE_PATH_LITERAL("Verifier"));
ui_test_utils::WaitForBookmarkModelToLoad(verifier()->GetBookmarkModel());
+ ui_test_utils::WaitForTemplateURLServiceToLoad(
+ TemplateURLServiceFactory::GetForProfile(verifier()));
return (verifier_ != NULL);
}
diff --git a/chrome/browser/sync/test/integration/two_client_sessions_sync_test.cc b/chrome/browser/sync/test/integration/two_client_sessions_sync_test.cc
index 066061d..be02213 100644
--- a/chrome/browser/sync/test/integration/two_client_sessions_sync_test.cc
+++ b/chrome/browser/sync/test/integration/two_client_sessions_sync_test.cc
@@ -153,8 +153,9 @@ IN_PROC_BROWSER_TEST_F(TwoClientSessionsSyncTest,
ASSERT_EQ(0, GetClient(1)->GetLastSessionSnapshot()->
num_blocking_conflicting_updates);
// We have 6 non-blocking conflicts due to the two meta nodes (one for each
- // client), the one tab node, and the three basic preference/themes.
- ASSERT_EQ(6, GetClient(1)->GetLastSessionSnapshot()->
+ // client), the one tab node, and the six basic preference/themes/search
+ // engines.
+ ASSERT_EQ(9, GetClient(1)->GetLastSessionSnapshot()->
num_conflicting_updates); // The encrypted nodes.
GetClient(1)->service()->SetPassphrase(kValidPassphrase, true);
@@ -188,9 +189,9 @@ IN_PROC_BROWSER_TEST_F(TwoClientSessionsSyncTest,
ASSERT_TRUE(GetClient(1)->AwaitPassphraseRequired());
ASSERT_EQ(0, GetClient(1)->GetLastSessionSnapshot()->
num_blocking_conflicting_updates);
- // We have five non-blocking conflicts due to the two meta nodes (one for each
- // client), and the 3 basic preference/themes nodes.
- ASSERT_EQ(5, GetClient(1)->GetLastSessionSnapshot()->
+ // We have eight non-blocking conflicts due to the two meta nodes (one for
+ // each client), and the 6 basic preference/themes/search engines nodes.
+ ASSERT_EQ(8, GetClient(1)->GetLastSessionSnapshot()->
num_conflicting_updates); // The encrypted nodes.
ScopedVector<SessionWindow> client0_windows;
@@ -198,7 +199,7 @@ IN_PROC_BROWSER_TEST_F(TwoClientSessionsSyncTest,
ASSERT_TRUE(GetClient(0)->AwaitMutualSyncCycleCompletion(GetClient(1)));
ASSERT_EQ(0, GetClient(1)->GetLastSessionSnapshot()->
num_blocking_conflicting_updates);
- ASSERT_EQ(6, GetClient(1)->GetLastSessionSnapshot()->
+ ASSERT_EQ(9, GetClient(1)->GetLastSessionSnapshot()->
num_conflicting_updates); // The encrypted nodes.
GetClient(1)->service()->SetPassphrase(kValidPassphrase, true);
@@ -232,8 +233,8 @@ IN_PROC_BROWSER_TEST_F(TwoClientSessionsSyncTest,
ASSERT_EQ(0, GetClient(1)->GetLastSessionSnapshot()->
num_blocking_conflicting_updates);
// We have two non-blocking conflicts due to the two meta nodes (one for each
- // client), and the 3 basic preference/themes nodes..
- ASSERT_EQ(5, GetClient(1)->GetLastSessionSnapshot()->
+ // client), and the 6 basic preference/themes/search engines nodes.
+ ASSERT_EQ(8, GetClient(1)->GetLastSessionSnapshot()->
num_conflicting_updates); // The encrypted nodes.
// These changes are either made with the old passphrase or not encrypted at
@@ -243,7 +244,7 @@ IN_PROC_BROWSER_TEST_F(TwoClientSessionsSyncTest,
ASSERT_TRUE(GetClient(1)->AwaitMutualSyncCycleCompletion(GetClient(0)));
ASSERT_EQ(0, GetClient(1)->GetLastSessionSnapshot()->
num_blocking_conflicting_updates);
- ASSERT_EQ(5, GetClient(1)->GetLastSessionSnapshot()->
+ ASSERT_EQ(8, GetClient(1)->GetLastSessionSnapshot()->
num_conflicting_updates); // The same encrypted nodes.
// At this point we enter the passphrase, triggering a resync, in which the
@@ -285,8 +286,9 @@ IN_PROC_BROWSER_TEST_F(TwoClientSessionsSyncTest,
ASSERT_EQ(0, GetClient(1)->GetLastSessionSnapshot()->
num_blocking_conflicting_updates);
// We have three non-blocking conflicts due to the two meta nodes (one for
- // each client), the one tab node, and the 3 basic preference/themes nodes.
- ASSERT_GE(6, GetClient(1)->GetLastSessionSnapshot()->
+ // each client), the one tab node, and the 6 basic preference/themes/search
+ // engines nodes.
+ ASSERT_GE(9, GetClient(1)->GetLastSessionSnapshot()->
num_conflicting_updates); // The encrypted nodes.
// At this point we enter the passphrase, triggering a resync.
@@ -327,8 +329,9 @@ IN_PROC_BROWSER_TEST_F(TwoClientSessionsSyncTest,
ASSERT_EQ(0, GetClient(1)->GetLastSessionSnapshot()->
num_blocking_conflicting_updates);
// We have three non-blocking conflicts due to the two meta nodes (one for
- // each client), the one tab node, and the 3 basic preference/themes nodes.
- ASSERT_EQ(6, GetClient(1)->GetLastSessionSnapshot()->
+ // each client), the one tab node, and the 6 basic preference/themes/search
+ // engines nodes.
+ ASSERT_EQ(9, GetClient(1)->GetLastSessionSnapshot()->
num_conflicting_updates); // The encrypted nodes.
GetClient(1)->service()->SetPassphrase(kValidPassphrase, true);
diff --git a/chrome/chrome_tests.gypi b/chrome/chrome_tests.gypi
index a5597f2..d9b4d04 100644
--- a/chrome/chrome_tests.gypi
+++ b/chrome/chrome_tests.gypi
@@ -103,6 +103,8 @@
'browser/prefs/pref_service_mock_builder.h',
'browser/prefs/testing_pref_store.cc',
'browser/prefs/testing_pref_store.h',
+ 'browser/search_engines/template_url_service_test_util.cc',
+ 'browser/search_engines/template_url_service_test_util.h',
'browser/sessions/session_service_test_helper.cc',
'browser/sessions/session_service_test_helper.h',
'browser/sync/profile_sync_service_mock.cc',
@@ -3124,6 +3126,8 @@
'browser/sync/test/integration/passwords_helper.h',
'browser/sync/test/integration/preferences_helper.cc',
'browser/sync/test/integration/preferences_helper.h',
+ 'browser/sync/test/integration/search_engines_helper.cc',
+ 'browser/sync/test/integration/search_engines_helper.h',
'browser/sync/test/integration/sessions_helper.cc',
'browser/sync/test/integration/sessions_helper.h',
'browser/sync/test/integration/single_client_apps_sync_test.cc',
@@ -3131,6 +3135,7 @@
'browser/sync/test/integration/single_client_extensions_sync_test.cc',
'browser/sync/test/integration/single_client_passwords_sync_test.cc',
'browser/sync/test/integration/single_client_preferences_sync_test.cc',
+ 'browser/sync/test/integration/single_client_search_engines_sync_test.cc',
'browser/sync/test/integration/single_client_sessions_sync_test.cc',
'browser/sync/test/integration/single_client_themes_sync_test.cc',
'browser/sync/test/integration/single_client_typed_urls_sync_test.cc',
diff --git a/chrome/test/base/ui_test_utils.cc b/chrome/test/base/ui_test_utils.cc
index 9a2a006..5400d35 100644
--- a/chrome/test/base/ui_test_utils.cc
+++ b/chrome/test/base/ui_test_utils.cc
@@ -21,6 +21,8 @@
#include "chrome/browser/browser_process.h"
#include "chrome/browser/dom_operation_notification_details.h"
#include "chrome/browser/profiles/profile.h"
+#include "chrome/browser/search_engines/template_url_service.h"
+#include "chrome/browser/search_engines/template_url_service_test_util.h"
#include "chrome/browser/tab_contents/thumbnail_generator.h"
#include "chrome/browser/ui/browser.h"
#include "chrome/browser/ui/browser_list.h"
@@ -546,6 +548,14 @@ void WaitForBookmarkModelToLoad(BookmarkModel* model) {
ASSERT_TRUE(model->IsLoaded());
}
+void WaitForTemplateURLServiceToLoad(TemplateURLService* service) {
+ if (service->loaded())
+ return;
+ service->Load();
+ TemplateURLServiceTestUtil::BlockTillServiceProcessesRequests();
+ ASSERT_TRUE(service->loaded());
+}
+
void WaitForHistoryToLoad(Browser* browser) {
HistoryService* history_service =
browser->profile()->GetHistoryService(Profile::EXPLICIT_ACCESS);
diff --git a/chrome/test/base/ui_test_utils.h b/chrome/test/base/ui_test_utils.h
index 551959f..6e1ef72 100644
--- a/chrome/test/base/ui_test_utils.h
+++ b/chrome/test/base/ui_test_utils.h
@@ -45,6 +45,7 @@ class ScopedTempDir;
class SkBitmap;
class TabContents;
class TabContentsWrapper;
+class TemplateURLService;
namespace browser {
struct NavigateParams;
@@ -234,6 +235,9 @@ void RegisterAndWait(NotificationObserver* observer,
// Blocks until |model| finishes loading.
void WaitForBookmarkModelToLoad(BookmarkModel* model);
+// Blocks until |service| finishes loading.
+void WaitForTemplateURLServiceToLoad(TemplateURLService* service);
+
// Blocks until the |browser|'s history finishes loading.
void WaitForHistoryToLoad(Browser* browser);