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

Side by Side Diff: chrome/browser/autocomplete/extension_app_provider_unittest.cc

Issue 8364001: Strip special characters in extension omnibox suggestions. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: '' Created 9 years, 1 month 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 | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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/basictypes.h" 5 #include "base/basictypes.h"
6 #include "base/message_loop.h" 6 #include "base/message_loop.h"
7 #include "base/utf_string_conversions.h" 7 #include "base/utf_string_conversions.h"
8 #include "chrome/browser/autocomplete/autocomplete_match.h" 8 #include "chrome/browser/autocomplete/autocomplete_match.h"
9 #include "chrome/browser/autocomplete/extension_app_provider.h" 9 #include "chrome/browser/autocomplete/extension_app_provider.h"
10 #include "chrome/browser/history/history.h" 10 #include "chrome/browser/history/history.h"
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after
98 GURL("http://fdsa/") }}, 98 GURL("http://fdsa/") }},
99 // The string 'co' appears in one extension app. 99 // The string 'co' appears in one extension app.
100 {ASCIIToUTF16("co"), 1, { GURL("http://asdf/") }}, 100 {ASCIIToUTF16("co"), 1, { GURL("http://asdf/") }},
101 // Try with URL matching. 101 // Try with URL matching.
102 {ASCIIToUTF16("http://asdf/"), 1, { GURL("http://asdf/") }}, 102 {ASCIIToUTF16("http://asdf/"), 1, { GURL("http://asdf/") }},
103 {ASCIIToUTF16("http://fdsa/"), 1, { GURL("http://fdsa/") }}, 103 {ASCIIToUTF16("http://fdsa/"), 1, { GURL("http://fdsa/") }},
104 }; 104 };
105 105
106 RunTest(edit_cases, ARRAYSIZE_UNSAFE(edit_cases)); 106 RunTest(edit_cases, ARRAYSIZE_UNSAFE(edit_cases));
107 } 107 }
108
109 TEST_F(ExtensionAppProviderTest, CreateMatchSanitize) {
110 struct TestData {
111 const char* name;
112 const char* match_contents;
113 } cases[] = {
114 { "Test", "Test" },
115 { "Test \n Test", "Test Test" },
116 { "Test\r\t\nTest", "TestTest" },
117 };
118
119 AutocompleteInput input(ASCIIToUTF16("Test"), string16(),
120 true, true, true, AutocompleteInput::BEST_MATCH);
121 string16 url(ASCIIToUTF16("http://example.com"));
122 for (size_t i = 0; i < ARRAYSIZE_UNSAFE(cases); ++i) {
123 AutocompleteMatch match =
124 app_provider_->CreateAutocompleteMatch(input,
125 ASCIIToUTF16(cases[i].name),
126 url, 0, string16::npos);
127 EXPECT_EQ(ASCIIToUTF16(cases[i].match_contents), match.contents);
128 }
129 }
130
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698