Chromium Code Reviews| 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 = WebKit::WebIDBCallbacks::None; |
| 339 scoped_refptr<IndexedDBBackingStore> backing_store = OpenBackingStore( | |
| 340 origin.databaseIdentifier(), data_directory, &data_loss); | |
| 341 EXPECT_FALSE(data_loss); | |
|
jsbell
2013/06/17 23:21:48
Should be: EXPECT_EQ(WebKit::WebIDBCallbacks::None
dgrogan
2013/06/17 23:52:40
Done.
| |
| 342 return backing_store; | |
| 339 } | 343 } |
| 340 | 344 |
| 341 private: | 345 private: |
| 342 virtual ~MockIDBFactory() {} | 346 virtual ~MockIDBFactory() {} |
| 343 }; | 347 }; |
| 344 | 348 |
| 345 TEST(IndexedDBFactoryTest, BackingStoreLifetime) { | 349 TEST(IndexedDBFactoryTest, BackingStoreLifetime) { |
| 346 WebSecurityOrigin origin1 = | 350 WebSecurityOrigin origin1 = |
| 347 WebSecurityOrigin::createFromString("http://localhost:81"); | 351 WebSecurityOrigin::createFromString("http://localhost:81"); |
| 348 WebSecurityOrigin origin2 = | 352 WebSecurityOrigin origin2 = |
| (...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 422 WebSecurityOrigin ok_origin = | 426 WebSecurityOrigin ok_origin = |
| 423 WebSecurityOrigin::createFromString("http://someorigin.com:82/"); | 427 WebSecurityOrigin::createFromString("http://someorigin.com:82/"); |
| 424 scoped_refptr<IndexedDBBackingStore> diskStore2 = | 428 scoped_refptr<IndexedDBBackingStore> diskStore2 = |
| 425 factory->TestOpenBackingStore(ok_origin, base_path); | 429 factory->TestOpenBackingStore(ok_origin, base_path); |
| 426 EXPECT_TRUE(diskStore2.get()); | 430 EXPECT_TRUE(diskStore2.get()); |
| 427 } | 431 } |
| 428 | 432 |
| 429 } // namespace | 433 } // namespace |
| 430 | 434 |
| 431 } // namespace content | 435 } // namespace content |
| OLD | NEW |