| Index: content/browser/fileapi/file_system_quota_client_unittest.cc
|
| diff --git a/content/browser/fileapi/file_system_quota_client_unittest.cc b/content/browser/fileapi/file_system_quota_client_unittest.cc
|
| index b3333a0af1bf2dc867e3708d1d858b7ac0993e9f..e3a24c201512889be5121e4ef3ef4c0250691882 100644
|
| --- a/content/browser/fileapi/file_system_quota_client_unittest.cc
|
| +++ b/content/browser/fileapi/file_system_quota_client_unittest.cc
|
| @@ -2,10 +2,12 @@
|
| // Use of this source code is governed by a BSD-style license that can be
|
| // found in the LICENSE file.
|
|
|
| -#include "base/basictypes.h"
|
| +#include <stdint.h>
|
| +
|
| #include "base/bind.h"
|
| #include "base/files/file_util.h"
|
| #include "base/files/scoped_temp_dir.h"
|
| +#include "base/macros.h"
|
| #include "base/run_loop.h"
|
| #include "content/public/test/async_file_test_helper.h"
|
| #include "content/public/test/test_file_system_context.h"
|
| @@ -52,7 +54,7 @@ class FileSystemQuotaClientTest : public testing::Test {
|
| struct TestFile {
|
| bool isDirectory;
|
| const char* name;
|
| - int64 size;
|
| + int64_t size;
|
| const char* origin_url;
|
| storage::StorageType type;
|
| };
|
| @@ -71,9 +73,9 @@ class FileSystemQuotaClientTest : public testing::Test {
|
| weak_factory_.GetWeakPtr()));
|
| }
|
|
|
| - int64 GetOriginUsage(FileSystemQuotaClient* quota_client,
|
| - const std::string& origin_url,
|
| - storage::StorageType type) {
|
| + int64_t GetOriginUsage(FileSystemQuotaClient* quota_client,
|
| + const std::string& origin_url,
|
| + storage::StorageType type) {
|
| GetOriginUsageAsync(quota_client, origin_url, type);
|
| base::RunLoop().RunUntilIdle();
|
| return usage_;
|
| @@ -125,7 +127,7 @@ class FileSystemQuotaClientTest : public testing::Test {
|
| }
|
|
|
| bool CreateFileSystemFile(const base::FilePath& file_path,
|
| - int64 file_size,
|
| + int64_t file_size,
|
| const std::string& origin_url,
|
| storage::StorageType storage_type) {
|
| if (file_path.empty())
|
| @@ -174,11 +176,11 @@ class FileSystemQuotaClientTest : public testing::Test {
|
| // directory before adding a file or directory to it, so that we can just
|
| // count the basename of each addition. A recursive creation of a path, which
|
| // created more than one directory in a single shot, would break this.
|
| - int64 ComputeFilePathsCostForOriginAndType(const TestFile* files,
|
| - int num_files,
|
| - const std::string& origin_url,
|
| - storage::StorageType type) {
|
| - int64 file_paths_cost = 0;
|
| + int64_t ComputeFilePathsCostForOriginAndType(const TestFile* files,
|
| + int num_files,
|
| + const std::string& origin_url,
|
| + storage::StorageType type) {
|
| + int64_t file_paths_cost = 0;
|
| for (int i = 0; i < num_files; i++) {
|
| if (files[i].type == type &&
|
| GURL(files[i].origin_url) == GURL(origin_url)) {
|
| @@ -202,7 +204,7 @@ class FileSystemQuotaClientTest : public testing::Test {
|
| weak_factory_.GetWeakPtr()));
|
| }
|
|
|
| - int64 usage() const { return usage_; }
|
| + int64_t usage() const { return usage_; }
|
| storage::QuotaStatusCode status() { return deletion_status_; }
|
| int additional_callback_count() const { return additional_callback_count_; }
|
| void set_additional_callback_count(int count) {
|
| @@ -210,15 +212,13 @@ class FileSystemQuotaClientTest : public testing::Test {
|
| }
|
|
|
| private:
|
| - void OnGetUsage(int64 usage) {
|
| - usage_ = usage;
|
| - }
|
| + void OnGetUsage(int64_t usage) { usage_ = usage; }
|
|
|
| void OnGetOrigins(const std::set<GURL>& origins) {
|
| origins_ = origins;
|
| }
|
|
|
| - void OnGetAdditionalUsage(int64 usage_unused) {
|
| + void OnGetAdditionalUsage(int64_t usage_unused) {
|
| ++additional_callback_count_;
|
| }
|
|
|
| @@ -229,7 +229,7 @@ class FileSystemQuotaClientTest : public testing::Test {
|
| base::ScopedTempDir data_dir_;
|
| base::MessageLoop message_loop_;
|
| scoped_refptr<storage::FileSystemContext> file_system_context_;
|
| - int64 usage_;
|
| + int64_t usage_;
|
| int additional_callback_count_;
|
| std::set<GURL> origins_;
|
| storage::QuotaStatusCode deletion_status_;
|
| @@ -263,7 +263,7 @@ TEST_F(FileSystemQuotaClientTest, OneFileTest) {
|
| {false, "foo", 4921, kDummyURL1, kTemporary},
|
| };
|
| InitializeOriginFiles(quota_client.get(), kFiles, arraysize(kFiles));
|
| - const int64 file_paths_cost = ComputeFilePathsCostForOriginAndType(
|
| + const int64_t file_paths_cost = ComputeFilePathsCostForOriginAndType(
|
| kFiles, arraysize(kFiles), kDummyURL1, kTemporary);
|
|
|
| for (int i = 0; i < 2; i++) {
|
| @@ -280,7 +280,7 @@ TEST_F(FileSystemQuotaClientTest, TwoFilesTest) {
|
| {false, "bar", 41, kDummyURL1, kTemporary},
|
| };
|
| InitializeOriginFiles(quota_client.get(), kFiles, arraysize(kFiles));
|
| - const int64 file_paths_cost = ComputeFilePathsCostForOriginAndType(
|
| + const int64_t file_paths_cost = ComputeFilePathsCostForOriginAndType(
|
| kFiles, arraysize(kFiles), kDummyURL1, kTemporary);
|
|
|
| for (int i = 0; i < 2; i++) {
|
| @@ -298,7 +298,7 @@ TEST_F(FileSystemQuotaClientTest, EmptyFilesTest) {
|
| {false, "baz", 0, kDummyURL1, kTemporary},
|
| };
|
| InitializeOriginFiles(quota_client.get(), kFiles, arraysize(kFiles));
|
| - const int64 file_paths_cost = ComputeFilePathsCostForOriginAndType(
|
| + const int64_t file_paths_cost = ComputeFilePathsCostForOriginAndType(
|
| kFiles, arraysize(kFiles), kDummyURL1, kTemporary);
|
|
|
| for (int i = 0; i < 2; i++) {
|
| @@ -316,7 +316,7 @@ TEST_F(FileSystemQuotaClientTest, SubDirectoryTest) {
|
| {false, "bar", 4814, kDummyURL1, kTemporary},
|
| };
|
| InitializeOriginFiles(quota_client.get(), kFiles, arraysize(kFiles));
|
| - const int64 file_paths_cost = ComputeFilePathsCostForOriginAndType(
|
| + const int64_t file_paths_cost = ComputeFilePathsCostForOriginAndType(
|
| kFiles, arraysize(kFiles), kDummyURL1, kTemporary);
|
|
|
| for (int i = 0; i < 2; i++) {
|
| @@ -338,10 +338,12 @@ TEST_F(FileSystemQuotaClientTest, MultiTypeTest) {
|
| {false, "bar", 9, kDummyURL1, kPersistent},
|
| };
|
| InitializeOriginFiles(quota_client.get(), kFiles, arraysize(kFiles));
|
| - const int64 file_paths_cost_temporary = ComputeFilePathsCostForOriginAndType(
|
| - kFiles, arraysize(kFiles), kDummyURL1, kTemporary);
|
| - const int64 file_paths_cost_persistent = ComputeFilePathsCostForOriginAndType(
|
| - kFiles, arraysize(kFiles), kDummyURL1, kTemporary);
|
| + const int64_t file_paths_cost_temporary =
|
| + ComputeFilePathsCostForOriginAndType(kFiles, arraysize(kFiles),
|
| + kDummyURL1, kTemporary);
|
| + const int64_t file_paths_cost_persistent =
|
| + ComputeFilePathsCostForOriginAndType(kFiles, arraysize(kFiles),
|
| + kDummyURL1, kTemporary);
|
|
|
| for (int i = 0; i < 2; i++) {
|
| EXPECT_EQ(133 + 14 + file_paths_cost_temporary,
|
| @@ -372,16 +374,18 @@ TEST_F(FileSystemQuotaClientTest, MultiDomainTest) {
|
| {false, "baz", 18, kDummyURL2, kPersistent},
|
| };
|
| InitializeOriginFiles(quota_client.get(), kFiles, arraysize(kFiles));
|
| - const int64 file_paths_cost_temporary1 = ComputeFilePathsCostForOriginAndType(
|
| - kFiles, arraysize(kFiles), kDummyURL1, kTemporary);
|
| - const int64 file_paths_cost_persistent1 =
|
| + const int64_t file_paths_cost_temporary1 =
|
| + ComputeFilePathsCostForOriginAndType(kFiles, arraysize(kFiles),
|
| + kDummyURL1, kTemporary);
|
| + const int64_t file_paths_cost_persistent1 =
|
| + ComputeFilePathsCostForOriginAndType(kFiles, arraysize(kFiles),
|
| + kDummyURL1, kPersistent);
|
| + const int64_t file_paths_cost_temporary2 =
|
| ComputeFilePathsCostForOriginAndType(kFiles, arraysize(kFiles),
|
| - kDummyURL1, kPersistent);
|
| - const int64 file_paths_cost_temporary2 = ComputeFilePathsCostForOriginAndType(
|
| - kFiles, arraysize(kFiles), kDummyURL2, kTemporary);
|
| - const int64 file_paths_cost_persistent2 =
|
| + kDummyURL2, kTemporary);
|
| + const int64_t file_paths_cost_persistent2 =
|
| ComputeFilePathsCostForOriginAndType(kFiles, arraysize(kFiles),
|
| - kDummyURL2, kPersistent);
|
| + kDummyURL2, kPersistent);
|
|
|
| for (int i = 0; i < 2; i++) {
|
| EXPECT_EQ(1331 + 134 + file_paths_cost_temporary1,
|
| @@ -403,7 +407,7 @@ TEST_F(FileSystemQuotaClientTest, GetUsage_MultipleTasks) {
|
| {false, "bar", 22, kDummyURL1, kTemporary},
|
| };
|
| InitializeOriginFiles(quota_client.get(), kFiles, arraysize(kFiles));
|
| - const int64 file_paths_cost = ComputeFilePathsCostForOriginAndType(
|
| + const int64_t file_paths_cost = ComputeFilePathsCostForOriginAndType(
|
| kFiles, arraysize(kFiles), kDummyURL1, kTemporary);
|
|
|
| // Dispatching three GetUsage tasks.
|
| @@ -505,21 +509,21 @@ TEST_F(FileSystemQuotaClientTest, DeleteOriginTest) {
|
| {false, "g", 64, "https://bar.com/", kTemporary},
|
| };
|
| InitializeOriginFiles(quota_client.get(), kFiles, arraysize(kFiles));
|
| - const int64 file_paths_cost_temporary_foo_https =
|
| + const int64_t file_paths_cost_temporary_foo_https =
|
| ComputeFilePathsCostForOriginAndType(kFiles, arraysize(kFiles),
|
| - "https://foo.com/", kTemporary);
|
| - const int64 file_paths_cost_persistent_foo =
|
| + "https://foo.com/", kTemporary);
|
| + const int64_t file_paths_cost_persistent_foo =
|
| ComputeFilePathsCostForOriginAndType(kFiles, arraysize(kFiles),
|
| - "http://foo.com/", kPersistent);
|
| - const int64 file_paths_cost_temporary_bar =
|
| + "http://foo.com/", kPersistent);
|
| + const int64_t file_paths_cost_temporary_bar =
|
| ComputeFilePathsCostForOriginAndType(kFiles, arraysize(kFiles),
|
| - "http://bar.com/", kTemporary);
|
| - const int64 file_paths_cost_temporary_bar_https =
|
| + "http://bar.com/", kTemporary);
|
| + const int64_t file_paths_cost_temporary_bar_https =
|
| ComputeFilePathsCostForOriginAndType(kFiles, arraysize(kFiles),
|
| - "https://bar.com/", kTemporary);
|
| - const int64 file_paths_cost_persistent_bar_https =
|
| + "https://bar.com/", kTemporary);
|
| + const int64_t file_paths_cost_persistent_bar_https =
|
| ComputeFilePathsCostForOriginAndType(kFiles, arraysize(kFiles),
|
| - "https://bar.com/", kPersistent);
|
| + "https://bar.com/", kPersistent);
|
|
|
| DeleteOriginData(quota_client.get(), "http://foo.com/", kTemporary);
|
| base::RunLoop().RunUntilIdle();
|
|
|