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

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

Issue 2738003002: Add title to current page in zero suggest. (Closed)
Patch Set: Remove debugging info. Created 3 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 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 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/shortcuts_provider_test_util.h" 5 #include "components/omnibox/browser/shortcuts_provider_test_util.h"
6 6
7 #include "base/run_loop.h" 7 #include "base/run_loop.h"
8 #include "base/strings/utf_string_conversions.h" 8 #include "base/strings/utf_string_conversions.h"
9 #include "components/omnibox/browser/autocomplete_match.h" 9 #include "components/omnibox/browser/autocomplete_match.h"
10 #include "components/omnibox/browser/shortcuts_backend.h" 10 #include "components/omnibox/browser/shortcuts_backend.h"
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after
64 } 64 }
65 65
66 void RunShortcutsProviderTest( 66 void RunShortcutsProviderTest(
67 scoped_refptr<ShortcutsProvider> provider, 67 scoped_refptr<ShortcutsProvider> provider,
68 const base::string16 text, 68 const base::string16 text,
69 bool prevent_inline_autocomplete, 69 bool prevent_inline_autocomplete,
70 const std::vector<ExpectedURLAndAllowedToBeDefault>& expected_urls, 70 const std::vector<ExpectedURLAndAllowedToBeDefault>& expected_urls,
71 std::string expected_top_result, 71 std::string expected_top_result,
72 base::string16 top_result_inline_autocompletion) { 72 base::string16 top_result_inline_autocompletion) {
73 base::RunLoop().RunUntilIdle(); 73 base::RunLoop().RunUntilIdle();
74 AutocompleteInput input(text, base::string16::npos, std::string(), GURL(), 74 AutocompleteInput input(
75 metrics::OmniboxEventProto::INVALID_SPEC, 75 text, base::string16::npos, std::string(), GURL(), base::string16(),
76 prevent_inline_autocomplete, false, true, true, false, 76 metrics::OmniboxEventProto::INVALID_SPEC, prevent_inline_autocomplete,
77 TestSchemeClassifier()); 77 false, true, true, false, TestSchemeClassifier());
78 provider->Start(input, false); 78 provider->Start(input, false);
79 EXPECT_TRUE(provider->done()); 79 EXPECT_TRUE(provider->done());
80 80
81 ACMatches ac_matches = provider->matches(); 81 ACMatches ac_matches = provider->matches();
82 82
83 // We should have gotten back at most AutocompleteProvider::kMaxMatches. 83 // We should have gotten back at most AutocompleteProvider::kMaxMatches.
84 EXPECT_LE(ac_matches.size(), AutocompleteProvider::kMaxMatches); 84 EXPECT_LE(ac_matches.size(), AutocompleteProvider::kMaxMatches);
85 85
86 // If the number of expected and actual matches aren't equal then we need 86 // If the number of expected and actual matches aren't equal then we need
87 // test no further, but let's do anyway so that we know which URLs failed. 87 // test no further, but let's do anyway so that we know which URLs failed.
(...skipping 11 matching lines...) Expand all
99 99
100 // See if we got the expected top scorer. 100 // See if we got the expected top scorer.
101 if (!ac_matches.empty()) { 101 if (!ac_matches.empty()) {
102 std::partial_sort(ac_matches.begin(), ac_matches.begin() + 1, 102 std::partial_sort(ac_matches.begin(), ac_matches.begin() + 1,
103 ac_matches.end(), AutocompleteMatch::MoreRelevant); 103 ac_matches.end(), AutocompleteMatch::MoreRelevant);
104 EXPECT_EQ(expected_top_result, ac_matches[0].destination_url.spec()); 104 EXPECT_EQ(expected_top_result, ac_matches[0].destination_url.spec());
105 EXPECT_EQ(top_result_inline_autocompletion, 105 EXPECT_EQ(top_result_inline_autocompletion,
106 ac_matches[0].inline_autocompletion); 106 ac_matches[0].inline_autocompletion);
107 } 107 }
108 } 108 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698