OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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/history_quick_provider.h" | 5 #include "chrome/browser/autocomplete/history_quick_provider.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 #include <functional> | 8 #include <functional> |
9 #include <set> | 9 #include <set> |
10 #include <string> | 10 #include <string> |
(...skipping 10 matching lines...) Expand all Loading... |
21 #include "chrome/browser/prefs/pref_service.h" | 21 #include "chrome/browser/prefs/pref_service.h" |
22 #include "chrome/common/pref_names.h" | 22 #include "chrome/common/pref_names.h" |
23 #include "chrome/test/base/testing_browser_process.h" | 23 #include "chrome/test/base/testing_browser_process.h" |
24 #include "chrome/test/base/testing_profile.h" | 24 #include "chrome/test/base/testing_profile.h" |
25 #include "content/test/test_browser_thread.h" | 25 #include "content/test/test_browser_thread.h" |
26 #include "testing/gtest/include/gtest/gtest.h" | 26 #include "testing/gtest/include/gtest/gtest.h" |
27 | 27 |
28 using base::Time; | 28 using base::Time; |
29 using base::TimeDelta; | 29 using base::TimeDelta; |
30 | 30 |
| 31 using content::BrowserThread; |
| 32 |
31 struct TestURLInfo { | 33 struct TestURLInfo { |
32 std::string url; | 34 std::string url; |
33 std::string title; | 35 std::string title; |
34 int visit_count; | 36 int visit_count; |
35 int typed_count; | 37 int typed_count; |
36 int days_from_now; | 38 int days_from_now; |
37 } quick_test_db[] = { | 39 } quick_test_db[] = { |
38 {"http://www.google.com/", "Google", 3, 3, 0}, | 40 {"http://www.google.com/", "Google", 3, 3, 0}, |
39 {"http://slashdot.org/favorite_page.html", "Favorite page", 200, 100, 0}, | 41 {"http://slashdot.org/favorite_page.html", "Favorite page", 200, 100, 0}, |
40 {"http://kerneltrap.org/not_very_popular.html", "Less popular", 4, 0, 0}, | 42 {"http://kerneltrap.org/not_very_popular.html", "Less popular", 4, 0, 0}, |
(...skipping 377 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
418 kMaxNonInliningScore - 1); | 420 kMaxNonInliningScore - 1); |
419 EXPECT_EQ(next_score, kMaxNonInliningScore - 2); | 421 EXPECT_EQ(next_score, kMaxNonInliningScore - 2); |
420 | 422 |
421 // Low score, can inline, not clamped. | 423 // Low score, can inline, not clamped. |
422 next_score = 1500; | 424 next_score = 1500; |
423 match.raw_score = 500; | 425 match.raw_score = 500; |
424 match.can_inline = true; | 426 match.can_inline = true; |
425 EXPECT_EQ(HistoryQuickProvider::CalculateRelevance(match, &next_score), 500); | 427 EXPECT_EQ(HistoryQuickProvider::CalculateRelevance(match, &next_score), 500); |
426 EXPECT_EQ(next_score, 499); | 428 EXPECT_EQ(next_score, 499); |
427 } | 429 } |
OLD | NEW |