| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 <map> | 5 #include <map> |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/file_util.h" | 8 #include "base/file_util.h" |
| 9 #include "base/files/file_path.h" | 9 #include "base/files/file_path.h" |
| 10 #include "base/files/scoped_temp_dir.h" | 10 #include "base/files/scoped_temp_dir.h" |
| (...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 128 weak_factory_.GetWeakPtr())); | 128 weak_factory_.GetWeakPtr())); |
| 129 FlushIndexedDBTaskRunner(); | 129 FlushIndexedDBTaskRunner(); |
| 130 base::MessageLoop::current()->RunUntilIdle(); | 130 base::MessageLoop::current()->RunUntilIdle(); |
| 131 return delete_status_; | 131 return delete_status_; |
| 132 } | 132 } |
| 133 | 133 |
| 134 IndexedDBContextImpl* idb_context() { return idb_context_; } | 134 IndexedDBContextImpl* idb_context() { return idb_context_; } |
| 135 | 135 |
| 136 void SetFileSizeTo(const base::FilePath& path, int size) { | 136 void SetFileSizeTo(const base::FilePath& path, int size) { |
| 137 std::string junk(size, 'a'); | 137 std::string junk(size, 'a'); |
| 138 ASSERT_EQ(size, file_util::WriteFile(path, junk.c_str(), size)); | 138 ASSERT_EQ(size, base::WriteFile(path, junk.c_str(), size)); |
| 139 } | 139 } |
| 140 | 140 |
| 141 void AddFakeIndexedDB(const GURL& origin, int size) { | 141 void AddFakeIndexedDB(const GURL& origin, int size) { |
| 142 base::FilePath file_path_origin = idb_context()->GetFilePathForTesting( | 142 base::FilePath file_path_origin = idb_context()->GetFilePathForTesting( |
| 143 webkit_database::GetIdentifierFromOrigin(origin)); | 143 webkit_database::GetIdentifierFromOrigin(origin)); |
| 144 if (!base::CreateDirectory(file_path_origin)) { | 144 if (!base::CreateDirectory(file_path_origin)) { |
| 145 LOG(ERROR) << "failed to base::CreateDirectory " | 145 LOG(ERROR) << "failed to base::CreateDirectory " |
| 146 << file_path_origin.value(); | 146 << file_path_origin.value(); |
| 147 } | 147 } |
| 148 file_path_origin = file_path_origin.Append(FILE_PATH_LITERAL("fake_file")); | 148 file_path_origin = file_path_origin.Append(FILE_PATH_LITERAL("fake_file")); |
| (...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 237 EXPECT_EQ(1000, GetOriginUsage(&client, kOriginA, kTemp)); | 237 EXPECT_EQ(1000, GetOriginUsage(&client, kOriginA, kTemp)); |
| 238 EXPECT_EQ(50, GetOriginUsage(&client, kOriginB, kTemp)); | 238 EXPECT_EQ(50, GetOriginUsage(&client, kOriginB, kTemp)); |
| 239 | 239 |
| 240 quota::QuotaStatusCode delete_status = DeleteOrigin(&client, kOriginA); | 240 quota::QuotaStatusCode delete_status = DeleteOrigin(&client, kOriginA); |
| 241 EXPECT_EQ(quota::kQuotaStatusOk, delete_status); | 241 EXPECT_EQ(quota::kQuotaStatusOk, delete_status); |
| 242 EXPECT_EQ(0, GetOriginUsage(&client, kOriginA, kTemp)); | 242 EXPECT_EQ(0, GetOriginUsage(&client, kOriginA, kTemp)); |
| 243 EXPECT_EQ(50, GetOriginUsage(&client, kOriginB, kTemp)); | 243 EXPECT_EQ(50, GetOriginUsage(&client, kOriginB, kTemp)); |
| 244 } | 244 } |
| 245 | 245 |
| 246 } // namespace content | 246 } // namespace content |
| OLD | NEW |