OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 "storage/browser/fileapi/quota/quota_backend_impl.h" | 5 #include "storage/browser/fileapi/quota/quota_backend_impl.h" |
6 | 6 |
7 #include <stdint.h> | 7 #include <stdint.h> |
8 | 8 |
9 #include <memory> | 9 #include <memory> |
10 #include <string> | 10 #include <string> |
11 | 11 |
12 #include "base/files/scoped_temp_dir.h" | 12 #include "base/files/scoped_temp_dir.h" |
13 #include "base/macros.h" | 13 #include "base/macros.h" |
| 14 #include "base/run_loop.h" |
14 #include "base/threading/thread_task_runner_handle.h" | 15 #include "base/threading/thread_task_runner_handle.h" |
15 #include "storage/browser/fileapi/file_system_usage_cache.h" | 16 #include "storage/browser/fileapi/file_system_usage_cache.h" |
16 #include "storage/browser/fileapi/obfuscated_file_util.h" | 17 #include "storage/browser/fileapi/obfuscated_file_util.h" |
17 #include "storage/browser/quota/quota_manager_proxy.h" | 18 #include "storage/browser/quota/quota_manager_proxy.h" |
18 #include "testing/gtest/include/gtest/gtest.h" | 19 #include "testing/gtest/include/gtest/gtest.h" |
19 #include "third_party/leveldatabase/src/helpers/memenv/memenv.h" | 20 #include "third_party/leveldatabase/src/helpers/memenv/memenv.h" |
20 #include "third_party/leveldatabase/src/include/leveldb/env.h" | 21 #include "third_party/leveldatabase/src/include/leveldb/env.h" |
21 | 22 |
22 using storage::FileSystemUsageCache; | 23 using storage::FileSystemUsageCache; |
23 using storage::ObfuscatedFileUtil; | 24 using storage::ObfuscatedFileUtil; |
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
105 backend_.reset(new QuotaBackendImpl(file_task_runner(), | 106 backend_.reset(new QuotaBackendImpl(file_task_runner(), |
106 file_util_.get(), | 107 file_util_.get(), |
107 &file_system_usage_cache_, | 108 &file_system_usage_cache_, |
108 quota_manager_proxy_.get())); | 109 quota_manager_proxy_.get())); |
109 } | 110 } |
110 | 111 |
111 void TearDown() override { | 112 void TearDown() override { |
112 backend_.reset(); | 113 backend_.reset(); |
113 quota_manager_proxy_ = NULL; | 114 quota_manager_proxy_ = NULL; |
114 file_util_.reset(); | 115 file_util_.reset(); |
115 message_loop_.RunUntilIdle(); | 116 base::RunLoop().RunUntilIdle(); |
116 } | 117 } |
117 | 118 |
118 protected: | 119 protected: |
119 void InitializeForOriginAndType(const GURL& origin, | 120 void InitializeForOriginAndType(const GURL& origin, |
120 storage::FileSystemType type) { | 121 storage::FileSystemType type) { |
121 ASSERT_TRUE(file_util_->InitOriginDatabase(origin, true /* create */)); | 122 ASSERT_TRUE(file_util_->InitOriginDatabase(origin, true /* create */)); |
122 ASSERT_TRUE(file_util_->origin_database_ != NULL); | 123 ASSERT_TRUE(file_util_->origin_database_ != NULL); |
123 | 124 |
124 std::string type_string = | 125 std::string type_string = |
125 SandboxFileSystemBackendDelegate::GetTypeString(type); | 126 SandboxFileSystemBackendDelegate::GetTypeString(type); |
(...skipping 140 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
266 uint32_t dirty = 0; | 267 uint32_t dirty = 0; |
267 ASSERT_TRUE(file_system_usage_cache_.GetDirty(path, &dirty)); | 268 ASSERT_TRUE(file_system_usage_cache_.GetDirty(path, &dirty)); |
268 EXPECT_EQ(1u, dirty); | 269 EXPECT_EQ(1u, dirty); |
269 | 270 |
270 backend_->DecrementDirtyCount(GURL(kOrigin), type); | 271 backend_->DecrementDirtyCount(GURL(kOrigin), type); |
271 ASSERT_TRUE(file_system_usage_cache_.GetDirty(path, &dirty)); | 272 ASSERT_TRUE(file_system_usage_cache_.GetDirty(path, &dirty)); |
272 EXPECT_EQ(0u, dirty); | 273 EXPECT_EQ(0u, dirty); |
273 } | 274 } |
274 | 275 |
275 } // namespace content | 276 } // namespace content |
OLD | NEW |