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

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

Issue 10909130: autocomplete: Add AutocompleteProvider::Type enum. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: more indentation changes Created 8 years, 3 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/search_provider.h" 5 #include "chrome/browser/autocomplete/search_provider.h"
6 6
7 #include "base/run_loop.h" 7 #include "base/run_loop.h"
8 #include "base/string_util.h" 8 #include "base/string_util.h"
9 #include "base/time.h" 9 #include "base/time.h"
10 #include "base/utf_string_conversions.h" 10 #include "base/utf_string_conversions.h"
(...skipping 652 matching lines...) Expand 10 before | Expand all | Expand 10 after
663 // Verifies AutocompleteControllers sets descriptions for results correctly. 663 // Verifies AutocompleteControllers sets descriptions for results correctly.
664 TEST_F(SearchProviderTest, UpdateKeywordDescriptions) { 664 TEST_F(SearchProviderTest, UpdateKeywordDescriptions) {
665 // Add an entry that corresponds to a keyword search with 'term2'. 665 // Add an entry that corresponds to a keyword search with 'term2'.
666 AddSearchToHistory(keyword_t_url_, ASCIIToUTF16("term2"), 1); 666 AddSearchToHistory(keyword_t_url_, ASCIIToUTF16("term2"), 1);
667 profile_.BlockUntilHistoryProcessesPendingRequests(); 667 profile_.BlockUntilHistoryProcessesPendingRequests();
668 668
669 ACProviders providers; 669 ACProviders providers;
670 SearchProvider* provider = provider_.release(); 670 SearchProvider* provider = provider_.release();
671 providers.push_back(provider); 671 providers.push_back(provider);
672 AutocompleteController controller(providers, &profile_); 672 AutocompleteController controller(providers, &profile_);
673 controller.set_search_provider(provider);
674 provider->set_listener(&controller); 673 provider->set_listener(&controller);
675 controller.Start(ASCIIToUTF16("k t"), string16(), false, false, true, 674 controller.Start(ASCIIToUTF16("k t"), string16(), false, false, true,
676 AutocompleteInput::ALL_MATCHES); 675 AutocompleteInput::ALL_MATCHES);
677 const AutocompleteResult& result = controller.result(); 676 const AutocompleteResult& result = controller.result();
678 677
679 // There should be two matches, one for the keyword one for what you typed. 678 // There should be two matches, one for the keyword one for what you typed.
680 ASSERT_EQ(2u, result.size()); 679 ASSERT_EQ(2u, result.size());
681 680
682 EXPECT_FALSE(result.match_at(0).keyword.empty()); 681 EXPECT_FALSE(result.match_at(0).keyword.empty());
683 EXPECT_FALSE(result.match_at(1).keyword.empty()); 682 EXPECT_FALSE(result.match_at(1).keyword.empty());
(...skipping 564 matching lines...) Expand 10 before | Expand all | Expand 10 after
1248 EXPECT_EQ(AutocompleteMatch::ACMatchClassification::URL, 1247 EXPECT_EQ(AutocompleteMatch::ACMatchClassification::URL,
1249 match.contents_class[0].style); 1248 match.contents_class[0].style);
1250 EXPECT_EQ(4U, match.contents_class[1].offset); 1249 EXPECT_EQ(4U, match.contents_class[1].offset);
1251 EXPECT_EQ(AutocompleteMatch::ACMatchClassification::URL | 1250 EXPECT_EQ(AutocompleteMatch::ACMatchClassification::URL |
1252 AutocompleteMatch::ACMatchClassification::MATCH, 1251 AutocompleteMatch::ACMatchClassification::MATCH,
1253 match.contents_class[1].style); 1252 match.contents_class[1].style);
1254 EXPECT_EQ(5U, match.contents_class[2].offset); 1253 EXPECT_EQ(5U, match.contents_class[2].offset);
1255 EXPECT_EQ(AutocompleteMatch::ACMatchClassification::URL, 1254 EXPECT_EQ(AutocompleteMatch::ACMatchClassification::URL,
1256 match.contents_class[2].style); 1255 match.contents_class[2].style);
1257 } 1256 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698