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