OLD | NEW |
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2013 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 "content/browser/indexed_db/indexed_db_backing_store.h" | 5 #include "content/browser/indexed_db/indexed_db_backing_store.h" |
6 | 6 |
7 #include "base/callback.h" | 7 #include "base/callback.h" |
8 #include "base/file_util.h" | 8 #include "base/file_util.h" |
9 #include "base/files/scoped_temp_dir.h" | 9 #include "base/files/scoped_temp_dir.h" |
10 #include "base/logging.h" | 10 #include "base/logging.h" |
11 #include "base/macros.h" | 11 #include "base/macros.h" |
12 #include "base/strings/string16.h" | 12 #include "base/strings/string16.h" |
13 #include "base/strings/utf_string_conversions.h" | 13 #include "base/strings/utf_string_conversions.h" |
14 #include "base/task_runner.h" | 14 #include "base/task_runner.h" |
15 #include "base/test/test_simple_task_runner.h" | 15 #include "base/test/test_simple_task_runner.h" |
16 #include "content/browser/indexed_db/indexed_db_context_impl.h" | 16 #include "content/browser/indexed_db/indexed_db_context_impl.h" |
| 17 #include "content/browser/indexed_db/indexed_db_factory_impl.h" |
17 #include "content/browser/indexed_db/indexed_db_leveldb_coding.h" | 18 #include "content/browser/indexed_db/indexed_db_leveldb_coding.h" |
18 #include "content/browser/indexed_db/indexed_db_value.h" | 19 #include "content/browser/indexed_db/indexed_db_value.h" |
19 #include "content/public/test/mock_special_storage_policy.h" | 20 #include "content/public/test/mock_special_storage_policy.h" |
20 #include "net/url_request/url_request_test_util.h" | 21 #include "net/url_request/url_request_test_util.h" |
21 #include "testing/gtest/include/gtest/gtest.h" | 22 #include "testing/gtest/include/gtest/gtest.h" |
22 #include "third_party/WebKit/public/platform/WebIDBTypes.h" | 23 #include "third_party/WebKit/public/platform/WebIDBTypes.h" |
23 #include "webkit/browser/blob/blob_data_handle.h" | 24 #include "webkit/browser/blob/blob_data_handle.h" |
24 #include "webkit/browser/quota/special_storage_policy.h" | 25 #include "webkit/browser/quota/special_storage_policy.h" |
25 | 26 |
26 using base::ASCIIToUTF16; | 27 using base::ASCIIToUTF16; |
(...skipping 138 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
165 task_runner), | 166 task_runner), |
166 database_id_(0) {} | 167 database_id_(0) {} |
167 | 168 |
168 int64 database_id_; | 169 int64 database_id_; |
169 std::vector<Transaction::WriteDescriptor> writes_; | 170 std::vector<Transaction::WriteDescriptor> writes_; |
170 std::vector<int64> removals_; | 171 std::vector<int64> removals_; |
171 | 172 |
172 DISALLOW_COPY_AND_ASSIGN(TestableIndexedDBBackingStore); | 173 DISALLOW_COPY_AND_ASSIGN(TestableIndexedDBBackingStore); |
173 }; | 174 }; |
174 | 175 |
175 class TestIDBFactory : public IndexedDBFactory { | 176 class TestIDBFactory : public IndexedDBFactoryImpl { |
176 public: | 177 public: |
177 explicit TestIDBFactory(IndexedDBContextImpl* idb_context) | 178 explicit TestIDBFactory(IndexedDBContextImpl* idb_context) |
178 : IndexedDBFactory(idb_context) {} | 179 : IndexedDBFactoryImpl(idb_context) {} |
179 | 180 |
180 scoped_refptr<TestableIndexedDBBackingStore> OpenBackingStoreForTest( | 181 scoped_refptr<TestableIndexedDBBackingStore> OpenBackingStoreForTest( |
181 const GURL& origin, | 182 const GURL& origin, |
182 net::URLRequestContext* url_request_context) { | 183 net::URLRequestContext* url_request_context) { |
183 blink::WebIDBDataLoss data_loss; | 184 blink::WebIDBDataLoss data_loss; |
184 std::string data_loss_reason; | 185 std::string data_loss_reason; |
185 bool disk_full; | 186 bool disk_full; |
186 leveldb::Status status; | 187 leveldb::Status status; |
187 scoped_refptr<IndexedDBBackingStore> backing_store = | 188 scoped_refptr<IndexedDBBackingStore> backing_store = |
188 OpenBackingStore(origin, | 189 OpenBackingStore(origin, |
(...skipping 772 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
961 EXPECT_EQ(index_name, index.name); | 962 EXPECT_EQ(index_name, index.name); |
962 EXPECT_EQ(index_key_path, index.key_path); | 963 EXPECT_EQ(index_key_path, index.key_path); |
963 EXPECT_EQ(unique, index.unique); | 964 EXPECT_EQ(unique, index.unique); |
964 EXPECT_EQ(multi_entry, index.multi_entry); | 965 EXPECT_EQ(multi_entry, index.multi_entry); |
965 } | 966 } |
966 } | 967 } |
967 | 968 |
968 } // namespace | 969 } // namespace |
969 | 970 |
970 } // namespace content | 971 } // namespace content |
OLD | NEW |