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 <sstream> | 5 #include <sstream> |
6 | 6 |
7 #include "base/base_switches.h" | 7 #include "base/base_switches.h" |
8 #include "base/command_line.h" | 8 #include "base/command_line.h" |
9 #include "base/metrics/histogram_base.h" | 9 #include "base/metrics/histogram_base.h" |
10 #include "base/metrics/histogram_samples.h" | 10 #include "base/metrics/histogram_samples.h" |
(...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
132 public: | 132 public: |
133 InstantExtendedTest() | 133 InstantExtendedTest() |
134 : on_most_visited_change_calls_(0), | 134 : on_most_visited_change_calls_(0), |
135 most_visited_items_count_(0), | 135 most_visited_items_count_(0), |
136 first_most_visited_item_id_(0), | 136 first_most_visited_item_id_(0), |
137 on_native_suggestions_calls_(0), | 137 on_native_suggestions_calls_(0), |
138 on_change_calls_(0), | 138 on_change_calls_(0), |
139 submit_count_(0), | 139 submit_count_(0), |
140 on_esc_key_press_event_calls_(0), | 140 on_esc_key_press_event_calls_(0), |
141 on_focus_changed_calls_(0), | 141 on_focus_changed_calls_(0), |
142 is_focused_(false), | 142 is_focused_(false) {} |
143 on_toggle_voice_search_calls_(0) { | 143 |
144 } | |
145 protected: | 144 protected: |
146 void SetUpInProcessBrowserTestFixture() override { | 145 void SetUpInProcessBrowserTestFixture() override { |
147 search::EnableQueryExtractionForTesting(); | 146 search::EnableQueryExtractionForTesting(); |
148 ASSERT_TRUE(https_test_server().Start()); | 147 ASSERT_TRUE(https_test_server().Start()); |
149 GURL instant_url = https_test_server().GetURL( | 148 GURL instant_url = https_test_server().GetURL( |
150 "files/instant_extended.html?strk=1&"); | 149 "files/instant_extended.html?strk=1&"); |
151 GURL ntp_url = https_test_server().GetURL( | 150 GURL ntp_url = https_test_server().GetURL( |
152 "files/instant_extended_ntp.html?strk=1&"); | 151 "files/instant_extended_ntp.html?strk=1&"); |
153 InstantTestBase::Init(instant_url, ntp_url, false); | 152 InstantTestBase::Init(instant_url, ntp_url, false); |
154 } | 153 } |
(...skipping 23 matching lines...) Expand all Loading... |
178 GetIntFromJS(contents, "submitCount", | 177 GetIntFromJS(contents, "submitCount", |
179 &submit_count_) && | 178 &submit_count_) && |
180 GetStringFromJS(contents, "apiHandle.value", | 179 GetStringFromJS(contents, "apiHandle.value", |
181 &query_value_) && | 180 &query_value_) && |
182 GetIntFromJS(contents, "onEscKeyPressedCalls", | 181 GetIntFromJS(contents, "onEscKeyPressedCalls", |
183 &on_esc_key_press_event_calls_) && | 182 &on_esc_key_press_event_calls_) && |
184 GetIntFromJS(contents, "onFocusChangedCalls", | 183 GetIntFromJS(contents, "onFocusChangedCalls", |
185 &on_focus_changed_calls_) && | 184 &on_focus_changed_calls_) && |
186 GetBoolFromJS(contents, "isFocused", | 185 GetBoolFromJS(contents, "isFocused", |
187 &is_focused_) && | 186 &is_focused_) && |
188 GetIntFromJS(contents, "onToggleVoiceSearchCalls", | |
189 &on_toggle_voice_search_calls_) && | |
190 GetStringFromJS(contents, "prefetchQuery", &prefetch_query_value_); | 187 GetStringFromJS(contents, "prefetchQuery", &prefetch_query_value_); |
191 | 188 |
192 } | 189 } |
193 | 190 |
194 TemplateURL* GetDefaultSearchProviderTemplateURL() { | 191 TemplateURL* GetDefaultSearchProviderTemplateURL() { |
195 TemplateURLService* template_url_service = | 192 TemplateURLService* template_url_service = |
196 TemplateURLServiceFactory::GetForProfile(browser()->profile()); | 193 TemplateURLServiceFactory::GetForProfile(browser()->profile()); |
197 if (template_url_service) | 194 if (template_url_service) |
198 return template_url_service->GetDefaultSearchProvider(); | 195 return template_url_service->GetDefaultSearchProvider(); |
199 return NULL; | 196 return NULL; |
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
240 int on_most_visited_change_calls_; | 237 int on_most_visited_change_calls_; |
241 int most_visited_items_count_; | 238 int most_visited_items_count_; |
242 int first_most_visited_item_id_; | 239 int first_most_visited_item_id_; |
243 int on_native_suggestions_calls_; | 240 int on_native_suggestions_calls_; |
244 int on_change_calls_; | 241 int on_change_calls_; |
245 int submit_count_; | 242 int submit_count_; |
246 int on_esc_key_press_event_calls_; | 243 int on_esc_key_press_event_calls_; |
247 std::string query_value_; | 244 std::string query_value_; |
248 int on_focus_changed_calls_; | 245 int on_focus_changed_calls_; |
249 bool is_focused_; | 246 bool is_focused_; |
250 int on_toggle_voice_search_calls_; | |
251 std::string prefetch_query_value_; | 247 std::string prefetch_query_value_; |
252 }; | 248 }; |
253 | 249 |
254 class InstantExtendedPrefetchTest : public InstantExtendedTest { | 250 class InstantExtendedPrefetchTest : public InstantExtendedTest { |
255 public: | 251 public: |
256 InstantExtendedPrefetchTest() | 252 InstantExtendedPrefetchTest() |
257 : factory_(new net::URLFetcherImplFactory()), | 253 : factory_(new net::URLFetcherImplFactory()), |
258 fake_factory_(new net::FakeURLFetcherFactory(factory_.get())) { | 254 fake_factory_(new net::FakeURLFetcherFactory(factory_.get())) { |
259 } | 255 } |
260 | 256 |
(...skipping 744 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1005 stream << "link.href = \"" << result_url.spec() << "\";"; | 1001 stream << "link.href = \"" << result_url.spec() << "\";"; |
1006 stream << "document.body.appendChild(link);"; | 1002 stream << "document.body.appendChild(link);"; |
1007 stream << "link.click();"; | 1003 stream << "link.click();"; |
1008 EXPECT_TRUE(content::ExecuteScript(contents, stream.str())); | 1004 EXPECT_TRUE(content::ExecuteScript(contents, stream.str())); |
1009 | 1005 |
1010 content::WaitForLoadStop(contents); | 1006 content::WaitForLoadStop(contents); |
1011 std::string expected_title = | 1007 std::string expected_title = |
1012 "Referrer is " + instant_url().GetWithEmptyPath().spec(); | 1008 "Referrer is " + instant_url().GetWithEmptyPath().spec(); |
1013 EXPECT_EQ(ASCIIToUTF16(expected_title), contents->GetTitle()); | 1009 EXPECT_EQ(ASCIIToUTF16(expected_title), contents->GetTitle()); |
1014 } | 1010 } |
OLD | NEW |