| 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/network_action_predictor.h" | 5 #include "chrome/browser/autocomplete/network_action_predictor.h" |
| 6 | 6 |
| 7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
| 8 #include "base/memory/ref_counted.h" | 8 #include "base/memory/ref_counted.h" |
| 9 #include "base/message_loop.h" | 9 #include "base/message_loop.h" |
| 10 #include "base/string_util.h" | 10 #include "base/string_util.h" |
| (...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 97 profile_.CreateHistoryService(true, false); | 97 profile_.CreateHistoryService(true, false); |
| 98 profile_.BlockUntilHistoryProcessesPendingRequests(); | 98 profile_.BlockUntilHistoryProcessesPendingRequests(); |
| 99 | 99 |
| 100 ASSERT_TRUE(predictor_->initialized_); | 100 ASSERT_TRUE(predictor_->initialized_); |
| 101 ASSERT_TRUE(db_cache()->empty()); | 101 ASSERT_TRUE(db_cache()->empty()); |
| 102 ASSERT_TRUE(db_id_cache()->empty()); | 102 ASSERT_TRUE(db_id_cache()->empty()); |
| 103 } | 103 } |
| 104 | 104 |
| 105 void TearDown() { | 105 void TearDown() { |
| 106 profile_.DestroyHistoryService(); | 106 profile_.DestroyHistoryService(); |
| 107 predictor_->Shutdown(); |
| 107 } | 108 } |
| 108 | 109 |
| 109 protected: | 110 protected: |
| 110 typedef NetworkActionPredictor::DBCacheKey DBCacheKey; | 111 typedef NetworkActionPredictor::DBCacheKey DBCacheKey; |
| 111 typedef NetworkActionPredictor::DBCacheValue DBCacheValue; | 112 typedef NetworkActionPredictor::DBCacheValue DBCacheValue; |
| 112 typedef NetworkActionPredictor::DBCacheMap DBCacheMap; | 113 typedef NetworkActionPredictor::DBCacheMap DBCacheMap; |
| 113 typedef NetworkActionPredictor::DBIdCacheMap DBIdCacheMap; | 114 typedef NetworkActionPredictor::DBIdCacheMap DBIdCacheMap; |
| 114 | 115 |
| 115 void AddAllRowsToHistory() { | 116 void AddAllRowsToHistory() { |
| 116 for (size_t i = 0; i < arraysize(test_url_db); ++i) | 117 for (size_t i = 0; i < arraysize(test_url_db); ++i) |
| (...skipping 243 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 360 (test_url_db[i].expected_action == | 361 (test_url_db[i].expected_action == |
| 361 NetworkActionPredictor::ACTION_PRERENDER) ? | 362 NetworkActionPredictor::ACTION_PRERENDER) ? |
| 362 NetworkActionPredictor::ACTION_PRECONNECT : | 363 NetworkActionPredictor::ACTION_PRECONNECT : |
| 363 test_url_db[i].expected_action; | 364 test_url_db[i].expected_action; |
| 364 | 365 |
| 365 EXPECT_EQ(expected, | 366 EXPECT_EQ(expected, |
| 366 predictor()->RecommendAction(test_url_db[i].user_text, match)) | 367 predictor()->RecommendAction(test_url_db[i].user_text, match)) |
| 367 << "Unexpected action for " << match.destination_url; | 368 << "Unexpected action for " << match.destination_url; |
| 368 } | 369 } |
| 369 } | 370 } |
| OLD | NEW |