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

Side by Side Diff: chrome/browser/instant/instant_test_utils.cc

Issue 11824050: InstantExtended: Committed NTP (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Undo to fix blacklisting. Created 7 years, 10 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/instant/instant_tab.cc ('k') | chrome/browser/ui/browser.h » ('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/instant/instant_test_utils.h" 5 #include "chrome/browser/instant/instant_test_utils.h"
6 6
7 #include "base/command_line.h" 7 #include "base/command_line.h"
8 #include "chrome/browser/prefs/pref_service.h" 8 #include "chrome/browser/prefs/pref_service.h"
9 #include "chrome/browser/profiles/profile.h" 9 #include "chrome/browser/profiles/profile.h"
10 #include "chrome/browser/search_engines/template_url_service.h" 10 #include "chrome/browser/search_engines/template_url_service.h"
11 #include "chrome/browser/search_engines/template_url_service_factory.h" 11 #include "chrome/browser/search_engines/template_url_service_factory.h"
12 #include "chrome/common/chrome_notification_types.h"
13 #include "chrome/common/chrome_switches.h" 12 #include "chrome/common/chrome_switches.h"
14 #include "chrome/common/pref_names.h" 13 #include "chrome/common/pref_names.h"
15 #include "chrome/test/base/interactive_test_utils.h" 14 #include "chrome/test/base/interactive_test_utils.h"
16 #include "chrome/test/base/ui_test_utils.h" 15 #include "chrome/test/base/ui_test_utils.h"
17 #include "content/public/browser/notification_service.h"
18 #include "content/public/browser/render_process_host.h" 16 #include "content/public/browser/render_process_host.h"
19 #include "content/public/browser/web_contents.h" 17 #include "content/public/browser/web_contents.h"
20 #include "content/public/common/result_codes.h" 18 #include "content/public/common/result_codes.h"
21 #include "content/public/test/browser_test_utils.h" 19 #include "content/public/test/browser_test_utils.h"
22 20
23 namespace { 21 namespace {
24 22
25 std::string WrapScript(const std::string& script) { 23 std::string WrapScript(const std::string& script) {
26 return "domAutomationController.send(" + script + ")"; 24 return "domAutomationController.send(" + script + ")";
27 } 25 }
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after
92 void InstantTestBase::FocusOmnibox() { 90 void InstantTestBase::FocusOmnibox() {
93 // If the omnibox already has focus, just notify Instant. 91 // If the omnibox already has focus, just notify Instant.
94 if (omnibox()->model()->has_focus()) { 92 if (omnibox()->model()->has_focus()) {
95 instant()->OmniboxFocusChanged(OMNIBOX_FOCUS_VISIBLE, 93 instant()->OmniboxFocusChanged(OMNIBOX_FOCUS_VISIBLE,
96 OMNIBOX_FOCUS_CHANGE_EXPLICIT, NULL); 94 OMNIBOX_FOCUS_CHANGE_EXPLICIT, NULL);
97 } else { 95 } else {
98 browser()->window()->GetLocationBar()->FocusLocation(false); 96 browser()->window()->GetLocationBar()->FocusLocation(false);
99 } 97 }
100 } 98 }
101 99
102 void InstantTestBase::FocusOmniboxAndWaitForInstantSupport() {
103 content::WindowedNotificationObserver observer(
104 chrome::NOTIFICATION_INSTANT_SUPPORT_DETERMINED,
105 content::NotificationService::AllSources());
106 FocusOmnibox();
107 observer.Wait();
108 }
109
110 void InstantTestBase::SetOmniboxText(const std::string& text) { 100 void InstantTestBase::SetOmniboxText(const std::string& text) {
111 FocusOmnibox(); 101 FocusOmnibox();
112 omnibox()->SetUserText(UTF8ToUTF16(text)); 102 omnibox()->SetUserText(UTF8ToUTF16(text));
113 } 103 }
114 104
115 void InstantTestBase::SetOmniboxTextAndWaitForInstantToShow( 105 void InstantTestBase::SetOmniboxTextAndWaitForInstantToShow(
116 const std::string& text) { 106 const std::string& text) {
117 InstantTestModelObserver observer( 107 InstantTestModelObserver observer(
118 instant()->model(), chrome::search::Mode::MODE_SEARCH_SUGGESTIONS); 108 instant()->model(), chrome::search::Mode::MODE_SEARCH_SUGGESTIONS);
119 SetOmniboxText(text); 109 SetOmniboxText(text);
(...skipping 26 matching lines...) Expand all
146 } 136 }
147 137
148 bool InstantTestBase::CheckVisibilityIs(content::WebContents* contents, 138 bool InstantTestBase::CheckVisibilityIs(content::WebContents* contents,
149 bool expected) { 139 bool expected) {
150 bool actual = !expected; // Purposely start with a mis-match. 140 bool actual = !expected; // Purposely start with a mis-match.
151 // We can only use ASSERT_*() in a method that returns void, hence this 141 // We can only use ASSERT_*() in a method that returns void, hence this
152 // convoluted check. 142 // convoluted check.
153 return GetBoolFromJS(contents, "!document.webkitHidden", &actual) && 143 return GetBoolFromJS(contents, "!document.webkitHidden", &actual) &&
154 actual == expected; 144 actual == expected;
155 } 145 }
OLDNEW
« no previous file with comments | « chrome/browser/instant/instant_tab.cc ('k') | chrome/browser/ui/browser.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698