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

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

Issue 1260033003: Partially componentize //chrome/browser/search/search.{h,cc} (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix compilation on iOS Created 5 years, 4 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
« no previous file with comments | « chrome/browser/ui/search/search_tab_helper.cc ('k') | chrome/browser/ui/singleton_tabs.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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/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/metrics/field_trial.h" 9 #include "base/metrics/field_trial.h"
10 #include "base/strings/utf_string_conversions.h" 10 #include "base/strings/utf_string_conversions.h"
(...skipping 383 matching lines...) Expand 10 before | Expand all | Expand 10 after
394 SearchTabHelper::FromWebContents(web_contents())->set_omnibox_has_focus_fn( 394 SearchTabHelper::FromWebContents(web_contents())->set_omnibox_has_focus_fn(
395 omnibox_has_focus); 395 omnibox_has_focus);
396 SearchTabHelperPrerenderTest::omnibox_has_focus_ = true; 396 SearchTabHelperPrerenderTest::omnibox_has_focus_ = true;
397 } 397 }
398 398
399 content::WebContents* web_contents() { 399 content::WebContents* web_contents() {
400 return browser()->tab_strip_model()->GetActiveWebContents(); 400 return browser()->tab_strip_model()->GetActiveWebContents();
401 } 401 }
402 402
403 bool IsInstantURLMarkedForPrerendering() { 403 bool IsInstantURLMarkedForPrerendering() {
404 GURL instant_url(chrome::GetSearchResultPrefetchBaseURL(profile())); 404 GURL instant_url(search::GetSearchResultPrefetchBaseURL(profile()));
405 prerender::PrerenderManager* prerender_manager = 405 prerender::PrerenderManager* prerender_manager =
406 prerender::PrerenderManagerFactory::GetForProfile(profile()); 406 prerender::PrerenderManagerFactory::GetForProfile(profile());
407 return prerender_manager->HasPrerenderedUrl(instant_url, web_contents()); 407 return prerender_manager->HasPrerenderedUrl(instant_url, web_contents());
408 } 408 }
409 409
410 static bool omnibox_has_focus(OmniboxView* omnibox) { 410 static bool omnibox_has_focus(OmniboxView* omnibox) {
411 return omnibox_has_focus_; 411 return omnibox_has_focus_;
412 } 412 }
413 413
414 static bool omnibox_has_focus_; 414 static bool omnibox_has_focus_;
(...skipping 20 matching lines...) Expand all
435 } 435 }
436 436
437 TEST_F(SearchTabHelperPrerenderTest, 437 TEST_F(SearchTabHelperPrerenderTest,
438 OnTabActivatedNoPrerenderIfOmniboxBlurred) { 438 OnTabActivatedNoPrerenderIfOmniboxBlurred) {
439 SearchTabHelperPrerenderTest::omnibox_has_focus_ = false; 439 SearchTabHelperPrerenderTest::omnibox_has_focus_ = false;
440 SearchTabHelper* search_tab_helper = 440 SearchTabHelper* search_tab_helper =
441 SearchTabHelper::FromWebContents(web_contents()); 441 SearchTabHelper::FromWebContents(web_contents());
442 search_tab_helper->OnTabActivated(); 442 search_tab_helper->OnTabActivated();
443 ASSERT_FALSE(IsInstantURLMarkedForPrerendering()); 443 ASSERT_FALSE(IsInstantURLMarkedForPrerendering());
444 } 444 }
OLDNEW
« no previous file with comments | « chrome/browser/ui/search/search_tab_helper.cc ('k') | chrome/browser/ui/singleton_tabs.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698