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 <set> | 5 #include <set> |
6 #include <utility> | 6 #include <utility> |
7 #include <vector> | 7 #include <vector> |
8 | 8 |
9 #include "base/message_loop.h" | 9 #include "base/message_loop.h" |
10 #include "base/utf_string_conversions.h" | 10 #include "base/utf_string_conversions.h" |
(...skipping 13 matching lines...) Expand all Loading... |
24 virtual void SetUp() OVERRIDE; | 24 virtual void SetUp() OVERRIDE; |
25 virtual void TearDown() OVERRIDE; | 25 virtual 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 MessageLoop loop_; | 34 base::MessageLoop loop_; |
35 content::TestBrowserThread db_thread_; | 35 content::TestBrowserThread db_thread_; |
36 TestingProfile profile_; | 36 TestingProfile profile_; |
37 scoped_ptr<PredictorDatabase> db_; | 37 scoped_ptr<PredictorDatabase> db_; |
38 scoped_refptr<ResourcePrefetchPredictorTables> tables_; | 38 scoped_refptr<ResourcePrefetchPredictorTables> tables_; |
39 | 39 |
40 private: | 40 private: |
41 typedef ResourcePrefetchPredictorTables::ResourceRow ResourceRow; | 41 typedef ResourcePrefetchPredictorTables::ResourceRow ResourceRow; |
42 typedef std::vector<ResourceRow> ResourceRows; | 42 typedef std::vector<ResourceRow> ResourceRows; |
43 typedef ResourcePrefetchPredictorTables::PrefetchData PrefetchData; | 43 typedef ResourcePrefetchPredictorTables::PrefetchData PrefetchData; |
44 typedef ResourcePrefetchPredictorTables::PrefetchDataMap PrefetchDataMap; | 44 typedef ResourcePrefetchPredictorTables::PrefetchDataMap PrefetchDataMap; |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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 |
90 ResourcePrefetchPredictorTablesTest::ResourcePrefetchPredictorTablesTest() | 90 ResourcePrefetchPredictorTablesTest::ResourcePrefetchPredictorTablesTest() |
91 : loop_(MessageLoop::TYPE_DEFAULT), | 91 : loop_(base::MessageLoop::TYPE_DEFAULT), |
92 db_thread_(content::BrowserThread::DB, &loop_), | 92 db_thread_(content::BrowserThread::DB, &loop_), |
93 db_(new PredictorDatabase(&profile_)), | 93 db_(new PredictorDatabase(&profile_)), |
94 tables_(db_->resource_prefetch_tables()) { | 94 tables_(db_->resource_prefetch_tables()) { |
95 loop_.RunUntilIdle(); | 95 loop_.RunUntilIdle(); |
96 } | 96 } |
97 | 97 |
98 ResourcePrefetchPredictorTablesTest::~ResourcePrefetchPredictorTablesTest() { | 98 ResourcePrefetchPredictorTablesTest::~ResourcePrefetchPredictorTablesTest() { |
99 } | 99 } |
100 | 100 |
101 void ResourcePrefetchPredictorTablesTest::SetUp() { | 101 void ResourcePrefetchPredictorTablesTest::SetUp() { |
(...skipping 361 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 |