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/ui/search/search_tab_helper.h" | 5 #include "chrome/browser/ui/search/search_tab_helper.h" |
6 | 6 |
7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
8 #include "base/memory/scoped_ptr.h" | 8 #include "base/memory/scoped_ptr.h" |
9 #include "base/strings/utf_string_conversions.h" | 9 #include "base/strings/utf_string_conversions.h" |
10 #include "chrome/browser/search/search.h" | 10 #include "chrome/browser/search/search.h" |
(...skipping 264 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
275 | 275 |
276 TemplateURLData data; | 276 TemplateURLData data; |
277 data.SetURL("http://foo.com/url?bar={searchTerms}"); | 277 data.SetURL("http://foo.com/url?bar={searchTerms}"); |
278 data.instant_url = "http://foo.com/instant?" | 278 data.instant_url = "http://foo.com/instant?" |
279 "{google:omniboxStartMarginParameter}{google:forceInstantResults}" | 279 "{google:omniboxStartMarginParameter}{google:forceInstantResults}" |
280 "foo=foo#foo=foo&strk"; | 280 "foo=foo#foo=foo&strk"; |
281 data.new_tab_url = std::string("https://foo.com/newtab?strk"); | 281 data.new_tab_url = std::string("https://foo.com/newtab?strk"); |
282 data.alternate_urls.push_back("http://foo.com/alt#quux={searchTerms}"); | 282 data.alternate_urls.push_back("http://foo.com/alt#quux={searchTerms}"); |
283 data.search_terms_replacement_key = "strk"; | 283 data.search_terms_replacement_key = "strk"; |
284 | 284 |
285 TemplateURL* template_url = new TemplateURL(profile(), data); | 285 TemplateURL* template_url = new TemplateURL(data); |
286 template_url_service->Add(template_url); | 286 template_url_service->Add(template_url); |
287 template_url_service->SetUserSelectedDefaultSearchProvider(template_url); | 287 template_url_service->SetUserSelectedDefaultSearchProvider(template_url); |
288 } | 288 } |
289 }; | 289 }; |
290 | 290 |
291 TEST_F(SearchTabHelperWindowTest, OnProvisionalLoadFailRedirectNTPToLocal) { | 291 TEST_F(SearchTabHelperWindowTest, OnProvisionalLoadFailRedirectNTPToLocal) { |
292 AddTab(browser(), GURL(chrome::kChromeUINewTabURL)); | 292 AddTab(browser(), GURL(chrome::kChromeUINewTabURL)); |
293 content::WebContents* contents = | 293 content::WebContents* contents = |
294 browser()->tab_strip_model()->GetWebContentsAt(0); | 294 browser()->tab_strip_model()->GetWebContentsAt(0); |
295 content::NavigationController* controller = &contents->GetController(); | 295 content::NavigationController* controller = &contents->GetController(); |
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
338 SearchTabHelper::FromWebContents(contents); | 338 SearchTabHelper::FromWebContents(contents); |
339 ASSERT_NE(static_cast<SearchTabHelper*>(NULL), search_tab_helper); | 339 ASSERT_NE(static_cast<SearchTabHelper*>(NULL), search_tab_helper); |
340 | 340 |
341 // Any other web page shouldn't be redirected when provisional load fails. | 341 // Any other web page shouldn't be redirected when provisional load fails. |
342 search_tab_helper->DidFailProvisionalLoad(1, base::string16(), true, | 342 search_tab_helper->DidFailProvisionalLoad(1, base::string16(), true, |
343 GURL("http://www.example.com"), 1, base::string16(), NULL); | 343 GURL("http://www.example.com"), 1, base::string16(), NULL); |
344 CommitPendingLoad(controller); | 344 CommitPendingLoad(controller); |
345 EXPECT_NE(GURL(chrome::kChromeSearchLocalNtpUrl), | 345 EXPECT_NE(GURL(chrome::kChromeSearchLocalNtpUrl), |
346 controller->GetLastCommittedEntry()->GetURL()); | 346 controller->GetLastCommittedEntry()->GetURL()); |
347 } | 347 } |
OLD | NEW |