| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/autocomplete/autocomplete_result.h" | 5 #include "chrome/browser/autocomplete/autocomplete_result.h" |
| 6 | 6 |
| 7 #include "base/memory/scoped_ptr.h" | 7 #include "base/memory/scoped_ptr.h" |
| 8 #include "base/metrics/field_trial.h" | 8 #include "base/metrics/field_trial.h" |
| 9 #include "base/strings/string_number_conversions.h" | 9 #include "base/strings/string_number_conversions.h" |
| 10 #include "base/strings/string_util.h" | 10 #include "base/strings/string_util.h" |
| 11 #include "base/strings/utf_string_conversions.h" | 11 #include "base/strings/utf_string_conversions.h" |
| 12 #include "chrome/browser/autocomplete/autocomplete_input.h" | 12 #include "chrome/browser/autocomplete/autocomplete_input.h" |
| 13 #include "chrome/browser/autocomplete/autocomplete_match.h" | 13 #include "chrome/browser/autocomplete/autocomplete_match.h" |
| 14 #include "chrome/browser/autocomplete/autocomplete_provider.h" | 14 #include "chrome/browser/autocomplete/autocomplete_provider.h" |
| 15 #include "chrome/browser/omnibox/omnibox_field_trial.h" | 15 #include "chrome/browser/omnibox/omnibox_field_trial.h" |
| 16 #include "chrome/browser/search_engines/template_url_prepopulate_data.h" | 16 #include "chrome/browser/search_engines/template_url_prepopulate_data.h" |
| 17 #include "chrome/browser/search_engines/template_url_service.h" | 17 #include "chrome/browser/search_engines/template_url_service.h" |
| 18 #include "chrome/browser/search_engines/template_url_service_test_util.h" | 18 #include "chrome/browser/search_engines/template_url_service_test_util.h" |
| 19 #include "chrome/common/autocomplete_match_type.h" | 19 #include "chrome/common/autocomplete_match_type.h" |
| 20 #include "chrome/common/metrics/entropy_provider.h" | |
| 21 #include "chrome/common/metrics/variations/variations_util.h" | 20 #include "chrome/common/metrics/variations/variations_util.h" |
| 22 #include "chrome/test/base/testing_profile.h" | 21 #include "chrome/test/base/testing_profile.h" |
| 22 #include "components/variations/entropy_provider.h" |
| 23 #include "testing/gtest/include/gtest/gtest.h" | 23 #include "testing/gtest/include/gtest/gtest.h" |
| 24 | 24 |
| 25 class AutocompleteResultTest : public testing::Test { | 25 class AutocompleteResultTest : public testing::Test { |
| 26 public: | 26 public: |
| 27 struct TestData { | 27 struct TestData { |
| 28 // Used to build a url for the AutocompleteMatch. The URL becomes | 28 // Used to build a url for the AutocompleteMatch. The URL becomes |
| 29 // "http://" + ('a' + |url_id|) (e.g. an ID of 2 yields "http://b"). | 29 // "http://" + ('a' + |url_id|) (e.g. an ID of 2 yields "http://b"). |
| 30 int url_id; | 30 int url_id; |
| 31 | 31 |
| 32 // ID of the provider. | 32 // ID of the provider. |
| (...skipping 388 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 421 AutocompleteInput::HOMEPAGE, false, false, false, | 421 AutocompleteInput::HOMEPAGE, false, false, false, |
| 422 AutocompleteInput::ALL_MATCHES); | 422 AutocompleteInput::ALL_MATCHES); |
| 423 result.SortAndCull(input, test_util_.profile()); | 423 result.SortAndCull(input, test_util_.profile()); |
| 424 ASSERT_EQ(4U, result.size()); | 424 ASSERT_EQ(4U, result.size()); |
| 425 EXPECT_EQ("http://c/", result.match_at(0)->destination_url.spec()); | 425 EXPECT_EQ("http://c/", result.match_at(0)->destination_url.spec()); |
| 426 EXPECT_EQ("http://a/", result.match_at(1)->destination_url.spec()); | 426 EXPECT_EQ("http://a/", result.match_at(1)->destination_url.spec()); |
| 427 EXPECT_EQ("http://b/", result.match_at(2)->destination_url.spec()); | 427 EXPECT_EQ("http://b/", result.match_at(2)->destination_url.spec()); |
| 428 EXPECT_EQ("http://d/", result.match_at(3)->destination_url.spec()); | 428 EXPECT_EQ("http://d/", result.match_at(3)->destination_url.spec()); |
| 429 } | 429 } |
| 430 } | 430 } |
| OLD | NEW |