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

Side by Side Diff: components/omnibox/keyword_provider_unittest.cc

Issue 1135163002: Omnibox - Strip Extra Whitespace from Custom Search Engine Names (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: fix more tests that don't set short_name Created 5 years, 7 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
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 "base/command_line.h" 5 #include "base/command_line.h"
6 #include "base/message_loop/message_loop.h" 6 #include "base/message_loop/message_loop.h"
7 #include "base/strings/utf_string_conversions.h" 7 #include "base/strings/utf_string_conversions.h"
8 #include "components/metrics/proto/omnibox_event.pb.h" 8 #include "components/metrics/proto/omnibox_event.pb.h"
9 #include "components/omnibox/autocomplete_match.h" 9 #include "components/omnibox/autocomplete_match.h"
10 #include "components/omnibox/autocomplete_scheme_classifier.h" 10 #include "components/omnibox/autocomplete_scheme_classifier.h"
(...skipping 251 matching lines...) Expand 10 before | Expand all | Expand 10 after
262 { ASCIIToUTF16("Search ab for 1 2+ 3"), false }, 262 { ASCIIToUTF16("Search ab for 1 2+ 3"), false },
263 { ASCIIToUTF16("Search aaaa for 1 2+ 3"), false } } }, 263 { ASCIIToUTF16("Search aaaa for 1 2+ 3"), false } } },
264 }; 264 };
265 265
266 RunTest<base::string16>(contents_cases, arraysize(contents_cases), 266 RunTest<base::string16>(contents_cases, arraysize(contents_cases),
267 &AutocompleteMatch::contents); 267 &AutocompleteMatch::contents);
268 } 268 }
269 269
270 TEST_F(KeywordProviderTest, AddKeyword) { 270 TEST_F(KeywordProviderTest, AddKeyword) {
271 TemplateURLData data; 271 TemplateURLData data;
272 data.short_name = ASCIIToUTF16("Test"); 272 data.SetShortName(ASCIIToUTF16("Test"));
273 base::string16 keyword(ASCIIToUTF16("foo")); 273 base::string16 keyword(ASCIIToUTF16("foo"));
274 data.SetKeyword(keyword); 274 data.SetKeyword(keyword);
275 data.SetURL("http://www.google.com/foo?q={searchTerms}"); 275 data.SetURL("http://www.google.com/foo?q={searchTerms}");
276 TemplateURL* template_url = new TemplateURL(data); 276 TemplateURL* template_url = new TemplateURL(data);
277 model_->Add(template_url); 277 model_->Add(template_url);
278 ASSERT_TRUE(template_url == model_->GetTemplateURLForKeyword(keyword)); 278 ASSERT_TRUE(template_url == model_->GetTemplateURLForKeyword(keyword));
279 } 279 }
280 280
281 TEST_F(KeywordProviderTest, RemoveKeyword) { 281 TEST_F(KeywordProviderTest, RemoveKeyword) {
282 base::string16 url(ASCIIToUTF16("http://aaaa/?aaaa=1&b={searchTerms}&c")); 282 base::string16 url(ASCIIToUTF16("http://aaaa/?aaaa=1&b={searchTerms}&c"));
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after
369 } 369 }
370 370
371 TEST_F(KeywordProviderTest, DoesNotProvideMatchesOnFocus) { 371 TEST_F(KeywordProviderTest, DoesNotProvideMatchesOnFocus) {
372 AutocompleteInput input(ASCIIToUTF16("aaa"), base::string16::npos, 372 AutocompleteInput input(ASCIIToUTF16("aaa"), base::string16::npos,
373 std::string(), GURL(), 373 std::string(), GURL(),
374 metrics::OmniboxEventProto::INVALID_SPEC, true, 374 metrics::OmniboxEventProto::INVALID_SPEC, true,
375 false, true, true, TestingSchemeClassifier()); 375 false, true, true, TestingSchemeClassifier());
376 kw_provider_->Start(input, false, true); 376 kw_provider_->Start(input, false, true);
377 ASSERT_TRUE(kw_provider_->matches().empty()); 377 ASSERT_TRUE(kw_provider_->matches().empty());
378 } 378 }
OLDNEW
« no previous file with comments | « components/omnibox/autocomplete_result_unittest.cc ('k') | components/search_engines/default_search_manager.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698