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 "base/files/scoped_temp_dir.h" | 5 #include "base/files/scoped_temp_dir.h" |
6 #include "base/threading/platform_thread.h" | 6 #include "base/threading/platform_thread.h" |
7 #include "services/url_response_disk_cache/url_response_disk_cache_db.h" | 7 #include "services/url_response_disk_cache/url_response_disk_cache_db.h" |
8 #include "testing/gtest/include/gtest/gtest.h" | 8 #include "testing/gtest/include/gtest/gtest.h" |
9 | 9 |
10 namespace mojo { | 10 namespace mojo { |
(...skipping 11 matching lines...) Expand all Loading... |
22 db_ = nullptr; | 22 db_ = nullptr; |
23 base::FilePath db_path = tmp_dir_.path().Append("db"); | 23 base::FilePath db_path = tmp_dir_.path().Append("db"); |
24 db_ = new URLResponseDiskCacheDB(db_path); | 24 db_ = new URLResponseDiskCacheDB(db_path); |
25 } | 25 } |
26 | 26 |
27 CacheEntryPtr NewEntry() { | 27 CacheEntryPtr NewEntry() { |
28 CacheEntryPtr entry = CacheEntry::New(); | 28 CacheEntryPtr entry = CacheEntry::New(); |
29 entry->response = URLResponse::New(); | 29 entry->response = URLResponse::New(); |
30 entry->entry_directory = "/cache"; | 30 entry->entry_directory = "/cache"; |
31 entry->response_body_path = "/cache/content"; | 31 entry->response_body_path = "/cache/content"; |
32 return entry.Pass(); | 32 return entry; |
33 } | 33 } |
34 | 34 |
35 base::ScopedTempDir tmp_dir_; | 35 base::ScopedTempDir tmp_dir_; |
36 scoped_refptr<URLResponseDiskCacheDB> db_; | 36 scoped_refptr<URLResponseDiskCacheDB> db_; |
37 }; | 37 }; |
38 | 38 |
39 TEST_F(URLResponseDiskCacheDBTest, Create) {} | 39 TEST_F(URLResponseDiskCacheDBTest, Create) {} |
40 | 40 |
41 TEST_F(URLResponseDiskCacheDBTest, Version) { | 41 TEST_F(URLResponseDiskCacheDBTest, Version) { |
42 EXPECT_EQ(0lu, db_->GetVersion()); | 42 EXPECT_EQ(0lu, db_->GetVersion()); |
(...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
149 db_->PutNew(origin, url2, NewEntry()); | 149 db_->PutNew(origin, url2, NewEntry()); |
150 | 150 |
151 EXPECT_TRUE(iterator->HasNext()); | 151 EXPECT_TRUE(iterator->HasNext()); |
152 iterator->GetNext(nullptr, nullptr); | 152 iterator->GetNext(nullptr, nullptr); |
153 EXPECT_FALSE(iterator->HasNext()); | 153 EXPECT_FALSE(iterator->HasNext()); |
154 } | 154 } |
155 | 155 |
156 } // namespace | 156 } // namespace |
157 | 157 |
158 } // namespace mojo | 158 } // namespace mojo |
OLD | NEW |