Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(104)

Side by Side Diff: components/omnibox/browser/autocomplete_input_unittest.cc

Issue 2378213002: Mark URLs with empty schemes as invalid. (Closed)
Patch Set: Comments Created 4 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « components/omnibox/browser/autocomplete_input.cc ('k') | components/url_formatter/url_fixer.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 "components/omnibox/browser/autocomplete_input.h" 5 #include "components/omnibox/browser/autocomplete_input.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 8
9 #include "base/macros.h" 9 #include "base/macros.h"
10 #include "base/strings/string16.h" 10 #include "base/strings/string16.h"
(...skipping 143 matching lines...) Expand 10 before | Expand all | Expand 10 after
154 { ASCIIToUTF16("filesystem:http://a.com/t/bar"), 154 { ASCIIToUTF16("filesystem:http://a.com/t/bar"),
155 metrics::OmniboxInputType::URL }, 155 metrics::OmniboxInputType::URL },
156 { ASCIIToUTF16("filesystem:http://a.com/"), 156 { ASCIIToUTF16("filesystem:http://a.com/"),
157 metrics::OmniboxInputType::QUERY }, 157 metrics::OmniboxInputType::QUERY },
158 { ASCIIToUTF16("filesystem:file://"), metrics::OmniboxInputType::QUERY }, 158 { ASCIIToUTF16("filesystem:file://"), metrics::OmniboxInputType::QUERY },
159 { ASCIIToUTF16("filesystem:http"), metrics::OmniboxInputType::QUERY }, 159 { ASCIIToUTF16("filesystem:http"), metrics::OmniboxInputType::QUERY },
160 { ASCIIToUTF16("filesystem:"), metrics::OmniboxInputType::QUERY }, 160 { ASCIIToUTF16("filesystem:"), metrics::OmniboxInputType::QUERY },
161 { ASCIIToUTF16("chrome-search://"), metrics::OmniboxInputType::QUERY }, 161 { ASCIIToUTF16("chrome-search://"), metrics::OmniboxInputType::QUERY },
162 { ASCIIToUTF16("chrome-devtools:"), metrics::OmniboxInputType::QUERY }, 162 { ASCIIToUTF16("chrome-devtools:"), metrics::OmniboxInputType::QUERY },
163 { ASCIIToUTF16("about://f;"), metrics::OmniboxInputType::QUERY }, 163 { ASCIIToUTF16("about://f;"), metrics::OmniboxInputType::QUERY },
164 { ASCIIToUTF16("://w"), metrics::OmniboxInputType::QUERY }, 164 { ASCIIToUTF16("://w"), metrics::OmniboxInputType::UNKNOWN },
165 { ASCIIToUTF16(":w"), metrics::OmniboxInputType::QUERY }, 165 { ASCIIToUTF16(":w"), metrics::OmniboxInputType::UNKNOWN },
166 { base::WideToUTF16(L".\u062A"), metrics::OmniboxInputType::UNKNOWN }, 166 { base::WideToUTF16(L".\u062A"), metrics::OmniboxInputType::UNKNOWN },
167 }; 167 };
168 168
169 for (size_t i = 0; i < arraysize(input_cases); ++i) { 169 for (size_t i = 0; i < arraysize(input_cases); ++i) {
170 SCOPED_TRACE(input_cases[i].input); 170 SCOPED_TRACE(input_cases[i].input);
171 AutocompleteInput input(input_cases[i].input, base::string16::npos, 171 AutocompleteInput input(input_cases[i].input, base::string16::npos,
172 std::string(), GURL(), 172 std::string(), GURL(),
173 OmniboxEventProto::INVALID_SPEC, true, false, true, 173 OmniboxEventProto::INVALID_SPEC, true, false, true,
174 true, false, TestSchemeClassifier()); 174 true, false, TestSchemeClassifier());
175 EXPECT_EQ(input_cases[i].type, input.type()); 175 EXPECT_EQ(input_cases[i].type, input.type());
(...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after
308 SCOPED_TRACE(input_cases[i].input); 308 SCOPED_TRACE(input_cases[i].input);
309 AutocompleteInput input(input_cases[i].input, 309 AutocompleteInput input(input_cases[i].input,
310 input_cases[i].cursor_position, std::string(), 310 input_cases[i].cursor_position, std::string(),
311 GURL(), OmniboxEventProto::INVALID_SPEC, true, 311 GURL(), OmniboxEventProto::INVALID_SPEC, true,
312 false, true, true, false, TestSchemeClassifier()); 312 false, true, true, false, TestSchemeClassifier());
313 EXPECT_EQ(input_cases[i].normalized_input, input.text()); 313 EXPECT_EQ(input_cases[i].normalized_input, input.text());
314 EXPECT_EQ(input_cases[i].normalized_cursor_position, 314 EXPECT_EQ(input_cases[i].normalized_cursor_position,
315 input.cursor_position()); 315 input.cursor_position());
316 } 316 }
317 } 317 }
OLDNEW
« no previous file with comments | « components/omnibox/browser/autocomplete_input.cc ('k') | components/url_formatter/url_fixer.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698