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

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

Issue 836213002: Assume all providers may give zero suggest responses. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix compilation issue in athena Created 5 years, 11 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/keyword_provider.cc ('k') | components/omnibox/search_provider.h » ('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 "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 79 matching lines...) Expand 10 before | Expand all | Expand 10 after
90 void KeywordProviderTest::RunTest(TestData<ResultType>* keyword_cases, 90 void KeywordProviderTest::RunTest(TestData<ResultType>* keyword_cases,
91 int num_cases, 91 int num_cases,
92 ResultType AutocompleteMatch::* member) { 92 ResultType AutocompleteMatch::* member) {
93 ACMatches matches; 93 ACMatches matches;
94 for (int i = 0; i < num_cases; ++i) { 94 for (int i = 0; i < num_cases; ++i) {
95 SCOPED_TRACE(keyword_cases[i].input); 95 SCOPED_TRACE(keyword_cases[i].input);
96 AutocompleteInput input(keyword_cases[i].input, base::string16::npos, 96 AutocompleteInput input(keyword_cases[i].input, base::string16::npos,
97 std::string(), GURL(), 97 std::string(), GURL(),
98 metrics::OmniboxEventProto::INVALID_SPEC, true, 98 metrics::OmniboxEventProto::INVALID_SPEC, true,
99 false, true, true, TestingSchemeClassifier()); 99 false, true, true, TestingSchemeClassifier());
100 kw_provider_->Start(input, false); 100 kw_provider_->Start(input, false, false);
101 EXPECT_TRUE(kw_provider_->done()); 101 EXPECT_TRUE(kw_provider_->done());
102 matches = kw_provider_->matches(); 102 matches = kw_provider_->matches();
103 ASSERT_EQ(keyword_cases[i].num_results, matches.size()); 103 ASSERT_EQ(keyword_cases[i].num_results, matches.size());
104 for (size_t j = 0; j < matches.size(); ++j) { 104 for (size_t j = 0; j < matches.size(); ++j) {
105 EXPECT_EQ(keyword_cases[i].output[j].member, matches[j].*member); 105 EXPECT_EQ(keyword_cases[i].output[j].member, matches[j].*member);
106 EXPECT_EQ(keyword_cases[i].output[j].allowed_to_be_default_match, 106 EXPECT_EQ(keyword_cases[i].output[j].allowed_to_be_default_match,
107 matches[j].allowed_to_be_default_match); 107 matches[j].allowed_to_be_default_match);
108 } 108 }
109 } 109 }
110 } 110 }
(...skipping 249 matching lines...) Expand 10 before | Expand all | Expand 10 after
360 TestData<GURL> url_cases[] = { 360 TestData<GURL> url_cases[] = {
361 { ASCIIToUTF16("a 1 2 3"), 3, 361 { ASCIIToUTF16("a 1 2 3"), 3,
362 { { GURL("aa.com?a=b&foo=1+2+3"), false }, 362 { { GURL("aa.com?a=b&foo=1+2+3"), false },
363 { GURL("bogus URL 1+2+3"), false }, 363 { GURL("bogus URL 1+2+3"), false },
364 { GURL("http://aaaa/?aaaa=1&b=1+2+3&c"), false } } }, 364 { GURL("http://aaaa/?aaaa=1&b=1+2+3&c"), false } } },
365 }; 365 };
366 366
367 RunTest<GURL>(url_cases, arraysize(url_cases), 367 RunTest<GURL>(url_cases, arraysize(url_cases),
368 &AutocompleteMatch::destination_url); 368 &AutocompleteMatch::destination_url);
369 } 369 }
370
371 TEST_F(KeywordProviderTest, DoesNotProvideMatchesOnFocus) {
372 AutocompleteInput input(ASCIIToUTF16("aaa"), base::string16::npos,
373 std::string(), GURL(),
374 metrics::OmniboxEventProto::INVALID_SPEC, true,
375 false, true, true, TestingSchemeClassifier());
376 kw_provider_->Start(input, false, true);
377 ASSERT_TRUE(kw_provider_->matches().empty());
378 }
OLDNEW
« no previous file with comments | « components/omnibox/keyword_provider.cc ('k') | components/omnibox/search_provider.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698