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/predictors/autocomplete_action_predictor.h" | 5 #include "chrome/browser/predictors/autocomplete_action_predictor.h" |
6 | 6 |
7 #include "base/auto_reset.h" | 7 #include "base/auto_reset.h" |
8 #include "base/command_line.h" | 8 #include "base/command_line.h" |
9 #include "base/guid.h" | 9 #include "base/guid.h" |
10 #include "base/memory/ref_counted.h" | 10 #include "base/memory/ref_counted.h" |
(...skipping 304 matching lines...) Loading... |
315 | 315 |
316 TEST_F(AutocompleteActionPredictorTest, DeleteOldIdsFromCaches) { | 316 TEST_F(AutocompleteActionPredictorTest, DeleteOldIdsFromCaches) { |
317 std::vector<AutocompleteActionPredictorTable::Row::Id> expected; | 317 std::vector<AutocompleteActionPredictorTable::Row::Id> expected; |
318 std::vector<AutocompleteActionPredictorTable::Row::Id> all_ids; | 318 std::vector<AutocompleteActionPredictorTable::Row::Id> all_ids; |
319 | 319 |
320 for (size_t i = 0; i < arraysize(test_url_db); ++i) { | 320 for (size_t i = 0; i < arraysize(test_url_db); ++i) { |
321 std::string row_id = AddRow(test_url_db[i]); | 321 std::string row_id = AddRow(test_url_db[i]); |
322 all_ids.push_back(row_id); | 322 all_ids.push_back(row_id); |
323 | 323 |
324 bool exclude_url = | 324 bool exclude_url = |
325 base::StartsWithASCII(test_url_db[i].url.path(), "/d", true) || | 325 base::StartsWith(test_url_db[i].url.path(), "/d", |
| 326 base::CompareCase::SENSITIVE) || |
326 (test_url_db[i].days_from_now > maximum_days_to_keep_entry()); | 327 (test_url_db[i].days_from_now > maximum_days_to_keep_entry()); |
327 | 328 |
328 if (exclude_url) | 329 if (exclude_url) |
329 expected.push_back(row_id); | 330 expected.push_back(row_id); |
330 else | 331 else |
331 ASSERT_TRUE(AddRowToHistory(test_url_db[i])); | 332 ASSERT_TRUE(AddRowToHistory(test_url_db[i])); |
332 } | 333 } |
333 | 334 |
334 std::vector<AutocompleteActionPredictorTable::Row::Id> id_list; | 335 std::vector<AutocompleteActionPredictorTable::Row::Id> id_list; |
335 DeleteOldIdsFromCaches(&id_list); | 336 DeleteOldIdsFromCaches(&id_list); |
(...skipping 39 matching lines...) Loading... |
375 AutocompleteActionPredictor::ACTION_PRERENDER) ? | 376 AutocompleteActionPredictor::ACTION_PRERENDER) ? |
376 AutocompleteActionPredictor::ACTION_PRECONNECT : | 377 AutocompleteActionPredictor::ACTION_PRECONNECT : |
377 test_url_db[i].expected_action; | 378 test_url_db[i].expected_action; |
378 EXPECT_EQ(expected_action, | 379 EXPECT_EQ(expected_action, |
379 predictor()->RecommendAction(test_url_db[i].user_text, match)) | 380 predictor()->RecommendAction(test_url_db[i].user_text, match)) |
380 << "Unexpected action for " << match.destination_url; | 381 << "Unexpected action for " << match.destination_url; |
381 } | 382 } |
382 } | 383 } |
383 | 384 |
384 } // namespace predictors | 385 } // namespace predictors |
OLD | NEW |