| 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 134 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 161 task_runner), | 162 task_runner), |
| 162 database_id_(0) {} | 163 database_id_(0) {} |
| 163 | 164 |
| 164 int64 database_id_; | 165 int64 database_id_; |
| 165 std::vector<Transaction::WriteDescriptor> writes_; | 166 std::vector<Transaction::WriteDescriptor> writes_; |
| 166 std::vector<int64> removals_; | 167 std::vector<int64> removals_; |
| 167 | 168 |
| 168 DISALLOW_COPY_AND_ASSIGN(TestableIndexedDBBackingStore); | 169 DISALLOW_COPY_AND_ASSIGN(TestableIndexedDBBackingStore); |
| 169 }; | 170 }; |
| 170 | 171 |
| 171 class TestIDBFactory : public IndexedDBFactory { | 172 class TestIDBFactory : public IndexedDBFactoryImpl { |
| 172 public: | 173 public: |
| 173 explicit TestIDBFactory(IndexedDBContextImpl* idb_context) | 174 explicit TestIDBFactory(IndexedDBContextImpl* idb_context) |
| 174 : IndexedDBFactory(idb_context) {} | 175 : IndexedDBFactoryImpl(idb_context) {} |
| 175 | 176 |
| 176 scoped_refptr<TestableIndexedDBBackingStore> OpenBackingStoreForTest( | 177 scoped_refptr<TestableIndexedDBBackingStore> OpenBackingStoreForTest( |
| 177 const GURL& origin, | 178 const GURL& origin, |
| 178 net::URLRequestContext* url_request_context) { | 179 net::URLRequestContext* url_request_context) { |
| 179 blink::WebIDBDataLoss data_loss; | 180 blink::WebIDBDataLoss data_loss; |
| 180 std::string data_loss_reason; | 181 std::string data_loss_reason; |
| 181 bool disk_full; | 182 bool disk_full; |
| 182 scoped_refptr<IndexedDBBackingStore> backing_store = | 183 scoped_refptr<IndexedDBBackingStore> backing_store = |
| 183 OpenBackingStore(origin, | 184 OpenBackingStore(origin, |
| 184 context()->data_path(), | 185 context()->data_path(), |
| (...skipping 768 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 953 EXPECT_EQ(index_name, index.name); | 954 EXPECT_EQ(index_name, index.name); |
| 954 EXPECT_EQ(index_key_path, index.key_path); | 955 EXPECT_EQ(index_key_path, index.key_path); |
| 955 EXPECT_EQ(unique, index.unique); | 956 EXPECT_EQ(unique, index.unique); |
| 956 EXPECT_EQ(multi_entry, index.multi_entry); | 957 EXPECT_EQ(multi_entry, index.multi_entry); |
| 957 } | 958 } |
| 958 } | 959 } |
| 959 | 960 |
| 960 } // namespace | 961 } // namespace |
| 961 | 962 |
| 962 } // namespace content | 963 } // namespace content |
| OLD | NEW |