| 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 <vector> | 5 #include <vector> |
| 6 | 6 |
| 7 #include "base/message_loop.h" | 7 #include "base/message_loop.h" |
| 8 #include "base/time.h" | 8 #include "base/time.h" |
| 9 #include "base/utf_string_conversions.h" | 9 #include "base/utf_string_conversions.h" |
| 10 #include "chrome/browser/predictors/autocomplete_action_predictor_table.h" | 10 #include "chrome/browser/predictors/autocomplete_action_predictor_table.h" |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 47 void TestGetRow(); | 47 void TestGetRow(); |
| 48 void TestAddAndUpdateRows(); | 48 void TestAddAndUpdateRows(); |
| 49 void TestDeleteRows(); | 49 void TestDeleteRows(); |
| 50 void TestDeleteAllRows(); | 50 void TestDeleteAllRows(); |
| 51 | 51 |
| 52 AutocompleteActionPredictorTable::Rows test_db_; | 52 AutocompleteActionPredictorTable::Rows test_db_; |
| 53 | 53 |
| 54 private: | 54 private: |
| 55 TestingProfile profile_; | 55 TestingProfile profile_; |
| 56 scoped_ptr<PredictorDatabase> db_; | 56 scoped_ptr<PredictorDatabase> db_; |
| 57 MessageLoop loop_; | 57 base::MessageLoop loop_; |
| 58 content::TestBrowserThread db_thread_; | 58 content::TestBrowserThread db_thread_; |
| 59 }; | 59 }; |
| 60 | 60 |
| 61 class AutocompleteActionPredictorTableReopenTest | 61 class AutocompleteActionPredictorTableReopenTest |
| 62 : public AutocompleteActionPredictorTableTest { | 62 : public AutocompleteActionPredictorTableTest { |
| 63 public: | 63 public: |
| 64 virtual void SetUp() { | 64 virtual void SetUp() { |
| 65 // By calling SetUp twice, we make sure that the table already exists for | 65 // By calling SetUp twice, we make sure that the table already exists for |
| 66 // this fixture. | 66 // this fixture. |
| 67 AutocompleteActionPredictorTableTest::SetUp(); | 67 AutocompleteActionPredictorTableTest::SetUp(); |
| 68 AutocompleteActionPredictorTableTest::TearDown(); | 68 AutocompleteActionPredictorTableTest::TearDown(); |
| 69 AutocompleteActionPredictorTableTest::SetUp(); | 69 AutocompleteActionPredictorTableTest::SetUp(); |
| 70 } | 70 } |
| 71 }; | 71 }; |
| 72 | 72 |
| 73 AutocompleteActionPredictorTableTest::AutocompleteActionPredictorTableTest() | 73 AutocompleteActionPredictorTableTest::AutocompleteActionPredictorTableTest() |
| 74 : loop_(MessageLoop::TYPE_DEFAULT), | 74 : loop_(base::MessageLoop::TYPE_DEFAULT), |
| 75 db_thread_(BrowserThread::DB, &loop_) { | 75 db_thread_(BrowserThread::DB, &loop_) {} |
| 76 } | |
| 77 | 76 |
| 78 AutocompleteActionPredictorTableTest::~AutocompleteActionPredictorTableTest() { | 77 AutocompleteActionPredictorTableTest::~AutocompleteActionPredictorTableTest() { |
| 79 } | 78 } |
| 80 | 79 |
| 81 void AutocompleteActionPredictorTableTest::SetUp() { | 80 void AutocompleteActionPredictorTableTest::SetUp() { |
| 82 db_.reset(new PredictorDatabase(&profile_)); | 81 db_.reset(new PredictorDatabase(&profile_)); |
| 83 loop_.RunUntilIdle(); | 82 loop_.RunUntilIdle(); |
| 84 | 83 |
| 85 test_db_.push_back(AutocompleteActionPredictorTable::Row( | 84 test_db_.push_back(AutocompleteActionPredictorTable::Row( |
| 86 "BD85DBA2-8C29-49F9-84AE-48E1E90880DF", | 85 "BD85DBA2-8C29-49F9-84AE-48E1E90880DF", |
| (...skipping 144 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 231 | 230 |
| 232 TEST_F(AutocompleteActionPredictorTableReopenTest, DeleteRows) { | 231 TEST_F(AutocompleteActionPredictorTableReopenTest, DeleteRows) { |
| 233 TestDeleteRows(); | 232 TestDeleteRows(); |
| 234 } | 233 } |
| 235 | 234 |
| 236 TEST_F(AutocompleteActionPredictorTableReopenTest, DeleteAllRows) { | 235 TEST_F(AutocompleteActionPredictorTableReopenTest, DeleteAllRows) { |
| 237 TestDeleteAllRows(); | 236 TestDeleteAllRows(); |
| 238 } | 237 } |
| 239 | 238 |
| 240 } // namespace predictors | 239 } // namespace predictors |
| OLD | NEW |