| 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 <string> | 7 #include <string> |
| 8 | 8 |
| 9 #include "base/files/scoped_temp_dir.h" | 9 #include "base/files/scoped_temp_dir.h" |
| 10 #include "base/thread_task_runner_handle.h" | 10 #include "base/message_loop/message_loop.h" |
| 11 #include "storage/browser/fileapi/file_system_usage_cache.h" | 11 #include "storage/browser/fileapi/file_system_usage_cache.h" |
| 12 #include "storage/browser/fileapi/obfuscated_file_util.h" | 12 #include "storage/browser/fileapi/obfuscated_file_util.h" |
| 13 #include "storage/browser/quota/quota_manager_proxy.h" | 13 #include "storage/browser/quota/quota_manager_proxy.h" |
| 14 #include "testing/gtest/include/gtest/gtest.h" | 14 #include "testing/gtest/include/gtest/gtest.h" |
| 15 #include "third_party/leveldatabase/src/helpers/memenv/memenv.h" | 15 #include "third_party/leveldatabase/src/helpers/memenv/memenv.h" |
| 16 #include "third_party/leveldatabase/src/include/leveldb/env.h" | 16 #include "third_party/leveldatabase/src/include/leveldb/env.h" |
| 17 | 17 |
| 18 using storage::FileSystemUsageCache; | 18 using storage::FileSystemUsageCache; |
| 19 using storage::ObfuscatedFileUtil; | 19 using storage::ObfuscatedFileUtil; |
| 20 using storage::QuotaBackendImpl; | 20 using storage::QuotaBackendImpl; |
| (...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 122 base::File::Error error = base::File::FILE_ERROR_FAILED; | 122 base::File::Error error = base::File::FILE_ERROR_FAILED; |
| 123 base::FilePath path = file_util_->GetDirectoryForOriginAndType( | 123 base::FilePath path = file_util_->GetDirectoryForOriginAndType( |
| 124 origin, type_string, true /* create */, &error); | 124 origin, type_string, true /* create */, &error); |
| 125 ASSERT_EQ(base::File::FILE_OK, error); | 125 ASSERT_EQ(base::File::FILE_OK, error); |
| 126 | 126 |
| 127 ASSERT_TRUE(file_system_usage_cache_.UpdateUsage( | 127 ASSERT_TRUE(file_system_usage_cache_.UpdateUsage( |
| 128 GetUsageCachePath(origin, type), 0)); | 128 GetUsageCachePath(origin, type), 0)); |
| 129 } | 129 } |
| 130 | 130 |
| 131 base::SequencedTaskRunner* file_task_runner() { | 131 base::SequencedTaskRunner* file_task_runner() { |
| 132 return base::ThreadTaskRunnerHandle::Get().get(); | 132 return base::MessageLoopProxy::current().get(); |
| 133 } | 133 } |
| 134 | 134 |
| 135 base::FilePath GetUsageCachePath(const GURL& origin, | 135 base::FilePath GetUsageCachePath(const GURL& origin, |
| 136 storage::FileSystemType type) { | 136 storage::FileSystemType type) { |
| 137 base::FilePath path; | 137 base::FilePath path; |
| 138 base::File::Error error = | 138 base::File::Error error = |
| 139 backend_->GetUsageCachePath(origin, type, &path); | 139 backend_->GetUsageCachePath(origin, type, &path); |
| 140 EXPECT_EQ(base::File::FILE_OK, error); | 140 EXPECT_EQ(base::File::FILE_OK, error); |
| 141 EXPECT_FALSE(path.empty()); | 141 EXPECT_FALSE(path.empty()); |
| 142 return path; | 142 return path; |
| (...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 262 uint32 dirty = 0; | 262 uint32 dirty = 0; |
| 263 ASSERT_TRUE(file_system_usage_cache_.GetDirty(path, &dirty)); | 263 ASSERT_TRUE(file_system_usage_cache_.GetDirty(path, &dirty)); |
| 264 EXPECT_EQ(1u, dirty); | 264 EXPECT_EQ(1u, dirty); |
| 265 | 265 |
| 266 backend_->DecrementDirtyCount(GURL(kOrigin), type); | 266 backend_->DecrementDirtyCount(GURL(kOrigin), type); |
| 267 ASSERT_TRUE(file_system_usage_cache_.GetDirty(path, &dirty)); | 267 ASSERT_TRUE(file_system_usage_cache_.GetDirty(path, &dirty)); |
| 268 EXPECT_EQ(0u, dirty); | 268 EXPECT_EQ(0u, dirty); |
| 269 } | 269 } |
| 270 | 270 |
| 271 } // namespace content | 271 } // namespace content |
| OLD | NEW |