OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 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 <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/logging.h" | 10 #include "base/logging.h" |
11 #include "base/macros.h" | 11 #include "base/macros.h" |
12 #include "base/memory/ptr_util.h" | 12 #include "base/memory/ptr_util.h" |
13 #include "base/run_loop.h" | 13 #include "base/run_loop.h" |
14 #include "base/strings/utf_string_conversions.h" | 14 #include "base/strings/utf_string_conversions.h" |
15 #include "base/test/test_simple_task_runner.h" | 15 #include "base/test/test_simple_task_runner.h" |
| 16 #include "base/threading/thread_task_runner_handle.h" |
16 #include "content/browser/indexed_db/indexed_db_connection.h" | 17 #include "content/browser/indexed_db/indexed_db_connection.h" |
17 #include "content/browser/indexed_db/indexed_db_context_impl.h" | 18 #include "content/browser/indexed_db/indexed_db_context_impl.h" |
18 #include "content/browser/indexed_db/indexed_db_factory_impl.h" | 19 #include "content/browser/indexed_db/indexed_db_factory_impl.h" |
19 #include "content/browser/indexed_db/mock_indexed_db_callbacks.h" | 20 #include "content/browser/indexed_db/mock_indexed_db_callbacks.h" |
20 #include "content/browser/indexed_db/mock_indexed_db_database_callbacks.h" | 21 #include "content/browser/indexed_db/mock_indexed_db_database_callbacks.h" |
21 #include "content/browser/quota/mock_quota_manager_proxy.h" | 22 #include "content/browser/quota/mock_quota_manager_proxy.h" |
22 #include "content/public/test/test_browser_thread_bundle.h" | 23 #include "content/public/test/test_browser_thread_bundle.h" |
23 #include "testing/gtest/include/gtest/gtest.h" | 24 #include "testing/gtest/include/gtest/gtest.h" |
24 #include "third_party/WebKit/public/platform/modules/indexeddb/WebIDBDatabaseExc
eption.h" | 25 #include "third_party/WebKit/public/platform/modules/indexeddb/WebIDBDatabaseExc
eption.h" |
25 #include "third_party/WebKit/public/platform/modules/indexeddb/WebIDBTypes.h" | 26 #include "third_party/WebKit/public/platform/modules/indexeddb/WebIDBTypes.h" |
(...skipping 195 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
221 *s = leveldb::Status::IOError("Disk is full"); | 222 *s = leveldb::Status::IOError("Disk is full"); |
222 return scoped_refptr<IndexedDBBackingStore>(); | 223 return scoped_refptr<IndexedDBBackingStore>(); |
223 } | 224 } |
224 | 225 |
225 DISALLOW_COPY_AND_ASSIGN(DiskFullFactory); | 226 DISALLOW_COPY_AND_ASSIGN(DiskFullFactory); |
226 }; | 227 }; |
227 | 228 |
228 class LookingForQuotaErrorMockCallbacks : public IndexedDBCallbacks { | 229 class LookingForQuotaErrorMockCallbacks : public IndexedDBCallbacks { |
229 public: | 230 public: |
230 LookingForQuotaErrorMockCallbacks() | 231 LookingForQuotaErrorMockCallbacks() |
231 : IndexedDBCallbacks(nullptr, url::Origin(), nullptr), | 232 : IndexedDBCallbacks(nullptr, |
| 233 url::Origin(), |
| 234 nullptr, |
| 235 base::ThreadTaskRunnerHandle::Get()), |
232 error_called_(false) {} | 236 error_called_(false) {} |
233 void OnError(const IndexedDBDatabaseError& error) override { | 237 void OnError(const IndexedDBDatabaseError& error) override { |
234 error_called_ = true; | 238 error_called_ = true; |
235 EXPECT_EQ(blink::kWebIDBDatabaseExceptionQuotaError, error.code()); | 239 EXPECT_EQ(blink::kWebIDBDatabaseExceptionQuotaError, error.code()); |
236 } | 240 } |
237 bool error_called() const { return error_called_; } | 241 bool error_called() const { return error_called_; } |
238 | 242 |
239 private: | 243 private: |
240 ~LookingForQuotaErrorMockCallbacks() override {} | 244 ~LookingForQuotaErrorMockCallbacks() override {} |
241 bool error_called_; | 245 bool error_called_; |
(...skipping 263 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
505 temp_directory.GetPath()); | 509 temp_directory.GetPath()); |
506 EXPECT_TRUE(callbacks->saw_error()); | 510 EXPECT_TRUE(callbacks->saw_error()); |
507 EXPECT_FALSE(factory()->IsDatabaseOpen(origin, db_name)); | 511 EXPECT_FALSE(factory()->IsDatabaseOpen(origin, db_name)); |
508 } | 512 } |
509 | 513 |
510 // Terminate all pending-close timers. | 514 // Terminate all pending-close timers. |
511 factory()->ForceClose(origin); | 515 factory()->ForceClose(origin); |
512 } | 516 } |
513 | 517 |
514 } // namespace content | 518 } // namespace content |
OLD | NEW |