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 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
55 }; | 55 }; |
56 | 56 |
57 class ResourcePrefetchPredictorTablesReopenTest | 57 class ResourcePrefetchPredictorTablesReopenTest |
58 : public ResourcePrefetchPredictorTablesTest { | 58 : public ResourcePrefetchPredictorTablesTest { |
59 public: | 59 public: |
60 virtual void SetUp() OVERRIDE { | 60 virtual void SetUp() OVERRIDE { |
61 // Write data to the table, and then reopen the db. | 61 // Write data to the table, and then reopen the db. |
62 ResourcePrefetchPredictorTablesTest::SetUp(); | 62 ResourcePrefetchPredictorTablesTest::SetUp(); |
63 tables_ = NULL; | 63 tables_ = NULL; |
64 db_.reset(new PredictorDatabase(&profile_)); | 64 db_.reset(new PredictorDatabase(&profile_)); |
65 loop_.RunAllPending(); | 65 loop_.RunUntilIdle(); |
66 tables_ = db_->resource_prefetch_tables(); | 66 tables_ = db_->resource_prefetch_tables(); |
67 } | 67 } |
68 }; | 68 }; |
69 | 69 |
70 ResourcePrefetchPredictorTablesTest::ResourcePrefetchPredictorTablesTest() | 70 ResourcePrefetchPredictorTablesTest::ResourcePrefetchPredictorTablesTest() |
71 : loop_(MessageLoop::TYPE_DEFAULT), | 71 : loop_(MessageLoop::TYPE_DEFAULT), |
72 db_thread_(content::BrowserThread::DB, &loop_), | 72 db_thread_(content::BrowserThread::DB, &loop_), |
73 db_(new PredictorDatabase(&profile_)), | 73 db_(new PredictorDatabase(&profile_)), |
74 tables_(db_->resource_prefetch_tables()) { | 74 tables_(db_->resource_prefetch_tables()) { |
75 loop_.RunAllPending(); | 75 loop_.RunUntilIdle(); |
76 } | 76 } |
77 | 77 |
78 ResourcePrefetchPredictorTablesTest::~ResourcePrefetchPredictorTablesTest() { | 78 ResourcePrefetchPredictorTablesTest::~ResourcePrefetchPredictorTablesTest() { |
79 } | 79 } |
80 | 80 |
81 void ResourcePrefetchPredictorTablesTest::SetUp() { | 81 void ResourcePrefetchPredictorTablesTest::SetUp() { |
82 tables_->DeleteAllUrlData(); | 82 tables_->DeleteAllUrlData(); |
83 InitializeSampleUrlData(); | 83 InitializeSampleUrlData(); |
84 } | 84 } |
85 | 85 |
(...skipping 199 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
285 | 285 |
286 TEST_F(ResourcePrefetchPredictorTablesReopenTest, DeleteDataForUrls) { | 286 TEST_F(ResourcePrefetchPredictorTablesReopenTest, DeleteDataForUrls) { |
287 TestDeleteDataForUrls(); | 287 TestDeleteDataForUrls(); |
288 } | 288 } |
289 | 289 |
290 TEST_F(ResourcePrefetchPredictorTablesReopenTest, DeleteAllUrlData) { | 290 TEST_F(ResourcePrefetchPredictorTablesReopenTest, DeleteAllUrlData) { |
291 TestDeleteAllUrlData(); | 291 TestDeleteAllUrlData(); |
292 } | 292 } |
293 | 293 |
294 } // namespace predictors | 294 } // namespace predictors |
OLD | NEW |