| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 <set> | 5 #include <set> |
| 6 #include <utility> | 6 #include <utility> |
| 7 #include <vector> | 7 #include <vector> |
| 8 | 8 |
| 9 #include "base/message_loop/message_loop.h" | 9 #include "base/message_loop/message_loop.h" |
| 10 #include "base/strings/utf_string_conversions.h" | 10 #include "base/strings/utf_string_conversions.h" |
| 11 #include "chrome/browser/predictors/predictor_database.h" | 11 #include "chrome/browser/predictors/predictor_database.h" |
| 12 #include "chrome/browser/predictors/resource_prefetch_predictor_tables.h" | 12 #include "chrome/browser/predictors/resource_prefetch_predictor_tables.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 #include "testing/gtest/include/gtest/gtest.h" | 16 #include "testing/gtest/include/gtest/gtest.h" |
| 17 | 17 |
| 18 namespace predictors { | 18 namespace predictors { |
| 19 | 19 |
| 20 class ResourcePrefetchPredictorTablesTest : public testing::Test { | 20 class ResourcePrefetchPredictorTablesTest : public testing::Test { |
| 21 public: | 21 public: |
| 22 ResourcePrefetchPredictorTablesTest(); | 22 ResourcePrefetchPredictorTablesTest(); |
| 23 virtual ~ResourcePrefetchPredictorTablesTest(); | 23 ~ResourcePrefetchPredictorTablesTest() override; |
| 24 virtual void SetUp() override; | 24 void SetUp() override; |
| 25 virtual void TearDown() override; | 25 void TearDown() override; |
| 26 | 26 |
| 27 protected: | 27 protected: |
| 28 void TestGetAllData(); | 28 void TestGetAllData(); |
| 29 void TestUpdateData(); | 29 void TestUpdateData(); |
| 30 void TestDeleteData(); | 30 void TestDeleteData(); |
| 31 void TestDeleteSingleDataPoint(); | 31 void TestDeleteSingleDataPoint(); |
| 32 void TestDeleteAllData(); | 32 void TestDeleteAllData(); |
| 33 | 33 |
| 34 base::MessageLoop loop_; | 34 base::MessageLoop loop_; |
| 35 content::TestBrowserThread db_thread_; | 35 content::TestBrowserThread db_thread_; |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 69 } | 69 } |
| 70 } | 70 } |
| 71 | 71 |
| 72 PrefetchDataMap test_url_data_; | 72 PrefetchDataMap test_url_data_; |
| 73 PrefetchDataMap test_host_data_; | 73 PrefetchDataMap test_host_data_; |
| 74 }; | 74 }; |
| 75 | 75 |
| 76 class ResourcePrefetchPredictorTablesReopenTest | 76 class ResourcePrefetchPredictorTablesReopenTest |
| 77 : public ResourcePrefetchPredictorTablesTest { | 77 : public ResourcePrefetchPredictorTablesTest { |
| 78 public: | 78 public: |
| 79 virtual void SetUp() override { | 79 void SetUp() override { |
| 80 // Write data to the table, and then reopen the db. | 80 // Write data to the table, and then reopen the db. |
| 81 ResourcePrefetchPredictorTablesTest::SetUp(); | 81 ResourcePrefetchPredictorTablesTest::SetUp(); |
| 82 ResourcePrefetchPredictorTablesTest::TearDown(); | 82 ResourcePrefetchPredictorTablesTest::TearDown(); |
| 83 | 83 |
| 84 db_.reset(new PredictorDatabase(&profile_)); | 84 db_.reset(new PredictorDatabase(&profile_)); |
| 85 loop_.RunUntilIdle(); | 85 loop_.RunUntilIdle(); |
| 86 tables_ = db_->resource_prefetch_tables(); | 86 tables_ = db_->resource_prefetch_tables(); |
| 87 } | 87 } |
| 88 }; | 88 }; |
| 89 | 89 |
| (...skipping 373 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 463 | 463 |
| 464 TEST_F(ResourcePrefetchPredictorTablesReopenTest, DeleteSingleDataPoint) { | 464 TEST_F(ResourcePrefetchPredictorTablesReopenTest, DeleteSingleDataPoint) { |
| 465 TestDeleteSingleDataPoint(); | 465 TestDeleteSingleDataPoint(); |
| 466 } | 466 } |
| 467 | 467 |
| 468 TEST_F(ResourcePrefetchPredictorTablesReopenTest, DeleteAllData) { | 468 TEST_F(ResourcePrefetchPredictorTablesReopenTest, DeleteAllData) { |
| 469 TestDeleteAllData(); | 469 TestDeleteAllData(); |
| 470 } | 470 } |
| 471 | 471 |
| 472 } // namespace predictors | 472 } // namespace predictors |
| OLD | NEW |