| 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 } | 76 } |
| 77 | 77 |
| 78 AutocompleteActionPredictorTableTest::~AutocompleteActionPredictorTableTest() { | 78 AutocompleteActionPredictorTableTest::~AutocompleteActionPredictorTableTest() { |
| 79 } | 79 } |
| 80 | 80 |
| 81 void AutocompleteActionPredictorTableTest::SetUp() { | 81 void AutocompleteActionPredictorTableTest::SetUp() { |
| 82 db_.reset(new PredictorDatabase(&profile_)); | 82 db_.reset(new PredictorDatabase(&profile_)); |
| 83 loop_.RunUntilIdle(); | 83 loop_.RunUntilIdle(); |
| 84 | 84 |
| (...skipping 146 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 231 | 231 |
| 232 TEST_F(AutocompleteActionPredictorTableReopenTest, DeleteRows) { | 232 TEST_F(AutocompleteActionPredictorTableReopenTest, DeleteRows) { |
| 233 TestDeleteRows(); | 233 TestDeleteRows(); |
| 234 } | 234 } |
| 235 | 235 |
| 236 TEST_F(AutocompleteActionPredictorTableReopenTest, DeleteAllRows) { | 236 TEST_F(AutocompleteActionPredictorTableReopenTest, DeleteAllRows) { |
| 237 TestDeleteAllRows(); | 237 TestDeleteAllRows(); |
| 238 } | 238 } |
| 239 | 239 |
| 240 } // namespace predictors | 240 } // namespace predictors |
| OLD | NEW |