OLD | NEW |
1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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/background/request_queue_store.h" | 5 #include "components/offline_pages/background/request_queue_store.h" |
6 | 6 |
7 #include <memory> | 7 #include <memory> |
8 | 8 |
9 #include "base/bind.h" | 9 #include "base/bind.h" |
10 #include "base/files/file_path.h" | 10 #include "base/files/file_path.h" |
(...skipping 177 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
188 public: | 188 public: |
189 std::unique_ptr<RequestQueueStore> BuildStore(); | 189 std::unique_ptr<RequestQueueStore> BuildStore(); |
190 | 190 |
191 protected: | 191 protected: |
192 T factory_; | 192 T factory_; |
193 }; | 193 }; |
194 | 194 |
195 template <typename T> | 195 template <typename T> |
196 std::unique_ptr<RequestQueueStore> RequestQueueStoreTest<T>::BuildStore() { | 196 std::unique_ptr<RequestQueueStore> RequestQueueStoreTest<T>::BuildStore() { |
197 std::unique_ptr<RequestQueueStore> store( | 197 std::unique_ptr<RequestQueueStore> store( |
198 factory_.BuildStore(temp_directory_.path())); | 198 factory_.BuildStore(temp_directory_.GetPath())); |
199 return store; | 199 return store; |
200 } | 200 } |
201 | 201 |
202 // |StoreTypes| lists all factories, based on which the tests will be created. | 202 // |StoreTypes| lists all factories, based on which the tests will be created. |
203 typedef testing::Types<RequestQueueInMemoryStoreFactory, | 203 typedef testing::Types<RequestQueueInMemoryStoreFactory, |
204 RequestQueueStoreSQLFactory> | 204 RequestQueueStoreSQLFactory> |
205 StoreTypes; | 205 StoreTypes; |
206 | 206 |
207 // This portion causes test fixtures to be defined. | 207 // This portion causes test fixtures to be defined. |
208 // Notice that in the store we are using "this->" to refer to the methods | 208 // Notice that in the store we are using "this->" to refer to the methods |
(...skipping 240 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
449 store->GetRequests(base::Bind(&RequestQueueStoreTestBase::GetRequestsDone, | 449 store->GetRequests(base::Bind(&RequestQueueStoreTestBase::GetRequestsDone, |
450 base::Unretained(this))); | 450 base::Unretained(this))); |
451 ASSERT_EQ(LastResult::kNone, this->last_result()); | 451 ASSERT_EQ(LastResult::kNone, this->last_result()); |
452 this->PumpLoop(); | 452 this->PumpLoop(); |
453 ASSERT_EQ(LastResult::kTrue, this->last_result()); | 453 ASSERT_EQ(LastResult::kTrue, this->last_result()); |
454 ASSERT_EQ(1ul, this->last_requests().size()); | 454 ASSERT_EQ(1ul, this->last_requests().size()); |
455 ASSERT_TRUE(original_request == *(this->last_requests().at(0).get())); | 455 ASSERT_TRUE(original_request == *(this->last_requests().at(0).get())); |
456 } | 456 } |
457 | 457 |
458 } // offline_pages | 458 } // offline_pages |
OLD | NEW |