Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(264)

Side by Side Diff: chrome/browser/ui/search/instant_test_utils.cc

Issue 20388003: Reload Instant NTP and Instant-process tabs on search url change (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fixed InstantNTPPrerendererTest Created 7 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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/ui/search/instant_test_utils.h" 5 #include "chrome/browser/ui/search/instant_test_utils.h"
6 6
7 #include "base/command_line.h" 7 #include "base/command_line.h"
8 #include "base/prefs/pref_service.h" 8 #include "base/prefs/pref_service.h"
9 #include "base/strings/utf_string_conversions.h" 9 #include "base/strings/utf_string_conversions.h"
10 #include "chrome/browser/chrome_notification_types.h" 10 #include "chrome/browser/chrome_notification_types.h"
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
54 data.alternate_urls.push_back(instant_url_.spec() + "#q={searchTerms}"); 54 data.alternate_urls.push_back(instant_url_.spec() + "#q={searchTerms}");
55 data.search_terms_replacement_key = "strk"; 55 data.search_terms_replacement_key = "strk";
56 56
57 TemplateURL* template_url = new TemplateURL(browser_->profile(), data); 57 TemplateURL* template_url = new TemplateURL(browser_->profile(), data);
58 service->Add(template_url); // Takes ownership of |template_url|. 58 service->Add(template_url); // Takes ownership of |template_url|.
59 service->SetDefaultSearchProvider(template_url); 59 service->SetDefaultSearchProvider(template_url);
60 60
61 InstantService* instant_service = 61 InstantService* instant_service =
62 InstantServiceFactory::GetForProfile(browser_->profile()); 62 InstantServiceFactory::GetForProfile(browser_->profile());
63 ASSERT_NE(static_cast<InstantService*>(NULL), instant_service); 63 ASSERT_NE(static_cast<InstantService*>(NULL), instant_service);
64 instant_service->ntp_prerenderer()->ReloadStaleNTP(); 64 instant_service->ntp_prerenderer()->ReloadInstantNTP();
65 } 65 }
66 66
67 void InstantTestBase::SetInstantURL(const std::string& url) { 67 void InstantTestBase::SetInstantURL(const std::string& url) {
68 TemplateURLService* service = 68 TemplateURLService* service =
69 TemplateURLServiceFactory::GetForProfile(browser_->profile()); 69 TemplateURLServiceFactory::GetForProfile(browser_->profile());
70 ui_test_utils::WaitForTemplateURLServiceToLoad(service); 70 ui_test_utils::WaitForTemplateURLServiceToLoad(service);
71 71
72 TemplateURLData data; 72 TemplateURLData data;
73 data.short_name = ASCIIToUTF16("name"); 73 data.short_name = ASCIIToUTF16("name");
74 data.SetURL(url); 74 data.SetURL(url);
(...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after
174 return content::ExecuteScriptAndExtractBool(rvh, js_chrome, loaded); 174 return content::ExecuteScriptAndExtractBool(rvh, js_chrome, loaded);
175 } 175 }
176 176
177 string16 InstantTestBase::GetBlueText() { 177 string16 InstantTestBase::GetBlueText() {
178 size_t start = 0, end = 0; 178 size_t start = 0, end = 0;
179 omnibox()->GetSelectionBounds(&start, &end); 179 omnibox()->GetSelectionBounds(&start, &end);
180 if (start > end) 180 if (start > end)
181 std::swap(start, end); 181 std::swap(start, end);
182 return omnibox()->GetText().substr(start, end - start); 182 return omnibox()->GetText().substr(start, end - start);
183 } 183 }
OLDNEW
« no previous file with comments | « chrome/browser/ui/search/instant_ntp_prerenderer_unittest.cc ('k') | chrome/chrome_browser.gypi » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698