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/builtin_provider.h" | 5 #include "chrome/browser/autocomplete/builtin_provider.h" |
6 | 6 |
7 #include "base/message_loop/message_loop.h" | 7 #include "base/message_loop/message_loop.h" |
8 #include "base/strings/utf_string_conversions.h" | 8 #include "base/strings/utf_string_conversions.h" |
9 #include "chrome/browser/autocomplete/autocomplete_input.h" | 9 #include "chrome/browser/autocomplete/autocomplete_input.h" |
10 #include "chrome/browser/autocomplete/autocomplete_match.h" | 10 #include "chrome/browser/autocomplete/autocomplete_match.h" |
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
67 for (size_t j = 0; j < builtin_cases[i].num_results; ++j) { | 67 for (size_t j = 0; j < builtin_cases[i].num_results; ++j) { |
68 EXPECT_EQ(builtin_cases[i].output[j], matches[j].*member) << | 68 EXPECT_EQ(builtin_cases[i].output[j], matches[j].*member) << |
69 ASCIIToUTF16("Input was: ") << builtin_cases[i].input; | 69 ASCIIToUTF16("Input was: ") << builtin_cases[i].input; |
70 EXPECT_FALSE(matches[j].allowed_to_be_default_match); | 70 EXPECT_FALSE(matches[j].allowed_to_be_default_match); |
71 } | 71 } |
72 } | 72 } |
73 } | 73 } |
74 } | 74 } |
75 | 75 |
76 TEST_F(BuiltinProviderTest, TypingScheme) { | 76 TEST_F(BuiltinProviderTest, TypingScheme) { |
77 const base::string16 kAbout = ASCIIToUTF16(chrome::kAboutScheme); | 77 const base::string16 kAbout = ASCIIToUTF16(content::kAboutScheme); |
78 const base::string16 kChrome = ASCIIToUTF16(content::kChromeUIScheme); | 78 const base::string16 kChrome = ASCIIToUTF16(content::kChromeUIScheme); |
79 const base::string16 kSeparator1 = ASCIIToUTF16(":"); | 79 const base::string16 kSeparator1 = ASCIIToUTF16(":"); |
80 const base::string16 kSeparator2 = ASCIIToUTF16(":/"); | 80 const base::string16 kSeparator2 = ASCIIToUTF16(":/"); |
81 const base::string16 kSeparator3 = | 81 const base::string16 kSeparator3 = |
82 ASCIIToUTF16(content::kStandardSchemeSeparator); | 82 ASCIIToUTF16(content::kStandardSchemeSeparator); |
83 | 83 |
84 // These default URLs should correspond with those in BuiltinProvider::Start. | 84 // These default URLs should correspond with those in BuiltinProvider::Start. |
85 const GURL kURL1 = GURL(chrome::kChromeUIChromeURLsURL); | 85 const GURL kURL1 = GURL(chrome::kChromeUIChromeURLsURL); |
86 const GURL kURL2 = GURL(chrome::kChromeUISettingsURL); | 86 const GURL kURL2 = GURL(chrome::kChromeUISettingsURL); |
87 const GURL kURL3 = GURL(chrome::kChromeUIVersionURL); | 87 const GURL kURL3 = GURL(chrome::kChromeUIVersionURL); |
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
134 {ASCIIToUTF16("scheme://host"), 0, {}}, | 134 {ASCIIToUTF16("scheme://host"), 0, {}}, |
135 {ASCIIToUTF16("scheme:host/path?query#ref"), 0, {}}, | 135 {ASCIIToUTF16("scheme:host/path?query#ref"), 0, {}}, |
136 {ASCIIToUTF16("scheme://host/path?query#ref"), 0, {}}, | 136 {ASCIIToUTF16("scheme://host/path?query#ref"), 0, {}}, |
137 }; | 137 }; |
138 | 138 |
139 RunTest<GURL>(non_chrome_url_cases, arraysize(non_chrome_url_cases), | 139 RunTest<GURL>(non_chrome_url_cases, arraysize(non_chrome_url_cases), |
140 &AutocompleteMatch::destination_url); | 140 &AutocompleteMatch::destination_url); |
141 } | 141 } |
142 | 142 |
143 TEST_F(BuiltinProviderTest, ChromeURLs) { | 143 TEST_F(BuiltinProviderTest, ChromeURLs) { |
144 const base::string16 kAbout = ASCIIToUTF16(chrome::kAboutScheme); | 144 const base::string16 kAbout = ASCIIToUTF16(content::kAboutScheme); |
145 const base::string16 kChrome = ASCIIToUTF16(content::kChromeUIScheme); | 145 const base::string16 kChrome = ASCIIToUTF16(content::kChromeUIScheme); |
146 const base::string16 kSeparator1 = ASCIIToUTF16(":"); | 146 const base::string16 kSeparator1 = ASCIIToUTF16(":"); |
147 const base::string16 kSeparator2 = ASCIIToUTF16(":/"); | 147 const base::string16 kSeparator2 = ASCIIToUTF16(":/"); |
148 const base::string16 kSeparator3 = | 148 const base::string16 kSeparator3 = |
149 ASCIIToUTF16(content::kStandardSchemeSeparator); | 149 ASCIIToUTF16(content::kStandardSchemeSeparator); |
150 | 150 |
151 // This makes assumptions about the chrome URLs listed by the BuiltinProvider. | 151 // This makes assumptions about the chrome URLs listed by the BuiltinProvider. |
152 // Currently they are derived from chrome::kChromeHostURLs[]. | 152 // Currently they are derived from chrome::kChromeHostURLs[]. |
153 const base::string16 kHostM1 = | 153 const base::string16 kHostM1 = |
154 ASCIIToUTF16(content::kChromeUIMediaInternalsHost); | 154 ASCIIToUTF16(content::kChromeUIMediaInternalsHost); |
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
219 {kSettings + kPage1.substr(0, 2), 1, {kURL1}}, | 219 {kSettings + kPage1.substr(0, 2), 1, {kURL1}}, |
220 {kSettings + kPage1.substr(0, kPage1.length() - 1), 1, {kURL1}}, | 220 {kSettings + kPage1.substr(0, kPage1.length() - 1), 1, {kURL1}}, |
221 {kSettings + kPage1, 1, {kURL1}}, | 221 {kSettings + kPage1, 1, {kURL1}}, |
222 {kSettings + kPage2, 1, {kURL2}}, | 222 {kSettings + kPage2, 1, {kURL2}}, |
223 }; | 223 }; |
224 | 224 |
225 RunTest<GURL>(settings_subpage_cases, arraysize(settings_subpage_cases), | 225 RunTest<GURL>(settings_subpage_cases, arraysize(settings_subpage_cases), |
226 &AutocompleteMatch::destination_url); | 226 &AutocompleteMatch::destination_url); |
227 } | 227 } |
228 #endif | 228 #endif |
OLD | NEW |