OLD | NEW |
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 215 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
226 | 226 |
227 // Shutdown the provider before the profile. | 227 // Shutdown the provider before the profile. |
228 provider_ = NULL; | 228 provider_ = NULL; |
229 } | 229 } |
230 | 230 |
231 GURL SearchProviderTest::AddSearchToHistory(TemplateURL* t_url, | 231 GURL SearchProviderTest::AddSearchToHistory(TemplateURL* t_url, |
232 string16 term, | 232 string16 term, |
233 int visit_count) { | 233 int visit_count) { |
234 HistoryService* history = | 234 HistoryService* history = |
235 HistoryServiceFactory::GetForProfile(&profile_, | 235 HistoryServiceFactory::GetForProfile(&profile_, |
236 Profile::EXPLICIT_ACCESS); | 236 Profile::EXPLICIT_ACCESS).get(); |
237 GURL search(t_url->url_ref().ReplaceSearchTerms( | 237 GURL search(t_url->url_ref().ReplaceSearchTerms( |
238 TemplateURLRef::SearchTermsArgs(term))); | 238 TemplateURLRef::SearchTermsArgs(term))); |
239 static base::Time last_added_time; | 239 static base::Time last_added_time; |
240 last_added_time = std::max(base::Time::Now(), | 240 last_added_time = std::max(base::Time::Now(), |
241 last_added_time + base::TimeDelta::FromMicroseconds(1)); | 241 last_added_time + base::TimeDelta::FromMicroseconds(1)); |
242 history->AddPageWithDetails(search, string16(), visit_count, visit_count, | 242 history->AddPageWithDetails(search, string16(), visit_count, visit_count, |
243 last_added_time, false, history::SOURCE_BROWSED); | 243 last_added_time, false, history::SOURCE_BROWSED); |
244 history->SetKeywordSearchTermsForURL(search, t_url->id(), term); | 244 history->SetKeywordSearchTermsForURL(search, t_url->id(), term); |
245 return search; | 245 return search; |
246 } | 246 } |
(...skipping 1006 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1253 EXPECT_EQ(AutocompleteMatch::ACMatchClassification::URL, | 1253 EXPECT_EQ(AutocompleteMatch::ACMatchClassification::URL, |
1254 match.contents_class[0].style); | 1254 match.contents_class[0].style); |
1255 EXPECT_EQ(4U, match.contents_class[1].offset); | 1255 EXPECT_EQ(4U, match.contents_class[1].offset); |
1256 EXPECT_EQ(AutocompleteMatch::ACMatchClassification::URL | | 1256 EXPECT_EQ(AutocompleteMatch::ACMatchClassification::URL | |
1257 AutocompleteMatch::ACMatchClassification::MATCH, | 1257 AutocompleteMatch::ACMatchClassification::MATCH, |
1258 match.contents_class[1].style); | 1258 match.contents_class[1].style); |
1259 EXPECT_EQ(5U, match.contents_class[2].offset); | 1259 EXPECT_EQ(5U, match.contents_class[2].offset); |
1260 EXPECT_EQ(AutocompleteMatch::ACMatchClassification::URL, | 1260 EXPECT_EQ(AutocompleteMatch::ACMatchClassification::URL, |
1261 match.contents_class[2].style); | 1261 match.contents_class[2].style); |
1262 } | 1262 } |
OLD | NEW |