Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(77)

Side by Side Diff: chrome/browser/predictors/autocomplete_action_predictor_unittest.cc

Issue 14113053: chrome: Use base::MessageLoop. (Part 3) (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase again Created 7 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 64 matching lines...) Expand 10 before | Expand all | Expand 10 after
75 AutocompleteActionPredictor::ACTION_NONE } 75 AutocompleteActionPredictor::ACTION_NONE }
76 }; 76 };
77 77
78 } // end namespace 78 } // end namespace
79 79
80 namespace predictors { 80 namespace predictors {
81 81
82 class AutocompleteActionPredictorTest : public testing::Test { 82 class AutocompleteActionPredictorTest : public testing::Test {
83 public: 83 public:
84 AutocompleteActionPredictorTest() 84 AutocompleteActionPredictorTest()
85 : loop_(MessageLoop::TYPE_DEFAULT), 85 : loop_(base::MessageLoop::TYPE_DEFAULT),
86 ui_thread_(BrowserThread::UI, &loop_), 86 ui_thread_(BrowserThread::UI, &loop_),
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 profile_(new TestingProfile()), 89 profile_(new TestingProfile()),
90 predictor_(new AutocompleteActionPredictor(profile_.get())) { 90 predictor_(new AutocompleteActionPredictor(profile_.get())) {
91 } 91 }
92 92
93 virtual ~AutocompleteActionPredictorTest() { 93 virtual ~AutocompleteActionPredictorTest() {
94 predictor_.reset(NULL); 94 predictor_.reset(NULL);
95 profile_.reset(NULL); 95 profile_.reset(NULL);
(...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after
207 AutocompleteActionPredictor* predictor() { return predictor_.get(); } 207 AutocompleteActionPredictor* predictor() { return predictor_.get(); }
208 208
209 DBCacheMap* db_cache() { return &predictor_->db_cache_; } 209 DBCacheMap* db_cache() { return &predictor_->db_cache_; }
210 DBIdCacheMap* db_id_cache() { return &predictor_->db_id_cache_; } 210 DBIdCacheMap* db_id_cache() { return &predictor_->db_id_cache_; }
211 211
212 static int maximum_days_to_keep_entry() { 212 static int maximum_days_to_keep_entry() {
213 return AutocompleteActionPredictor::kMaximumDaysToKeepEntry; 213 return AutocompleteActionPredictor::kMaximumDaysToKeepEntry;
214 } 214 }
215 215
216 private: 216 private:
217 MessageLoop loop_; 217 base::MessageLoop loop_;
218 content::TestBrowserThread ui_thread_; 218 content::TestBrowserThread ui_thread_;
219 content::TestBrowserThread db_thread_; 219 content::TestBrowserThread db_thread_;
220 content::TestBrowserThread file_thread_; 220 content::TestBrowserThread file_thread_;
221 scoped_ptr<TestingProfile> profile_; 221 scoped_ptr<TestingProfile> profile_;
222 scoped_ptr<AutocompleteActionPredictor> predictor_; 222 scoped_ptr<AutocompleteActionPredictor> predictor_;
223 }; 223 };
224 224
225 225
226 TEST_F(AutocompleteActionPredictorTest, AddRow) { 226 TEST_F(AutocompleteActionPredictorTest, AddRow) {
227 // Add a test entry to the predictor. 227 // Add a test entry to the predictor.
(...skipping 147 matching lines...) Expand 10 before | Expand all | Expand 10 after
375 AutocompleteActionPredictor::ACTION_PRERENDER) ? 375 AutocompleteActionPredictor::ACTION_PRERENDER) ?
376 AutocompleteActionPredictor::ACTION_PRECONNECT : 376 AutocompleteActionPredictor::ACTION_PRECONNECT :
377 test_url_db[i].expected_action; 377 test_url_db[i].expected_action;
378 EXPECT_EQ(expected_action, 378 EXPECT_EQ(expected_action,
379 predictor()->RecommendAction(test_url_db[i].user_text, match)) 379 predictor()->RecommendAction(test_url_db[i].user_text, match))
380 << "Unexpected action for " << match.destination_url; 380 << "Unexpected action for " << match.destination_url;
381 } 381 }
382 } 382 }
383 383
384 } // namespace predictors 384 } // namespace predictors
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698