| Index: chrome/browser/sync/test/integration/search_engines_helper.cc
|
| diff --git a/chrome/browser/sync/test/integration/search_engines_helper.cc b/chrome/browser/sync/test/integration/search_engines_helper.cc
|
| index adc3ed77ae1a77d79e3b831f49fb73a0b6641c9b..2fa6994ad2b2e728f6d95d95b312c00848e73bec 100644
|
| --- a/chrome/browser/sync/test/integration/search_engines_helper.cc
|
| +++ b/chrome/browser/sync/test/integration/search_engines_helper.cc
|
| @@ -86,7 +86,7 @@ bool ServiceMatchesVerifier(int profile) {
|
|
|
| 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: "
|
| + LOG(ERROR) << "Verifier and other service have a different count of TURLs: "
|
| << verifier_turls.size() << " vs "
|
| << other->GetTemplateURLs().size() << " respectively.";
|
| return false;
|
| @@ -156,8 +156,10 @@ bool ServicesMatch(int profile_a, int profile_b) {
|
|
|
| bool AllServicesMatch() {
|
| // Use 0 as the baseline.
|
| - if (!ServiceMatchesVerifier(0))
|
| + if (!ServiceMatchesVerifier(0)) {
|
| + LOG(ERROR) << "TemplateURLService 0 does not match verifier.";
|
| return false;
|
| + }
|
|
|
| for (int it = 0; it < test()->num_clients(); ++it) {
|
| if (!ServicesMatch(0, it)) {
|
| @@ -191,7 +193,8 @@ TemplateURL* CreateTestTemplateURL(int seed) {
|
| }
|
|
|
| void AddSearchEngine(int profile, int seed) {
|
| - GetServiceForProfile(profile)->Add(CreateTestTemplateURL(seed));
|
| + if (profile != -1)
|
| + GetServiceForProfile(profile)->Add(CreateTestTemplateURL(seed));
|
| if (test()->use_verifier())
|
| GetVerifierService()->Add(CreateTestTemplateURL(seed));
|
| }
|
| @@ -201,13 +204,15 @@ void EditSearchEngine(int profile,
|
| const std::string& short_name,
|
| const std::string& new_keyword,
|
| const std::string& url) {
|
| - const TemplateURL* turl = GetServiceForProfile(profile)->
|
| + if (profile != -1) {
|
| + const TemplateURL* turl = GetServiceForProfile(profile)->
|
| GetTemplateURLForKeyword(ASCIIToUTF16(keyword));
|
| - EXPECT_TRUE(turl);
|
| - GetServiceForProfile(profile)->ResetTemplateURL(turl,
|
| - ASCIIToUTF16(short_name),
|
| - ASCIIToUTF16(new_keyword),
|
| - url);
|
| + EXPECT_TRUE(turl);
|
| + GetServiceForProfile(profile)->ResetTemplateURL(turl,
|
| + ASCIIToUTF16(short_name),
|
| + ASCIIToUTF16(new_keyword),
|
| + url);
|
| + }
|
| // Make sure we do the same on the verifier.
|
| if (test()->use_verifier()) {
|
| const TemplateURL* verifier_turl =
|
| @@ -221,10 +226,12 @@ void EditSearchEngine(int profile,
|
| }
|
|
|
| void DeleteSearchEngineByKeyword(int profile, const string16 keyword) {
|
| - const TemplateURL* turl = GetServiceForProfile(profile)->
|
| - GetTemplateURLForKeyword(keyword);
|
| - EXPECT_TRUE(turl);
|
| - GetServiceForProfile(profile)->Remove(turl);
|
| + if (profile != -1) {
|
| + const TemplateURL* turl = GetServiceForProfile(profile)->
|
| + GetTemplateURLForKeyword(keyword);
|
| + EXPECT_TRUE(turl);
|
| + GetServiceForProfile(profile)->Remove(turl);
|
| + }
|
| // Make sure we do the same on the verifier.
|
| if (test()->use_verifier()) {
|
| const TemplateURL* verifier_turl =
|
| @@ -239,17 +246,19 @@ void DeleteSearchEngineBySeed(int profile, int seed) {
|
| }
|
|
|
| void ChangeDefaultSearchProvider(int profile, int seed) {
|
| - TemplateURLService* service = GetServiceForProfile(profile);
|
| - ASSERT_TRUE(service);
|
| - const TemplateURL* new_default = service->GetTemplateURLForKeyword(
|
| - CreateKeyword(seed));
|
| - ASSERT_TRUE(new_default);
|
| - service->SetDefaultSearchProvider(new_default);
|
| - if (test()->use_verifier()) {
|
| - new_default = GetVerifierService()->GetTemplateURLForKeyword(
|
| + if (profile != -1) {
|
| + TemplateURLService* service = GetServiceForProfile(profile);
|
| + ASSERT_TRUE(service);
|
| + const TemplateURL* turl = service->GetTemplateURLForKeyword(
|
| CreateKeyword(seed));
|
| - ASSERT_TRUE(new_default);
|
| - GetVerifierService()->SetDefaultSearchProvider(new_default);
|
| + ASSERT_TRUE(turl);
|
| + service->SetDefaultSearchProvider(turl);
|
| + }
|
| + if (test()->use_verifier()) {
|
| + const TemplateURL* verifier_turl =
|
| + GetVerifierService()->GetTemplateURLForKeyword(CreateKeyword(seed));
|
| + ASSERT_TRUE(verifier_turl);
|
| + GetVerifierService()->SetDefaultSearchProvider(verifier_turl);
|
| }
|
| }
|
|
|
|
|