OLD | NEW |
1 // Copyright (c) 2011 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 "base/message_loop.h" | 5 #include "base/message_loop.h" |
6 #include "base/utf_string_conversions.h" | 6 #include "base/utf_string_conversions.h" |
7 #include "chrome/browser/autocomplete/autocomplete_match.h" | 7 #include "chrome/browser/autocomplete/autocomplete_match.h" |
8 #include "chrome/browser/autocomplete/builtin_provider.h" | 8 #include "chrome/browser/autocomplete/builtin_provider.h" |
9 #include "chrome/common/url_constants.h" | 9 #include "chrome/common/url_constants.h" |
10 #include "chrome/test/base/testing_browser_process.h" | 10 #include "chrome/test/base/testing_browser_process.h" |
11 #include "googleurl/src/gurl.h" | 11 #include "googleurl/src/gurl.h" |
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
63 } | 63 } |
64 } | 64 } |
65 } | 65 } |
66 } | 66 } |
67 | 67 |
68 TEST_F(BuiltinProviderTest, TypingScheme) { | 68 TEST_F(BuiltinProviderTest, TypingScheme) { |
69 const string16 kAbout = ASCIIToUTF16(chrome::kAboutScheme); | 69 const string16 kAbout = ASCIIToUTF16(chrome::kAboutScheme); |
70 const string16 kChrome = ASCIIToUTF16(chrome::kChromeUIScheme); | 70 const string16 kChrome = ASCIIToUTF16(chrome::kChromeUIScheme); |
71 const string16 kSeparator1 = ASCIIToUTF16(":"); | 71 const string16 kSeparator1 = ASCIIToUTF16(":"); |
72 const string16 kSeparator2 = ASCIIToUTF16(":/"); | 72 const string16 kSeparator2 = ASCIIToUTF16(":/"); |
73 const string16 kSeparator3 = ASCIIToUTF16(chrome::kStandardSchemeSeparator); | 73 const string16 kSeparator3 = ASCIIToUTF16(content::kStandardSchemeSeparator); |
74 | 74 |
75 // These default URLs should correspond with those in BuiltinProvider::Start. | 75 // These default URLs should correspond with those in BuiltinProvider::Start. |
76 const GURL kURL1 = GURL(chrome::kChromeUIChromeURLsURL); | 76 const GURL kURL1 = GURL(chrome::kChromeUIChromeURLsURL); |
77 const GURL kURL2 = GURL(chrome::kChromeUISettingsURL); | 77 const GURL kURL2 = GURL(chrome::kChromeUISettingsURL); |
78 const GURL kURL3 = GURL(chrome::kChromeUIVersionURL); | 78 const GURL kURL3 = GURL(chrome::kChromeUIVersionURL); |
79 | 79 |
80 test_data<GURL> typing_scheme_cases[] = { | 80 test_data<GURL> typing_scheme_cases[] = { |
81 // Typing an unrelated scheme should give nothing. | 81 // Typing an unrelated scheme should give nothing. |
82 {ASCIIToUTF16("h"), 0, {}}, | 82 {ASCIIToUTF16("h"), 0, {}}, |
83 {ASCIIToUTF16("http"), 0, {}}, | 83 {ASCIIToUTF16("http"), 0, {}}, |
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
129 | 129 |
130 RunTest<GURL>(non_chrome_url_cases, arraysize(non_chrome_url_cases), | 130 RunTest<GURL>(non_chrome_url_cases, arraysize(non_chrome_url_cases), |
131 &AutocompleteMatch::destination_url); | 131 &AutocompleteMatch::destination_url); |
132 } | 132 } |
133 | 133 |
134 TEST_F(BuiltinProviderTest, ChromeURLs) { | 134 TEST_F(BuiltinProviderTest, ChromeURLs) { |
135 const string16 kAbout = ASCIIToUTF16(chrome::kAboutScheme); | 135 const string16 kAbout = ASCIIToUTF16(chrome::kAboutScheme); |
136 const string16 kChrome = ASCIIToUTF16(chrome::kChromeUIScheme); | 136 const string16 kChrome = ASCIIToUTF16(chrome::kChromeUIScheme); |
137 const string16 kSeparator1 = ASCIIToUTF16(":"); | 137 const string16 kSeparator1 = ASCIIToUTF16(":"); |
138 const string16 kSeparator2 = ASCIIToUTF16(":/"); | 138 const string16 kSeparator2 = ASCIIToUTF16(":/"); |
139 const string16 kSeparator3 = ASCIIToUTF16(chrome::kStandardSchemeSeparator); | 139 const string16 kSeparator3 = ASCIIToUTF16(content::kStandardSchemeSeparator); |
140 | 140 |
141 // This makes assumptions about the chrome URLs listed by the BuiltinProvider. | 141 // This makes assumptions about the chrome URLs listed by the BuiltinProvider. |
142 // Currently they are derived from ChromePaths() in browser_about_handler.cc. | 142 // Currently they are derived from ChromePaths() in browser_about_handler.cc. |
143 const string16 kHostE = ASCIIToUTF16(chrome::kChromeUIExtensionsHost); | 143 const string16 kHostE = ASCIIToUTF16(chrome::kChromeUIExtensionsHost); |
144 const GURL kURLE = GURL(kChrome + kSeparator3 + kHostE); | 144 const GURL kURLE = GURL(kChrome + kSeparator3 + kHostE); |
145 const string16 kHostF1 = ASCIIToUTF16(chrome::kChromeUIFlagsHost); | 145 const string16 kHostF1 = ASCIIToUTF16(chrome::kChromeUIFlagsHost); |
146 const string16 kHostF2 = ASCIIToUTF16(chrome::kChromeUIFlashHost); | 146 const string16 kHostF2 = ASCIIToUTF16(chrome::kChromeUIFlashHost); |
147 const GURL kURLF1 = GURL(kChrome + kSeparator3 + kHostF1); | 147 const GURL kURLF1 = GURL(kChrome + kSeparator3 + kHostF1); |
148 const GURL kURLF2 = GURL(kChrome + kSeparator3 + kHostF2); | 148 const GURL kURLF2 = GURL(kChrome + kSeparator3 + kHostF2); |
149 | 149 |
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
218 {kSettings + kPage1.substr(0, 1), 2, {kURL1, kURL2}}, | 218 {kSettings + kPage1.substr(0, 1), 2, {kURL1, kURL2}}, |
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 } |
OLD | NEW |