| 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 137 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 148 row.number_of_misses = test_row.number_of_misses; | 148 row.number_of_misses = test_row.number_of_misses; |
| 149 return row; | 149 return row; |
| 150 } | 150 } |
| 151 | 151 |
| 152 void AddAllRows() { | 152 void AddAllRows() { |
| 153 for (size_t i = 0; i < arraysize(test_url_db); ++i) | 153 for (size_t i = 0; i < arraysize(test_url_db); ++i) |
| 154 AddRow(test_url_db[i]); | 154 AddRow(test_url_db[i]); |
| 155 } | 155 } |
| 156 | 156 |
| 157 std::string AddRow(const TestUrlInfo& test_row) { | 157 std::string AddRow(const TestUrlInfo& test_row) { |
| 158 AutocompleteActionPredictor::DBCacheKey key = { test_row.user_text, | |
| 159 test_row.url }; | |
| 160 AutocompleteActionPredictorTable::Row row = | 158 AutocompleteActionPredictorTable::Row row = |
| 161 CreateRowFromTestUrlInfo(test_row); | 159 CreateRowFromTestUrlInfo(test_row); |
| 162 predictor_->AddAndUpdateRows( | 160 predictor_->AddAndUpdateRows( |
| 163 AutocompleteActionPredictorTable::Rows(1, row), | 161 AutocompleteActionPredictorTable::Rows(1, row), |
| 164 AutocompleteActionPredictorTable::Rows()); | 162 AutocompleteActionPredictorTable::Rows()); |
| 165 | 163 |
| 166 return row.id; | 164 return row.id; |
| 167 } | 165 } |
| 168 | 166 |
| 169 void UpdateRow(const AutocompleteActionPredictorTable::Row& row) { | 167 void UpdateRow(const AutocompleteActionPredictorTable::Row& row) { |
| (...skipping 200 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 370 AutocompleteActionPredictor::ACTION_PRERENDER) ? | 368 AutocompleteActionPredictor::ACTION_PRERENDER) ? |
| 371 AutocompleteActionPredictor::ACTION_PRECONNECT : | 369 AutocompleteActionPredictor::ACTION_PRECONNECT : |
| 372 test_url_db[i].expected_action; | 370 test_url_db[i].expected_action; |
| 373 EXPECT_EQ(expected_action, | 371 EXPECT_EQ(expected_action, |
| 374 predictor()->RecommendAction(test_url_db[i].user_text, match)) | 372 predictor()->RecommendAction(test_url_db[i].user_text, match)) |
| 375 << "Unexpected action for " << match.destination_url; | 373 << "Unexpected action for " << match.destination_url; |
| 376 } | 374 } |
| 377 } | 375 } |
| 378 | 376 |
| 379 } // namespace predictors | 377 } // namespace predictors |
| OLD | NEW |