X-Git-Url: http://review.tizen.org/git/?a=blobdiff_plain;f=src%2Fchrome%2Fbrowser%2Fsearch%2Finstant_unittest_base.cc;h=d164e4b82c127946ce30334908786340a046067e;hb=004985e17e624662a4c85c76a7654039dc83f028;hp=b45dd19a63dcf8251dd85fc2f01534bb617d9c08;hpb=2f108dbacb161091e42a3479f4e171339b7e7623;p=platform%2Fframework%2Fweb%2Fcrosswalk.git diff --git a/src/chrome/browser/search/instant_unittest_base.cc b/src/chrome/browser/search/instant_unittest_base.cc index b45dd19..d164e4b 100644 --- a/src/chrome/browser/search/instant_unittest_base.cc +++ b/src/chrome/browser/search/instant_unittest_base.cc @@ -5,7 +5,7 @@ #include "chrome/browser/search/instant_unittest_base.h" #include -#include "base/basictypes.h" +#include "base/strings/utf_string_conversions.h" #include "chrome/browser/chrome_notification_types.h" #include "chrome/browser/google/google_url_tracker.h" #include "chrome/browser/profiles/profile.h" @@ -49,9 +49,10 @@ void InstantUnitTestBase::SetUpWithoutQueryExtraction() { } #endif -void InstantUnitTestBase::SetDefaultSearchProvider( +void InstantUnitTestBase::SetUserSelectedDefaultSearchProvider( const std::string& base_url) { TemplateURLData data; + data.SetKeyword(base::UTF8ToUTF16(base_url)); data.SetURL(base_url + "url?bar={searchTerms}"); data.instant_url = base_url + "instant?{google:omniboxStartMarginParameter}{google:forceInstantResults}" @@ -63,7 +64,7 @@ void InstantUnitTestBase::SetDefaultSearchProvider( TemplateURL* template_url = new TemplateURL(profile(), data); // Takes ownership of |template_url|. template_url_service_->Add(template_url); - template_url_service_->SetDefaultSearchProvider(template_url); + template_url_service_->SetUserSelectedDefaultSearchProvider(template_url); } void InstantUnitTestBase::NotifyGoogleBaseURLUpdate( @@ -87,11 +88,16 @@ bool InstantUnitTestBase::IsInstantServiceObserver( return instant_service_->observers_.HasObserver(observer); } +TestingProfile* InstantUnitTestBase::CreateProfile() { + TestingProfile* profile = BrowserWithTestWindowTest::CreateProfile(); + TemplateURLServiceFactory::GetInstance()->SetTestingFactoryAndUse( + profile, &TemplateURLServiceFactory::BuildInstanceFor); + return profile; +} + void InstantUnitTestBase::SetUpHelper() { BrowserWithTestWindowTest::SetUp(); - TemplateURLServiceFactory::GetInstance()->SetTestingFactoryAndUse( - profile(), &TemplateURLServiceFactory::BuildInstanceFor); template_url_service_ = TemplateURLServiceFactory::GetForProfile(profile()); ui_test_utils::WaitForTemplateURLServiceToLoad(template_url_service_); @@ -99,6 +105,6 @@ void InstantUnitTestBase::SetUpHelper() { TestingPrefServiceSyncable* pref_service = profile()->GetTestingPrefService(); pref_service->SetUserPref(prefs::kLastPromptedGoogleURL, new base::StringValue("https://www.google.com/")); - SetDefaultSearchProvider("{google:baseURL}"); + SetUserSelectedDefaultSearchProvider("{google:baseURL}"); instant_service_ = InstantServiceFactory::GetForProfile(profile()); }