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/history_url_provider.h" | 5 #include "chrome/browser/autocomplete/history_url_provider.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 | 8 |
9 #include "base/message_loop/message_loop.h" | 9 #include "base/message_loop/message_loop.h" |
10 #include "base/path_service.h" | 10 #include "base/path_service.h" |
(...skipping 862 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
873 }; | 873 }; |
874 for (size_t i = 0; i < ARRAYSIZE_UNSAFE(test_cases); ++i) { | 874 for (size_t i = 0; i < ARRAYSIZE_UNSAFE(test_cases); ++i) { |
875 SCOPED_TRACE(testing::Message() << "Index " << i << " input: " | 875 SCOPED_TRACE(testing::Message() << "Index " << i << " input: " |
876 << test_cases[i].input << ", trim_http: " | 876 << test_cases[i].input << ", trim_http: " |
877 << test_cases[i].trim_http); | 877 << test_cases[i].trim_http); |
878 | 878 |
879 AutocompleteInput input(ASCIIToUTF16(test_cases[i].input), string16::npos, | 879 AutocompleteInput input(ASCIIToUTF16(test_cases[i].input), string16::npos, |
880 string16(), GURL("about:blank"), | 880 string16(), GURL("about:blank"), |
881 AutocompleteInput::INVALID_SPEC, false, false, true, | 881 AutocompleteInput::INVALID_SPEC, false, false, true, |
882 AutocompleteInput::ALL_MATCHES); | 882 AutocompleteInput::ALL_MATCHES); |
883 AutocompleteMatch match = HistoryURLProvider::SuggestExactInput( | 883 AutocompleteMatch match(autocomplete_->SuggestExactInput( |
884 autocomplete_.get(), input, test_cases[i].trim_http); | 884 input.text(), input.canonicalized_url(), test_cases[i].trim_http)); |
885 EXPECT_EQ(ASCIIToUTF16(test_cases[i].contents), match.contents); | 885 EXPECT_EQ(ASCIIToUTF16(test_cases[i].contents), match.contents); |
886 for (size_t match_index = 0; match_index < match.contents_class.size(); | 886 for (size_t match_index = 0; match_index < match.contents_class.size(); |
887 ++match_index) { | 887 ++match_index) { |
888 EXPECT_EQ(test_cases[i].offsets[match_index], | 888 EXPECT_EQ(test_cases[i].offsets[match_index], |
889 match.contents_class[match_index].offset); | 889 match.contents_class[match_index].offset); |
890 EXPECT_EQ(ACMatchClassification::URL | | 890 EXPECT_EQ(ACMatchClassification::URL | |
891 (match_index == test_cases[i].match_classification_index ? | 891 (match_index == test_cases[i].match_classification_index ? |
892 ACMatchClassification::MATCH : 0), | 892 ACMatchClassification::MATCH : 0), |
893 match.contents_class[match_index].style); | 893 match.contents_class[match_index].style); |
894 } | 894 } |
895 EXPECT_EQ(npos, test_cases[i].offsets[match.contents_class.size()]); | 895 EXPECT_EQ(npos, test_cases[i].offsets[match.contents_class.size()]); |
896 } | 896 } |
897 } | 897 } |
OLD | NEW |