| 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 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 87 db_thread_(BrowserThread::DB, &loop_), | 87 db_thread_(BrowserThread::DB, &loop_), |
| 88 file_thread_(BrowserThread::FILE, &loop_), | 88 file_thread_(BrowserThread::FILE, &loop_), |
| 89 predictor_(new AutocompleteActionPredictor(&profile_)) { | 89 predictor_(new AutocompleteActionPredictor(&profile_)) { |
| 90 } | 90 } |
| 91 | 91 |
| 92 void SetUp() { | 92 void SetUp() { |
| 93 CommandLine::ForCurrentProcess()->AppendSwitchASCII( | 93 CommandLine::ForCurrentProcess()->AppendSwitchASCII( |
| 94 switches::kPrerenderFromOmnibox, | 94 switches::kPrerenderFromOmnibox, |
| 95 switches::kPrerenderFromOmniboxSwitchValueEnabled); | 95 switches::kPrerenderFromOmniboxSwitchValueEnabled); |
| 96 | 96 |
| 97 predictor_->CreateLocalCachesFromDatabase(); |
| 97 profile_.CreateHistoryService(true, false); | 98 profile_.CreateHistoryService(true, false); |
| 98 profile_.BlockUntilHistoryProcessesPendingRequests(); | 99 profile_.BlockUntilHistoryProcessesPendingRequests(); |
| 99 | 100 |
| 100 ASSERT_TRUE(predictor_->initialized_); | 101 ASSERT_TRUE(predictor_->initialized_); |
| 101 ASSERT_TRUE(db_cache()->empty()); | 102 ASSERT_TRUE(db_cache()->empty()); |
| 102 ASSERT_TRUE(db_id_cache()->empty()); | 103 ASSERT_TRUE(db_id_cache()->empty()); |
| 103 } | 104 } |
| 104 | 105 |
| 105 void TearDown() { | 106 void TearDown() { |
| 106 profile_.DestroyHistoryService(); | 107 profile_.DestroyHistoryService(); |
| (...skipping 262 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 369 AutocompleteActionPredictor::ACTION_PRERENDER) ? | 370 AutocompleteActionPredictor::ACTION_PRERENDER) ? |
| 370 AutocompleteActionPredictor::ACTION_PRECONNECT : | 371 AutocompleteActionPredictor::ACTION_PRECONNECT : |
| 371 test_url_db[i].expected_action; | 372 test_url_db[i].expected_action; |
| 372 EXPECT_EQ(expected_action, | 373 EXPECT_EQ(expected_action, |
| 373 predictor()->RecommendAction(test_url_db[i].user_text, match)) | 374 predictor()->RecommendAction(test_url_db[i].user_text, match)) |
| 374 << "Unexpected action for " << match.destination_url; | 375 << "Unexpected action for " << match.destination_url; |
| 375 } | 376 } |
| 376 } | 377 } |
| 377 | 378 |
| 378 } // namespace predictors | 379 } // namespace predictors |
| OLD | NEW |