| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 "components/offline_pages/offline_page_metadata_store_impl.h" | 5 #include "components/offline_pages/offline_page_metadata_store_impl.h" |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/files/file_path.h" | 8 #include "base/files/file_path.h" |
| 9 #include "base/files/scoped_temp_dir.h" | 9 #include "base/files/scoped_temp_dir.h" |
| 10 #include "base/memory/scoped_ptr.h" | 10 #include "base/memory/scoped_ptr.h" |
| (...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 65 OfflinePageMetadataStoreImplTest::~OfflinePageMetadataStoreImplTest() { | 65 OfflinePageMetadataStoreImplTest::~OfflinePageMetadataStoreImplTest() { |
| 66 } | 66 } |
| 67 | 67 |
| 68 void OfflinePageMetadataStoreImplTest::PumpLoop() { | 68 void OfflinePageMetadataStoreImplTest::PumpLoop() { |
| 69 run_loop_.reset(new base::RunLoop()); | 69 run_loop_.reset(new base::RunLoop()); |
| 70 run_loop_->Run(); | 70 run_loop_->Run(); |
| 71 } | 71 } |
| 72 | 72 |
| 73 scoped_ptr<OfflinePageMetadataStoreImpl> | 73 scoped_ptr<OfflinePageMetadataStoreImpl> |
| 74 OfflinePageMetadataStoreImplTest::BuildStore() { | 74 OfflinePageMetadataStoreImplTest::BuildStore() { |
| 75 scoped_ptr<ProtoDatabaseImpl<offline_pages::OfflinePageEntry>> db( | |
| 76 new ProtoDatabaseImpl<offline_pages::OfflinePageEntry>( | |
| 77 message_loop_.task_runner())); | |
| 78 return scoped_ptr<OfflinePageMetadataStoreImpl>( | 75 return scoped_ptr<OfflinePageMetadataStoreImpl>( |
| 79 new OfflinePageMetadataStoreImpl(db.Pass(), temp_directory_.path())); | 76 new OfflinePageMetadataStoreImpl(message_loop_.task_runner(), |
| 77 temp_directory_.path())); |
| 80 } | 78 } |
| 81 | 79 |
| 82 void OfflinePageMetadataStoreImplTest::LoadCallback( | 80 void OfflinePageMetadataStoreImplTest::LoadCallback( |
| 83 bool status, | 81 bool status, |
| 84 const std::vector<OfflinePageItem>& offline_pages) { | 82 const std::vector<OfflinePageItem>& offline_pages) { |
| 85 last_called_callback_ = LOAD; | 83 last_called_callback_ = LOAD; |
| 86 last_status_ = status ? STATUS_TRUE : STATUS_FALSE; | 84 last_status_ = status ? STATUS_TRUE : STATUS_FALSE; |
| 87 offline_pages_.swap(const_cast<std::vector<OfflinePageItem>&>(offline_pages)); | 85 offline_pages_.swap(const_cast<std::vector<OfflinePageItem>&>(offline_pages)); |
| 88 run_loop_->Quit(); | 86 run_loop_->Quit(); |
| 89 } | 87 } |
| (...skipping 277 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 367 EXPECT_EQ(offline_page.file_path, offline_pages_[0].file_path); | 365 EXPECT_EQ(offline_page.file_path, offline_pages_[0].file_path); |
| 368 EXPECT_EQ(offline_page.file_size, offline_pages_[0].file_size); | 366 EXPECT_EQ(offline_page.file_size, offline_pages_[0].file_size); |
| 369 EXPECT_EQ(offline_page.creation_time, offline_pages_[0].creation_time); | 367 EXPECT_EQ(offline_page.creation_time, offline_pages_[0].creation_time); |
| 370 EXPECT_EQ(offline_page.last_access_time, offline_pages_[0].last_access_time); | 368 EXPECT_EQ(offline_page.last_access_time, offline_pages_[0].last_access_time); |
| 371 EXPECT_EQ(offline_page.access_count, offline_pages_[0].access_count); | 369 EXPECT_EQ(offline_page.access_count, offline_pages_[0].access_count); |
| 372 } | 370 } |
| 373 | 371 |
| 374 } // namespace | 372 } // namespace |
| 375 | 373 |
| 376 } // namespace offline_pages | 374 } // namespace offline_pages |
| OLD | NEW |