| 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 <stdint.h> | 5 #include <stdint.h> |
| 6 | 6 |
| 7 #include <sstream> | 7 #include <sstream> |
| 8 | 8 |
| 9 #include "base/base_switches.h" | 9 #include "base/base_switches.h" |
| 10 #include "base/command_line.h" | 10 #include "base/command_line.h" |
| (...skipping 157 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 168 bool UpdateSearchState(content::WebContents* contents) WARN_UNUSED_RESULT { | 168 bool UpdateSearchState(content::WebContents* contents) WARN_UNUSED_RESULT { |
| 169 return instant_test_utils::GetIntFromJS(contents, | 169 return instant_test_utils::GetIntFromJS(contents, |
| 170 "onMostVisitedChangedCalls", | 170 "onMostVisitedChangedCalls", |
| 171 &on_most_visited_change_calls_) && | 171 &on_most_visited_change_calls_) && |
| 172 instant_test_utils::GetIntFromJS(contents, "mostVisitedItemsCount", | 172 instant_test_utils::GetIntFromJS(contents, "mostVisitedItemsCount", |
| 173 &most_visited_items_count_) && | 173 &most_visited_items_count_) && |
| 174 instant_test_utils::GetIntFromJS(contents, "firstMostVisitedItemId", | 174 instant_test_utils::GetIntFromJS(contents, "firstMostVisitedItemId", |
| 175 &first_most_visited_item_id_) && | 175 &first_most_visited_item_id_) && |
| 176 instant_test_utils::GetIntFromJS(contents, "submitCount", | 176 instant_test_utils::GetIntFromJS(contents, "submitCount", |
| 177 &submit_count_) && | 177 &submit_count_) && |
| 178 instant_test_utils::GetStringFromJS(contents, "apiHandle.value", | |
| 179 &query_value_) && | |
| 180 instant_test_utils::GetIntFromJS(contents, "onFocusChangedCalls", | 178 instant_test_utils::GetIntFromJS(contents, "onFocusChangedCalls", |
| 181 &on_focus_changed_calls_) && | 179 &on_focus_changed_calls_) && |
| 182 instant_test_utils::GetBoolFromJS(contents, "isFocused", | 180 instant_test_utils::GetBoolFromJS(contents, "isFocused", |
| 183 &is_focused_) && | 181 &is_focused_) && |
| 184 instant_test_utils::GetStringFromJS(contents, "prefetchQuery", | 182 instant_test_utils::GetStringFromJS(contents, "prefetchQuery", |
| 185 &prefetch_query_value_); | 183 &prefetch_query_value_); |
| 186 } | 184 } |
| 187 | 185 |
| 188 const TemplateURL* GetDefaultSearchProviderTemplateURL() { | 186 const TemplateURL* GetDefaultSearchProviderTemplateURL() { |
| 189 TemplateURLService* template_url_service = | 187 TemplateURLService* template_url_service = |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 227 | 225 |
| 228 int CountSearchProviderSuggestions() { | 226 int CountSearchProviderSuggestions() { |
| 229 return omnibox()->model()->autocomplete_controller()->search_provider()-> | 227 return omnibox()->model()->autocomplete_controller()->search_provider()-> |
| 230 matches().size(); | 228 matches().size(); |
| 231 } | 229 } |
| 232 | 230 |
| 233 int on_most_visited_change_calls_; | 231 int on_most_visited_change_calls_; |
| 234 int most_visited_items_count_; | 232 int most_visited_items_count_; |
| 235 int first_most_visited_item_id_; | 233 int first_most_visited_item_id_; |
| 236 int submit_count_; | 234 int submit_count_; |
| 237 std::string query_value_; | |
| 238 int on_focus_changed_calls_; | 235 int on_focus_changed_calls_; |
| 239 bool is_focused_; | 236 bool is_focused_; |
| 240 std::string prefetch_query_value_; | 237 std::string prefetch_query_value_; |
| 241 }; | 238 }; |
| 242 | 239 |
| 243 class InstantExtendedPrefetchTest : public InstantExtendedTest { | 240 class InstantExtendedPrefetchTest : public InstantExtendedTest { |
| 244 public: | 241 public: |
| 245 InstantExtendedPrefetchTest() | 242 InstantExtendedPrefetchTest() |
| 246 : factory_(new net::URLFetcherImplFactory()), | 243 : factory_(new net::URLFetcherImplFactory()), |
| 247 fake_factory_(new net::FakeURLFetcherFactory(factory_.get())) { | 244 fake_factory_(new net::FakeURLFetcherFactory(factory_.get())) { |
| (...skipping 488 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 736 stream << "link.href = \"" << result_url.spec() << "\";"; | 733 stream << "link.href = \"" << result_url.spec() << "\";"; |
| 737 stream << "document.body.appendChild(link);"; | 734 stream << "document.body.appendChild(link);"; |
| 738 stream << "link.click();"; | 735 stream << "link.click();"; |
| 739 EXPECT_TRUE(content::ExecuteScript(contents, stream.str())); | 736 EXPECT_TRUE(content::ExecuteScript(contents, stream.str())); |
| 740 | 737 |
| 741 content::WaitForLoadStop(contents); | 738 content::WaitForLoadStop(contents); |
| 742 std::string expected_title = | 739 std::string expected_title = |
| 743 "Referrer is " + instant_url().GetWithEmptyPath().spec(); | 740 "Referrer is " + instant_url().GetWithEmptyPath().spec(); |
| 744 EXPECT_EQ(ASCIIToUTF16(expected_title), contents->GetTitle()); | 741 EXPECT_EQ(ASCIIToUTF16(expected_title), contents->GetTitle()); |
| 745 } | 742 } |
| OLD | NEW |