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

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

Issue 18878007: Omnibox: Make the Controller Reorder Matches for Inlining (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase Created 7 years, 4 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 | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 "chrome/browser/autocomplete/shortcuts_provider.h" 5 #include "chrome/browser/autocomplete/shortcuts_provider.h"
6 6
7 #include <math.h> 7 #include <math.h>
8 8
9 #include <algorithm> 9 #include <algorithm>
10 #include <functional> 10 #include <functional>
(...skipping 237 matching lines...) Expand 10 before | Expand all | Expand 10 after
248 for_each(expected_urls.begin(), expected_urls.end(), 248 for_each(expected_urls.begin(), expected_urls.end(),
249 SetShouldContain(ac_matches_)).Leftovers(); 249 SetShouldContain(ac_matches_)).Leftovers();
250 EXPECT_EQ(0U, Leftovers.size()); 250 EXPECT_EQ(0U, Leftovers.size());
251 251
252 // See if we got the expected top scorer. 252 // See if we got the expected top scorer.
253 if (!ac_matches_.empty()) { 253 if (!ac_matches_.empty()) {
254 std::partial_sort(ac_matches_.begin(), ac_matches_.begin() + 1, 254 std::partial_sort(ac_matches_.begin(), ac_matches_.begin() + 1,
255 ac_matches_.end(), AutocompleteMatch::MoreRelevant); 255 ac_matches_.end(), AutocompleteMatch::MoreRelevant);
256 EXPECT_EQ(expected_top_result, ac_matches_[0].destination_url.spec()); 256 EXPECT_EQ(expected_top_result, ac_matches_[0].destination_url.spec());
257 } 257 }
258
259 // No shortcuts matches are allowed to be inlined no matter how highly
260 // they score.
261 for (ACMatches::const_iterator it = ac_matches_.begin();
262 it != ac_matches_.end(); ++it)
263 EXPECT_FALSE(it->allowed_to_be_default_match);
258 } 264 }
259 265
260 TEST_F(ShortcutsProviderTest, SimpleSingleMatch) { 266 TEST_F(ShortcutsProviderTest, SimpleSingleMatch) {
261 string16 text(ASCIIToUTF16("go")); 267 string16 text(ASCIIToUTF16("go"));
262 std::string expected_url("http://www.google.com/"); 268 std::string expected_url("http://www.google.com/");
263 std::vector<std::string> expected_urls; 269 std::vector<std::string> expected_urls;
264 expected_urls.push_back(expected_url); 270 expected_urls.push_back(expected_url);
265 RunTest(text, expected_urls, expected_url); 271 RunTest(text, expected_urls, expected_url);
266 } 272 }
267 273
(...skipping 399 matching lines...) Expand 10 before | Expand all | Expand 10 after
667 673
668 match.destination_url = GURL(shortcuts_to_test_delete[2].url); 674 match.destination_url = GURL(shortcuts_to_test_delete[2].url);
669 match.contents = ASCIIToUTF16(shortcuts_to_test_delete[2].contents); 675 match.contents = ASCIIToUTF16(shortcuts_to_test_delete[2].contents);
670 match.description = ASCIIToUTF16(shortcuts_to_test_delete[2].description); 676 match.description = ASCIIToUTF16(shortcuts_to_test_delete[2].description);
671 677
672 provider_->DeleteMatch(match); 678 provider_->DeleteMatch(match);
673 EXPECT_EQ(original_shortcuts_count, backend_->shortcuts_map().size()); 679 EXPECT_EQ(original_shortcuts_count, backend_->shortcuts_map().size());
674 EXPECT_TRUE(backend_->shortcuts_map().end() == 680 EXPECT_TRUE(backend_->shortcuts_map().end() ==
675 backend_->shortcuts_map().find(ASCIIToUTF16("delete"))); 681 backend_->shortcuts_map().find(ASCIIToUTF16("delete")));
676 } 682 }
OLDNEW
« no previous file with comments | « chrome/browser/autocomplete/shortcuts_provider.cc ('k') | chrome/browser/autocomplete/zero_suggest_provider.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698