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

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

Issue 363893002: Revert of Reduces dependency from AutocompleteMatch to Profile. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 5 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 2012 The Chromium Authors. All rights reserved. 1 // Copyright 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 <string> 7 #include <string>
8 8
9 #include "base/command_line.h" 9 #include "base/command_line.h"
10 #include "base/metrics/field_trial.h" 10 #include "base/metrics/field_trial.h"
(...skipping 878 matching lines...) Expand 10 before | Expand all | Expand 10 after
889 EXPECT_TRUE(term_match.allowed_to_be_default_match); 889 EXPECT_TRUE(term_match.allowed_to_be_default_match);
890 } 890 }
891 891
892 // Verifies AutocompleteControllers return results (including keyword 892 // Verifies AutocompleteControllers return results (including keyword
893 // results) in the right order and set descriptions for them correctly. 893 // results) in the right order and set descriptions for them correctly.
894 TEST_F(SearchProviderTest, KeywordOrderingAndDescriptions) { 894 TEST_F(SearchProviderTest, KeywordOrderingAndDescriptions) {
895 // Add an entry that corresponds to a keyword search with 'term2'. 895 // Add an entry that corresponds to a keyword search with 'term2'.
896 AddSearchToHistory(keyword_t_url_, ASCIIToUTF16("term2"), 1); 896 AddSearchToHistory(keyword_t_url_, ASCIIToUTF16("term2"), 1);
897 profile_.BlockUntilHistoryProcessesPendingRequests(); 897 profile_.BlockUntilHistoryProcessesPendingRequests();
898 898
899 AutocompleteController controller(&profile_, 899 AutocompleteController controller(&profile_, NULL,
900 TemplateURLServiceFactory::GetForProfile(&profile_), 900 AutocompleteProvider::TYPE_SEARCH);
901 NULL, AutocompleteProvider::TYPE_SEARCH);
902 controller.Start(AutocompleteInput( 901 controller.Start(AutocompleteInput(
903 ASCIIToUTF16("k t"), base::string16::npos, base::string16(), GURL(), 902 ASCIIToUTF16("k t"), base::string16::npos, base::string16(), GURL(),
904 metrics::OmniboxEventProto::INVALID_SPEC, false, false, true, true, 903 metrics::OmniboxEventProto::INVALID_SPEC, false, false, true, true,
905 ChromeAutocompleteSchemeClassifier(&profile_))); 904 ChromeAutocompleteSchemeClassifier(&profile_)));
906 const AutocompleteResult& result = controller.result(); 905 const AutocompleteResult& result = controller.result();
907 906
908 // There should be three matches, one for the keyword history, one for 907 // There should be three matches, one for the keyword history, one for
909 // keyword provider's what-you-typed, and one for the default provider's 908 // keyword provider's what-you-typed, and one for the default provider's
910 // what you typed, in that order. 909 // what you typed, in that order.
911 ASSERT_EQ(3u, result.size()); 910 ASSERT_EQ(3u, result.size());
(...skipping 2284 matching lines...) Expand 10 before | Expand all | Expand 10 after
3196 3195
3197 // The expiration time is always updated. 3196 // The expiration time is always updated.
3198 provider_->GetSessionToken(); 3197 provider_->GetSessionToken();
3199 base::TimeTicks expiration_time_1 = provider_->token_expiration_time_; 3198 base::TimeTicks expiration_time_1 = provider_->token_expiration_time_;
3200 base::PlatformThread::Sleep(kSmallDelta); 3199 base::PlatformThread::Sleep(kSmallDelta);
3201 provider_->GetSessionToken(); 3200 provider_->GetSessionToken();
3202 base::TimeTicks expiration_time_2 = provider_->token_expiration_time_; 3201 base::TimeTicks expiration_time_2 = provider_->token_expiration_time_;
3203 EXPECT_GT(expiration_time_2, expiration_time_1); 3202 EXPECT_GT(expiration_time_2, expiration_time_1);
3204 EXPECT_GE(expiration_time_2, expiration_time_1 + kSmallDelta); 3203 EXPECT_GE(expiration_time_2, expiration_time_1 + kSmallDelta);
3205 } 3204 }
OLDNEW
« no previous file with comments | « chrome/browser/autocomplete/history_url_provider_unittest.cc ('k') | chrome/browser/autocomplete/shortcuts_backend.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698