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/file_util.h" | 7 #include "base/file_util.h" |
8 #include "base/files/scoped_temp_dir.h" | 8 #include "base/files/scoped_temp_dir.h" |
9 #include "base/logging.h" | 9 #include "base/logging.h" |
10 #include "base/strings/string16.h" | 10 #include "base/strings/string16.h" |
(...skipping 317 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
328 | 328 |
329 class MockIDBFactory : public IndexedDBFactory { | 329 class MockIDBFactory : public IndexedDBFactory { |
330 public: | 330 public: |
331 static scoped_refptr<MockIDBFactory> Create() { | 331 static scoped_refptr<MockIDBFactory> Create() { |
332 return make_scoped_refptr(new MockIDBFactory()); | 332 return make_scoped_refptr(new MockIDBFactory()); |
333 } | 333 } |
334 | 334 |
335 scoped_refptr<IndexedDBBackingStore> TestOpenBackingStore( | 335 scoped_refptr<IndexedDBBackingStore> TestOpenBackingStore( |
336 const WebSecurityOrigin& origin, | 336 const WebSecurityOrigin& origin, |
337 const base::FilePath& data_directory) { | 337 const base::FilePath& data_directory) { |
338 return OpenBackingStore(origin.databaseIdentifier(), data_directory); | 338 WebKit::WebIDBCallbacks::DataLoss data_loss = |
| 339 WebKit::WebIDBCallbacks::DataLossNone; |
| 340 scoped_refptr<IndexedDBBackingStore> backing_store = OpenBackingStore( |
| 341 origin.databaseIdentifier(), data_directory, &data_loss); |
| 342 EXPECT_EQ(WebKit::WebIDBCallbacks::DataLossNone, data_loss); |
| 343 return backing_store; |
339 } | 344 } |
340 | 345 |
341 private: | 346 private: |
342 virtual ~MockIDBFactory() {} | 347 virtual ~MockIDBFactory() {} |
343 }; | 348 }; |
344 | 349 |
345 TEST(IndexedDBFactoryTest, BackingStoreLifetime) { | 350 TEST(IndexedDBFactoryTest, BackingStoreLifetime) { |
346 WebSecurityOrigin origin1 = | 351 WebSecurityOrigin origin1 = |
347 WebSecurityOrigin::createFromString("http://localhost:81"); | 352 WebSecurityOrigin::createFromString("http://localhost:81"); |
348 WebSecurityOrigin origin2 = | 353 WebSecurityOrigin origin2 = |
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
422 WebSecurityOrigin ok_origin = | 427 WebSecurityOrigin ok_origin = |
423 WebSecurityOrigin::createFromString("http://someorigin.com:82/"); | 428 WebSecurityOrigin::createFromString("http://someorigin.com:82/"); |
424 scoped_refptr<IndexedDBBackingStore> diskStore2 = | 429 scoped_refptr<IndexedDBBackingStore> diskStore2 = |
425 factory->TestOpenBackingStore(ok_origin, base_path); | 430 factory->TestOpenBackingStore(ok_origin, base_path); |
426 EXPECT_TRUE(diskStore2.get()); | 431 EXPECT_TRUE(diskStore2.get()); |
427 } | 432 } |
428 | 433 |
429 } // namespace | 434 } // namespace |
430 | 435 |
431 } // namespace content | 436 } // namespace content |
OLD | NEW |