| 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 <stddef.h> | 7 #include <stddef.h> |
| 8 | 8 |
| 9 #include "base/auto_reset.h" | 9 #include "base/auto_reset.h" |
| 10 #include "base/command_line.h" | 10 #include "base/command_line.h" |
| (...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 108 predictor_->CreateLocalCachesFromDatabase(); | 108 predictor_->CreateLocalCachesFromDatabase(); |
| 109 ASSERT_TRUE(profile_->CreateHistoryService(true, false)); | 109 ASSERT_TRUE(profile_->CreateHistoryService(true, false)); |
| 110 profile_->BlockUntilHistoryProcessesPendingRequests(); | 110 profile_->BlockUntilHistoryProcessesPendingRequests(); |
| 111 | 111 |
| 112 ASSERT_TRUE(predictor_->initialized_); | 112 ASSERT_TRUE(predictor_->initialized_); |
| 113 ASSERT_TRUE(db_cache()->empty()); | 113 ASSERT_TRUE(db_cache()->empty()); |
| 114 ASSERT_TRUE(db_id_cache()->empty()); | 114 ASSERT_TRUE(db_id_cache()->empty()); |
| 115 } | 115 } |
| 116 | 116 |
| 117 void TearDown() override { | 117 void TearDown() override { |
| 118 predictor_->Shutdown(); |
| 118 profile_->DestroyHistoryService(); | 119 profile_->DestroyHistoryService(); |
| 119 predictor_->Shutdown(); | |
| 120 } | 120 } |
| 121 | 121 |
| 122 protected: | 122 protected: |
| 123 typedef AutocompleteActionPredictor::DBCacheKey DBCacheKey; | 123 typedef AutocompleteActionPredictor::DBCacheKey DBCacheKey; |
| 124 typedef AutocompleteActionPredictor::DBCacheValue DBCacheValue; | 124 typedef AutocompleteActionPredictor::DBCacheValue DBCacheValue; |
| 125 typedef AutocompleteActionPredictor::DBCacheMap DBCacheMap; | 125 typedef AutocompleteActionPredictor::DBCacheMap DBCacheMap; |
| 126 typedef AutocompleteActionPredictor::DBIdCacheMap DBIdCacheMap; | 126 typedef AutocompleteActionPredictor::DBIdCacheMap DBIdCacheMap; |
| 127 | 127 |
| 128 void AddAllRowsToHistory() { | 128 void AddAllRowsToHistory() { |
| 129 for (size_t i = 0; i < arraysize(test_url_db); ++i) | 129 for (size_t i = 0; i < arraysize(test_url_db); ++i) |
| (...skipping 250 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 380 AutocompleteActionPredictor::ACTION_PRERENDER) ? | 380 AutocompleteActionPredictor::ACTION_PRERENDER) ? |
| 381 AutocompleteActionPredictor::ACTION_PRECONNECT : | 381 AutocompleteActionPredictor::ACTION_PRECONNECT : |
| 382 test_url_db[i].expected_action; | 382 test_url_db[i].expected_action; |
| 383 EXPECT_EQ(expected_action, | 383 EXPECT_EQ(expected_action, |
| 384 predictor()->RecommendAction(test_url_db[i].user_text, match)) | 384 predictor()->RecommendAction(test_url_db[i].user_text, match)) |
| 385 << "Unexpected action for " << match.destination_url; | 385 << "Unexpected action for " << match.destination_url; |
| 386 } | 386 } |
| 387 } | 387 } |
| 388 | 388 |
| 389 } // namespace predictors | 389 } // namespace predictors |
| OLD | NEW |