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/history_url_provider.h" | 5 #include "chrome/browser/autocomplete/history_url_provider.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 | 8 |
9 #include "base/message_loop/message_loop.h" | 9 #include "base/message_loop/message_loop.h" |
10 #include "base/path_service.h" | 10 #include "base/path_service.h" |
(...skipping 231 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
242 return true; | 242 return true; |
243 } | 243 } |
244 | 244 |
245 void HistoryURLProviderTest::TearDown() { | 245 void HistoryURLProviderTest::TearDown() { |
246 autocomplete_ = NULL; | 246 autocomplete_ = NULL; |
247 } | 247 } |
248 | 248 |
249 void HistoryURLProviderTest::FillData() { | 249 void HistoryURLProviderTest::FillData() { |
250 // Most visits are a long time ago (some tests require this since we do some | 250 // Most visits are a long time ago (some tests require this since we do some |
251 // special logic for things visited very recently). Note that this time must | 251 // special logic for things visited very recently). Note that this time must |
252 // be more recent than the "archived history" threshold for the data to go | 252 // be more recent than the "expire history" threshold for the data to be kept |
253 // into the main database. | 253 // in the main database. |
254 // | 254 // |
255 // TODO(brettw) It would be nice if we could test this behavior, in which | 255 // TODO(brettw) It would be nice if we could test this behavior, in which |
256 // case the time would be specifed in the test_db structure. | 256 // case the time would be specifed in the test_db structure. |
257 const Time now = Time::Now(); | 257 const Time now = Time::Now(); |
258 | 258 |
259 for (size_t i = 0; i < arraysize(test_db); ++i) { | 259 for (size_t i = 0; i < arraysize(test_db); ++i) { |
260 const TestURLInfo& cur = test_db[i]; | 260 const TestURLInfo& cur = test_db[i]; |
261 const GURL current_url(cur.url); | 261 const GURL current_url(cur.url); |
262 history_service_->AddPageWithDetails( | 262 history_service_->AddPageWithDetails( |
263 current_url, base::UTF8ToUTF16(cur.title), cur.visit_count, | 263 current_url, base::UTF8ToUTF16(cur.title), cur.visit_count, |
(...skipping 749 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1013 autocomplete_->scoring_params_.experimental_scoring_enabled = true; | 1013 autocomplete_->scoring_params_.experimental_scoring_enabled = true; |
1014 ASSERT_NO_FATAL_FAILURE( | 1014 ASSERT_NO_FATAL_FAILURE( |
1015 RunTest(ASCIIToUTF16(test_cases[i].input), | 1015 RunTest(ASCIIToUTF16(test_cases[i].input), |
1016 base::string16(), false, output, max_matches)); | 1016 base::string16(), false, output, max_matches)); |
1017 for (int j = 0; j < max_matches; ++j) { | 1017 for (int j = 0; j < max_matches; ++j) { |
1018 EXPECT_EQ(test_cases[i].matches[j].experiment_relevance, | 1018 EXPECT_EQ(test_cases[i].matches[j].experiment_relevance, |
1019 matches_[j].relevance); | 1019 matches_[j].relevance); |
1020 } | 1020 } |
1021 } | 1021 } |
1022 } | 1022 } |
OLD | NEW |