Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(35)

Unified Diff: content/browser/fileapi/file_system_operation_impl_unittest.cc

Issue 1549113002: Switch to standard integer types in content/browser/. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase Created 5 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: content/browser/fileapi/file_system_operation_impl_unittest.cc
diff --git a/content/browser/fileapi/file_system_operation_impl_unittest.cc b/content/browser/fileapi/file_system_operation_impl_unittest.cc
index bb396243017b193c08ffab5771188964f0181af6..66891d1c22a19c5a3533f6f0a92842d44be2ebb6 100644
--- a/content/browser/fileapi/file_system_operation_impl_unittest.cc
+++ b/content/browser/fileapi/file_system_operation_impl_unittest.cc
@@ -4,10 +4,14 @@
#include "storage/browser/fileapi/file_system_operation_impl.h"
+#include <stddef.h>
+#include <stdint.h>
+
#include "base/bind.h"
#include "base/files/file_util.h"
#include "base/files/scoped_temp_dir.h"
#include "base/logging.h"
+#include "base/macros.h"
#include "base/memory/scoped_ptr.h"
#include "base/memory/weak_ptr.h"
#include "base/run_loop.h"
@@ -155,7 +159,7 @@ class FileSystemOperationImplTest
return url;
}
- int64 GetFileSize(const std::string& path) {
+ int64_t GetFileSize(const std::string& path) {
base::File::Info info;
EXPECT_TRUE(base::GetFileInfo(PlatformPath(path), &info));
return info.size;
@@ -238,12 +242,12 @@ class FileSystemOperationImplTest
closure.Run();
}
- int64 GetDataSizeOnDisk() {
+ int64_t GetDataSizeOnDisk() {
return sandbox_file_system_.ComputeCurrentOriginUsage() -
sandbox_file_system_.ComputeCurrentDirectoryDatabaseUsage();
}
- void GetUsageAndQuota(int64* usage, int64* quota) {
+ void GetUsageAndQuota(int64_t* usage, int64_t* quota) {
storage::QuotaStatusCode status =
AsyncFileTestHelper::GetUsageAndQuota(quota_manager_.get(),
sandbox_file_system_.origin(),
@@ -254,8 +258,8 @@ class FileSystemOperationImplTest
ASSERT_EQ(storage::kQuotaStatusOk, status);
}
- int64 ComputePathCost(const FileSystemURL& url) {
- int64 base_usage;
+ int64_t ComputePathCost(const FileSystemURL& url) {
+ int64_t base_usage;
GetUsageAndQuota(&base_usage, NULL);
AsyncFileTestHelper::CreateFile(
@@ -264,27 +268,27 @@ class FileSystemOperationImplTest
change_observer()->ResetCount();
- int64 total_usage;
+ int64_t total_usage;
GetUsageAndQuota(&total_usage, NULL);
return total_usage - base_usage;
}
void GrantQuotaForCurrentUsage() {
- int64 usage;
+ int64_t usage;
GetUsageAndQuota(&usage, NULL);
quota_manager()->SetQuota(sandbox_file_system_.origin(),
sandbox_file_system_.storage_type(),
usage);
}
- int64 GetUsage() {
- int64 usage = 0;
+ int64_t GetUsage() {
+ int64_t usage = 0;
GetUsageAndQuota(&usage, NULL);
return usage;
}
- void AddQuota(int64 quota_delta) {
- int64 quota;
+ void AddQuota(int64_t quota_delta) {
+ int64_t quota;
GetUsageAndQuota(NULL, &quota);
quota_manager()->SetQuota(sandbox_file_system_.origin(),
sandbox_file_system_.storage_type(),
@@ -707,7 +711,7 @@ TEST_F(FileSystemOperationImplTest, TestCopyFailureByQuota) {
EXPECT_EQ(6, GetFileSize("src/file"));
FileSystemURL dest_file(URLForPath("dest/file"));
- int64 dest_path_cost = ComputePathCost(dest_file);
+ int64_t dest_path_cost = ComputePathCost(dest_file);
GrantQuotaForCurrentUsage();
AddQuota(6 + dest_path_cost - 1);
@@ -823,7 +827,7 @@ TEST_F(FileSystemOperationImplTest, TestCopyInForeignFileSuccess) {
FileSystemURL dest_dir(CreateDirectory("dest"));
- int64 before_usage;
+ int64_t before_usage;
GetUsageAndQuota(&before_usage, NULL);
// Check that the file copied and corresponding usage increased.
@@ -833,7 +837,7 @@ TEST_F(FileSystemOperationImplTest, TestCopyInForeignFileSuccess) {
EXPECT_EQ(1, change_observer()->create_file_count());
EXPECT_TRUE(FileExists("dest/file"));
- int64 after_usage;
+ int64_t after_usage;
GetUsageAndQuota(&after_usage, NULL);
EXPECT_GT(after_usage, before_usage);
@@ -1219,7 +1223,7 @@ TEST_F(FileSystemOperationImplTest,
EXPECT_EQ(base::File::FILE_OK, Truncate(grandchild_file1, 30));
EXPECT_EQ(base::File::FILE_OK, Truncate(grandchild_file2, 2));
- const int64 all_file_size = 5000 + 400 + 30 + 2;
+ const int64_t all_file_size = 5000 + 400 + 30 + 2;
EXPECT_EQ(all_file_size, GetDataSizeOnDisk());
EXPECT_EQ(all_file_size + total_path_cost, GetUsage());
@@ -1242,17 +1246,17 @@ TEST_F(FileSystemOperationImplTest,
FileSystemURL dest1(CreateDirectory("dest1"));
FileSystemURL dest2(CreateDirectory("dest2"));
- int64 usage = GetUsage();
+ int64_t usage = GetUsage();
FileSystemURL child_file1(CreateFile("src/file1"));
FileSystemURL child_file2(CreateFile("src/file2"));
FileSystemURL child_dir(CreateDirectory("src/dir"));
- int64 child_path_cost = GetUsage() - usage;
+ int64_t child_path_cost = GetUsage() - usage;
usage += child_path_cost;
FileSystemURL grandchild_file1(CreateFile("src/dir/file1"));
FileSystemURL grandchild_file2(CreateFile("src/dir/file2"));
- int64 total_path_cost = GetUsage();
- int64 grandchild_path_cost = total_path_cost - usage;
+ int64_t total_path_cost = GetUsage();
+ int64_t grandchild_path_cost = total_path_cost - usage;
EXPECT_EQ(0, GetDataSizeOnDisk());
@@ -1261,10 +1265,10 @@ TEST_F(FileSystemOperationImplTest,
EXPECT_EQ(base::File::FILE_OK, Truncate(grandchild_file1, 60));
EXPECT_EQ(base::File::FILE_OK, Truncate(grandchild_file2, 5));
- const int64 child_file_size = 8000 + 700;
- const int64 grandchild_file_size = 60 + 5;
- const int64 all_file_size = child_file_size + grandchild_file_size;
- int64 expected_usage = all_file_size + total_path_cost;
+ const int64_t child_file_size = 8000 + 700;
+ const int64_t grandchild_file_size = 60 + 5;
+ const int64_t all_file_size = child_file_size + grandchild_file_size;
+ int64_t expected_usage = all_file_size + total_path_cost;
usage = GetUsage();
EXPECT_EQ(all_file_size, GetDataSizeOnDisk());

Powered by Google App Engine
This is Rietveld 408576698