| 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/message_loop.h" | 7 #include "base/message_loop/message_loop.h" |
| 8 #include "base/strings/utf_string_conversions.h" | 8 #include "base/strings/utf_string_conversions.h" |
| 9 #include "base/time/time.h" | 9 #include "base/time/time.h" |
| 10 #include "chrome/browser/predictors/autocomplete_action_predictor_table.h" | 10 #include "chrome/browser/predictors/autocomplete_action_predictor_table.h" |
| 11 #include "chrome/browser/predictors/predictor_database.h" | 11 #include "chrome/browser/predictors/predictor_database.h" |
| 12 #include "chrome/browser/predictors/predictor_database_factory.h" | 12 #include "chrome/browser/predictors/predictor_database_factory.h" |
| 13 #include "chrome/test/base/testing_profile.h" | 13 #include "chrome/test/base/testing_profile.h" |
| 14 #include "content/public/test/test_browser_thread.h" | 14 #include "content/public/test/test_browser_thread.h" |
| 15 #include "sql/statement.h" | 15 #include "sql/statement.h" |
| 16 | 16 |
| 17 #include "testing/gtest/include/gtest/gtest.h" | 17 #include "testing/gtest/include/gtest/gtest.h" |
| 18 | 18 |
| 19 using base::Time; | 19 using base::Time; |
| 20 using base::TimeDelta; | 20 using base::TimeDelta; |
| 21 using content::BrowserThread; | 21 using content::BrowserThread; |
| 22 using predictors::AutocompleteActionPredictorTable; | 22 using predictors::AutocompleteActionPredictorTable; |
| 23 | 23 |
| 24 namespace predictors { | 24 namespace predictors { |
| 25 | 25 |
| 26 class AutocompleteActionPredictorTableTest : public testing::Test { | 26 class AutocompleteActionPredictorTableTest : public testing::Test { |
| 27 public: | 27 public: |
| 28 AutocompleteActionPredictorTableTest(); | 28 AutocompleteActionPredictorTableTest(); |
| 29 virtual ~AutocompleteActionPredictorTableTest(); | 29 ~AutocompleteActionPredictorTableTest() override; |
| 30 | 30 |
| 31 virtual void SetUp(); | 31 void SetUp() override; |
| 32 virtual void TearDown(); | 32 void TearDown() override; |
| 33 | 33 |
| 34 size_t CountRecords() const; | 34 size_t CountRecords() const; |
| 35 | 35 |
| 36 void AddAll(); | 36 void AddAll(); |
| 37 | 37 |
| 38 bool RowsAreEqual(const AutocompleteActionPredictorTable::Row& lhs, | 38 bool RowsAreEqual(const AutocompleteActionPredictorTable::Row& lhs, |
| 39 const AutocompleteActionPredictorTable::Row& rhs) const; | 39 const AutocompleteActionPredictorTable::Row& rhs) const; |
| 40 | 40 |
| 41 TestingProfile* profile() { return &profile_; } | 41 TestingProfile* profile() { return &profile_; } |
| 42 | 42 |
| (...skipping 11 matching lines...) Expand all Loading... |
| 54 private: | 54 private: |
| 55 TestingProfile profile_; | 55 TestingProfile profile_; |
| 56 scoped_ptr<PredictorDatabase> db_; | 56 scoped_ptr<PredictorDatabase> db_; |
| 57 base::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 void SetUp() override { |
| 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 : db_thread_(BrowserThread::DB, &loop_) { | 74 : db_thread_(BrowserThread::DB, &loop_) { |
| (...skipping 155 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 230 | 230 |
| 231 TEST_F(AutocompleteActionPredictorTableReopenTest, DeleteRows) { | 231 TEST_F(AutocompleteActionPredictorTableReopenTest, DeleteRows) { |
| 232 TestDeleteRows(); | 232 TestDeleteRows(); |
| 233 } | 233 } |
| 234 | 234 |
| 235 TEST_F(AutocompleteActionPredictorTableReopenTest, DeleteAllRows) { | 235 TEST_F(AutocompleteActionPredictorTableReopenTest, DeleteAllRows) { |
| 236 TestDeleteAllRows(); | 236 TestDeleteAllRows(); |
| 237 } | 237 } |
| 238 | 238 |
| 239 } // namespace predictors | 239 } // namespace predictors |
| OLD | NEW |