| 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.h" | 9 #include "base/message_loop.h" |
| 10 #include "base/path_service.h" | 10 #include "base/path_service.h" |
| (...skipping 837 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 848 "mailto://a@b.com", {0, npos, npos}, 0 }, | 848 "mailto://a@b.com", {0, npos, npos}, 0 }, |
| 849 }; | 849 }; |
| 850 for (size_t i = 0; i < ARRAYSIZE_UNSAFE(test_cases); ++i) { | 850 for (size_t i = 0; i < ARRAYSIZE_UNSAFE(test_cases); ++i) { |
| 851 SCOPED_TRACE(testing::Message() << "Index " << i << " input: " | 851 SCOPED_TRACE(testing::Message() << "Index " << i << " input: " |
| 852 << test_cases[i].input << ", trim_http: " | 852 << test_cases[i].input << ", trim_http: " |
| 853 << test_cases[i].trim_http); | 853 << test_cases[i].trim_http); |
| 854 | 854 |
| 855 AutocompleteInput input(ASCIIToUTF16(test_cases[i].input), string16::npos, | 855 AutocompleteInput input(ASCIIToUTF16(test_cases[i].input), string16::npos, |
| 856 string16(), GURL("about:blank"), | 856 string16(), GURL("about:blank"), |
| 857 false, false, true, AutocompleteInput::ALL_MATCHES); | 857 false, false, true, AutocompleteInput::ALL_MATCHES); |
| 858 AutocompleteMatch match = | 858 AutocompleteMatch match = HistoryURLProvider::SuggestExactInput( |
| 859 HistoryURLProvider::SuggestExactInput(autocomplete_, input, | 859 autocomplete_.get(), input, test_cases[i].trim_http); |
| 860 test_cases[i].trim_http); | |
| 861 EXPECT_EQ(ASCIIToUTF16(test_cases[i].contents), match.contents); | 860 EXPECT_EQ(ASCIIToUTF16(test_cases[i].contents), match.contents); |
| 862 for (size_t match_index = 0; match_index < match.contents_class.size(); | 861 for (size_t match_index = 0; match_index < match.contents_class.size(); |
| 863 ++match_index) { | 862 ++match_index) { |
| 864 EXPECT_EQ(test_cases[i].offsets[match_index], | 863 EXPECT_EQ(test_cases[i].offsets[match_index], |
| 865 match.contents_class[match_index].offset); | 864 match.contents_class[match_index].offset); |
| 866 EXPECT_EQ(ACMatchClassification::URL | | 865 EXPECT_EQ(ACMatchClassification::URL | |
| 867 (match_index == test_cases[i].match_classification_index ? | 866 (match_index == test_cases[i].match_classification_index ? |
| 868 ACMatchClassification::MATCH : 0), | 867 ACMatchClassification::MATCH : 0), |
| 869 match.contents_class[match_index].style); | 868 match.contents_class[match_index].style); |
| 870 } | 869 } |
| 871 EXPECT_EQ(npos, test_cases[i].offsets[match.contents_class.size()]); | 870 EXPECT_EQ(npos, test_cases[i].offsets[match.contents_class.size()]); |
| 872 } | 871 } |
| 873 } | 872 } |
| OLD | NEW |