OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 "components/omnibox/browser/zero_suggest_provider.h" | 5 #include "components/omnibox/browser/zero_suggest_provider.h" |
6 | 6 |
7 #include "base/metrics/field_trial.h" | 7 #include "base/metrics/field_trial.h" |
8 #include "base/run_loop.h" | 8 #include "base/run_loop.h" |
9 #include "base/strings/utf_string_conversions.h" | 9 #include "base/strings/utf_string_conversions.h" |
10 #include "components/history/core/browser/top_sites.h" | 10 #include "components/history/core/browser/top_sites.h" |
(...skipping 310 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
321 base::ASCIIToUTF16("Foo")); | 321 base::ASCIIToUTF16("Foo")); |
322 urls.push_back(url); | 322 urls.push_back(url); |
323 | 323 |
324 provider_->Start(input, false); | 324 provider_->Start(input, false); |
325 EXPECT_TRUE(provider_->matches().empty()); | 325 EXPECT_TRUE(provider_->matches().empty()); |
326 // Stop() doesn't always get called. | 326 // Stop() doesn't always get called. |
327 | 327 |
328 std::string search_url("https://www.google.com/?q=flowers"); | 328 std::string search_url("https://www.google.com/?q=flowers"); |
329 AutocompleteInput srp_input( | 329 AutocompleteInput srp_input( |
330 base::ASCIIToUTF16(search_url), base::string16::npos, std::string(), | 330 base::ASCIIToUTF16(search_url), base::string16::npos, std::string(), |
331 GURL(search_url), metrics::OmniboxEventProto:: | 331 GURL(search_url), |
332 SEARCH_RESULT_PAGE_DOING_SEARCH_TERM_REPLACEMENT, | 332 metrics::OmniboxEventProto::SEARCH_RESULT_PAGE_NO_SEARCH_TERM_REPLACEMENT, |
333 false, false, true, true, true, TestSchemeClassifier()); | 333 false, false, true, true, true, TestSchemeClassifier()); |
334 | 334 |
335 provider_->Start(srp_input, false); | 335 provider_->Start(srp_input, false); |
336 EXPECT_TRUE(provider_->matches().empty()); | 336 EXPECT_TRUE(provider_->matches().empty()); |
337 // Most visited results arriving after a new request has been started. | 337 // Most visited results arriving after a new request has been started. |
338 scoped_refptr<history::TopSites> top_sites = client_->GetTopSites(); | 338 scoped_refptr<history::TopSites> top_sites = client_->GetTopSites(); |
339 static_cast<FakeEmptyTopSites*>(top_sites.get())->mv_callback.Run(urls); | 339 static_cast<FakeEmptyTopSites*>(top_sites.get())->mv_callback.Run(urls); |
340 EXPECT_TRUE(provider_->matches().empty()); | 340 EXPECT_TRUE(provider_->matches().empty()); |
341 } | 341 } |
342 | 342 |
(...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
453 | 453 |
454 base::RunLoop().RunUntilIdle(); | 454 base::RunLoop().RunUntilIdle(); |
455 | 455 |
456 // Expect that the matches have been cleared. | 456 // Expect that the matches have been cleared. |
457 ASSERT_TRUE(provider_->matches().empty()); | 457 ASSERT_TRUE(provider_->matches().empty()); |
458 | 458 |
459 // Expect the new results have been stored. | 459 // Expect the new results have been stored. |
460 EXPECT_EQ(empty_response, | 460 EXPECT_EQ(empty_response, |
461 prefs->GetString(omnibox::kZeroSuggestCachedResults)); | 461 prefs->GetString(omnibox::kZeroSuggestCachedResults)); |
462 } | 462 } |
OLD | NEW |