OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 <stdint.h> | 5 #include <stdint.h> |
6 #include <utility> | 6 #include <utility> |
7 | 7 |
8 #include "base/files/file_util.h" | 8 #include "base/files/file_util.h" |
9 #include "base/files/scoped_temp_dir.h" | 9 #include "base/files/scoped_temp_dir.h" |
10 #include "base/macros.h" | 10 #include "base/macros.h" |
(...skipping 26 matching lines...) Expand all Loading... |
37 const Origin kSessionOnlyOrigin; | 37 const Origin kSessionOnlyOrigin; |
38 | 38 |
39 IndexedDBTest() | 39 IndexedDBTest() |
40 : kNormalOrigin(GURL("http://normal/")), | 40 : kNormalOrigin(GURL("http://normal/")), |
41 kSessionOnlyOrigin(GURL("http://session-only/")), | 41 kSessionOnlyOrigin(GURL("http://session-only/")), |
42 task_runner_(new base::TestSimpleTaskRunner), | 42 task_runner_(new base::TestSimpleTaskRunner), |
43 special_storage_policy_(new MockSpecialStoragePolicy), | 43 special_storage_policy_(new MockSpecialStoragePolicy), |
44 quota_manager_proxy_(new MockQuotaManagerProxy(nullptr, nullptr)), | 44 quota_manager_proxy_(new MockQuotaManagerProxy(nullptr, nullptr)), |
45 file_thread_(BrowserThread::FILE_USER_BLOCKING, &message_loop_), | 45 file_thread_(BrowserThread::FILE_USER_BLOCKING, &message_loop_), |
46 io_thread_(BrowserThread::IO, &message_loop_) { | 46 io_thread_(BrowserThread::IO, &message_loop_) { |
47 special_storage_policy_->AddSessionOnly( | 47 special_storage_policy_->AddSessionOnly(kSessionOnlyOrigin.GetURL()); |
48 GURL(kSessionOnlyOrigin.Serialize())); | |
49 } | 48 } |
50 ~IndexedDBTest() override { | 49 ~IndexedDBTest() override { |
51 quota_manager_proxy_->SimulateQuotaManagerDestroyed(); | 50 quota_manager_proxy_->SimulateQuotaManagerDestroyed(); |
52 } | 51 } |
53 | 52 |
54 protected: | 53 protected: |
55 void FlushIndexedDBTaskRunner() { task_runner_->RunUntilIdle(); } | 54 void FlushIndexedDBTaskRunner() { task_runner_->RunUntilIdle(); } |
56 | 55 |
57 base::MessageLoopForIO message_loop_; | 56 base::MessageLoopForIO message_loop_; |
58 scoped_refptr<base::TestSimpleTaskRunner> task_runner_; | 57 scoped_refptr<base::TestSimpleTaskRunner> task_runner_; |
(...skipping 226 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
285 | 284 |
286 // Simulate the write failure. | 285 // Simulate the write failure. |
287 leveldb::Status status = leveldb::Status::IOError("Simulated failure"); | 286 leveldb::Status status = leveldb::Status::IOError("Simulated failure"); |
288 callbacks->connection()->database()->TransactionCommitFailed(status); | 287 callbacks->connection()->database()->TransactionCommitFailed(status); |
289 | 288 |
290 EXPECT_TRUE(db_callbacks->forced_close_called()); | 289 EXPECT_TRUE(db_callbacks->forced_close_called()); |
291 EXPECT_FALSE(factory->IsBackingStoreOpen(kTestOrigin)); | 290 EXPECT_FALSE(factory->IsBackingStoreOpen(kTestOrigin)); |
292 } | 291 } |
293 | 292 |
294 } // namespace content | 293 } // namespace content |
OLD | NEW |