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 318 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 329 | 329 |
| 330 class MockIDBFactory : public IndexedDBFactory { | 330 class MockIDBFactory : public IndexedDBFactory { |
| 331 public: | 331 public: |
| 332 static scoped_refptr<MockIDBFactory> Create() { | 332 static scoped_refptr<MockIDBFactory> Create() { |
| 333 return make_scoped_refptr(new MockIDBFactory()); | 333 return make_scoped_refptr(new MockIDBFactory()); |
| 334 } | 334 } |
| 335 | 335 |
| 336 scoped_refptr<IndexedDBBackingStore> TestOpenBackingStore( | 336 scoped_refptr<IndexedDBBackingStore> TestOpenBackingStore( |
| 337 const WebSecurityOrigin& origin, | 337 const WebSecurityOrigin& origin, |
| 338 const base::FilePath& data_directory) { | 338 const base::FilePath& data_directory) { |
| 339 return OpenBackingStore(origin.databaseIdentifier(), data_directory); | 339 bool data_loss; |
| 340 return OpenBackingStore( | |
|
jsbell
2013/06/14 20:42:58
Add EXPECT_FALSE(data_loss) ?
dgrogan
2013/06/14 22:06:43
Done.
| |
| 341 origin.databaseIdentifier(), data_directory, &data_loss); | |
| 340 } | 342 } |
| 341 | 343 |
| 342 private: | 344 private: |
| 343 virtual ~MockIDBFactory() {} | 345 virtual ~MockIDBFactory() {} |
| 344 }; | 346 }; |
| 345 | 347 |
| 346 TEST(IndexedDBFactoryTest, BackingStoreLifetime) { | 348 TEST(IndexedDBFactoryTest, BackingStoreLifetime) { |
| 347 WebSecurityOrigin origin1 = | 349 WebSecurityOrigin origin1 = |
| 348 WebSecurityOrigin::createFromString("http://localhost:81"); | 350 WebSecurityOrigin::createFromString("http://localhost:81"); |
| 349 WebSecurityOrigin origin2 = | 351 WebSecurityOrigin origin2 = |
| (...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 423 WebSecurityOrigin ok_origin = | 425 WebSecurityOrigin ok_origin = |
| 424 WebSecurityOrigin::createFromString("http://someorigin.com:82/"); | 426 WebSecurityOrigin::createFromString("http://someorigin.com:82/"); |
| 425 scoped_refptr<IndexedDBBackingStore> diskStore2 = | 427 scoped_refptr<IndexedDBBackingStore> diskStore2 = |
| 426 factory->TestOpenBackingStore(ok_origin, base_path); | 428 factory->TestOpenBackingStore(ok_origin, base_path); |
| 427 EXPECT_TRUE(diskStore2.get()); | 429 EXPECT_TRUE(diskStore2.get()); |
| 428 } | 430 } |
| 429 | 431 |
| 430 } // namespace | 432 } // namespace |
| 431 | 433 |
| 432 } // namespace content | 434 } // namespace content |
| OLD | NEW |