| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "chrome/browser/search/instant_unittest_base.h" | 5 #include "chrome/browser/search/instant_unittest_base.h" |
| 6 #include <string> | 6 #include <string> |
| 7 | 7 |
| 8 #include "base/basictypes.h" | 8 #include "base/basictypes.h" |
| 9 #include "chrome/browser/chrome_notification_types.h" | 9 #include "chrome/browser/chrome_notification_types.h" |
| 10 #include "chrome/browser/google/google_url_tracker.h" | 10 #include "chrome/browser/google/google_url_tracker.h" |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 45 UIThreadSearchTermsData::SetGoogleBaseURL(""); | 45 UIThreadSearchTermsData::SetGoogleBaseURL(""); |
| 46 BrowserWithTestWindowTest::TearDown(); | 46 BrowserWithTestWindowTest::TearDown(); |
| 47 } | 47 } |
| 48 | 48 |
| 49 void InstantUnitTestBase::SetDefaultSearchProvider( | 49 void InstantUnitTestBase::SetDefaultSearchProvider( |
| 50 const std::string& base_url) { | 50 const std::string& base_url) { |
| 51 TemplateURLData data; | 51 TemplateURLData data; |
| 52 data.SetURL(base_url + "url?bar={searchTerms}"); | 52 data.SetURL(base_url + "url?bar={searchTerms}"); |
| 53 data.instant_url = base_url + "instant?" | 53 data.instant_url = base_url + "instant?" |
| 54 "{google:omniboxStartMarginParameter}foo=foo#foo=foo&strk"; | 54 "{google:omniboxStartMarginParameter}foo=foo#foo=foo&strk"; |
| 55 data.new_tab_url = base_url + "newtab"; |
| 55 data.alternate_urls.push_back(base_url + "alt#quux={searchTerms}"); | 56 data.alternate_urls.push_back(base_url + "alt#quux={searchTerms}"); |
| 56 data.search_terms_replacement_key = "strk"; | 57 data.search_terms_replacement_key = "strk"; |
| 57 | 58 |
| 58 TemplateURL* template_url = new TemplateURL(profile(), data); | 59 TemplateURL* template_url = new TemplateURL(profile(), data); |
| 59 // Takes ownership of |template_url|. | 60 // Takes ownership of |template_url|. |
| 60 template_url_service_->Add(template_url); | 61 template_url_service_->Add(template_url); |
| 61 template_url_service_->SetDefaultSearchProvider(template_url); | 62 template_url_service_->SetDefaultSearchProvider(template_url); |
| 62 } | 63 } |
| 63 | 64 |
| 64 void InstantUnitTestBase::NotifyGoogleBaseURLUpdate( | 65 void InstantUnitTestBase::NotifyGoogleBaseURLUpdate( |
| (...skipping 11 matching lines...) Expand all Loading... |
| 76 content::Source<Profile>(profile()->GetOriginalProfile()), | 77 content::Source<Profile>(profile()->GetOriginalProfile()), |
| 77 content::Details<GoogleURLTracker::UpdatedDetails>(&details)); | 78 content::Details<GoogleURLTracker::UpdatedDetails>(&details)); |
| 78 } | 79 } |
| 79 | 80 |
| 80 | 81 |
| 81 bool InstantUnitTestBase::IsInstantServiceObserver( | 82 bool InstantUnitTestBase::IsInstantServiceObserver( |
| 82 InstantServiceObserver* observer) { | 83 InstantServiceObserver* observer) { |
| 83 return instant_service_->observers_.HasObserver(observer); | 84 return instant_service_->observers_.HasObserver(observer); |
| 84 } | 85 } |
| 85 | 86 |
| OLD | NEW |