| Index: components/drive/drive_uploader_unittest.cc
|
| diff --git a/components/drive/drive_uploader_unittest.cc b/components/drive/drive_uploader_unittest.cc
|
| index 29fbf26acb1a00568227c60a11a28f2c3db8ea1f..9e02386f5fe5e11abf674abb328ee05357de92cc 100644
|
| --- a/components/drive/drive_uploader_unittest.cc
|
| +++ b/components/drive/drive_uploader_unittest.cc
|
| @@ -4,6 +4,9 @@
|
|
|
| #include "components/drive/drive_uploader.h"
|
|
|
| +#include <stddef.h>
|
| +#include <stdint.h>
|
| +
|
| #include <algorithm>
|
| #include <string>
|
| #include <vector>
|
| @@ -49,12 +52,12 @@ const char kTestMimeType[] = "text/plain";
|
| const char kTestUploadNewFileURL[] = "http://test/upload_location/new_file";
|
| const char kTestUploadExistingFileURL[] =
|
| "http://test/upload_location/existing_file";
|
| -const int64 kUploadChunkSize = 1024 * 1024 * 1024;
|
| +const int64_t kUploadChunkSize = 1024 * 1024 * 1024;
|
| const char kTestETag[] = "test_etag";
|
|
|
| CancelCallback SendMultipartUploadResult(
|
| DriveApiErrorCode response_code,
|
| - int64 content_length,
|
| + int64_t content_length,
|
| const google_apis::FileResourceCallback& callback,
|
| const google_apis::ProgressCallback& progress_callback) {
|
| // Callback progress
|
| @@ -84,20 +87,20 @@ class MockDriveServiceWithUploadExpectation : public DummyDriveService {
|
| // verify that the specified data is correctly uploaded.
|
| MockDriveServiceWithUploadExpectation(
|
| const base::FilePath& expected_upload_file,
|
| - int64 expected_content_length)
|
| + int64_t expected_content_length)
|
| : expected_upload_file_(expected_upload_file),
|
| expected_content_length_(expected_content_length),
|
| received_bytes_(0),
|
| resume_upload_call_count_(0),
|
| multipart_upload_call_count_(0) {}
|
|
|
| - int64 received_bytes() const { return received_bytes_; }
|
| - void set_received_bytes(int64 received_bytes) {
|
| + int64_t received_bytes() const { return received_bytes_; }
|
| + void set_received_bytes(int64_t received_bytes) {
|
| received_bytes_ = received_bytes;
|
| }
|
|
|
| - int64 resume_upload_call_count() const { return resume_upload_call_count_; }
|
| - int64 multipart_upload_call_count() const {
|
| + int64_t resume_upload_call_count() const { return resume_upload_call_count_; }
|
| + int64_t multipart_upload_call_count() const {
|
| return multipart_upload_call_count_;
|
| }
|
|
|
| @@ -106,7 +109,7 @@ class MockDriveServiceWithUploadExpectation : public DummyDriveService {
|
| // Handles a request for obtaining an upload location URL.
|
| CancelCallback InitiateUploadNewFile(
|
| const std::string& content_type,
|
| - int64 content_length,
|
| + int64_t content_length,
|
| const std::string& parent_resource_id,
|
| const std::string& title,
|
| const UploadNewFileOptions& options,
|
| @@ -125,7 +128,7 @@ class MockDriveServiceWithUploadExpectation : public DummyDriveService {
|
|
|
| CancelCallback InitiateUploadExistingFile(
|
| const std::string& content_type,
|
| - int64 content_length,
|
| + int64_t content_length,
|
| const std::string& resource_id,
|
| const UploadExistingFileOptions& options,
|
| const InitiateUploadCallback& callback) override {
|
| @@ -149,9 +152,9 @@ class MockDriveServiceWithUploadExpectation : public DummyDriveService {
|
| // Handles a request for uploading a chunk of bytes.
|
| CancelCallback ResumeUpload(
|
| const GURL& upload_location,
|
| - int64 start_position,
|
| - int64 end_position,
|
| - int64 content_length,
|
| + int64_t start_position,
|
| + int64_t end_position,
|
| + int64_t content_length,
|
| const std::string& content_type,
|
| const base::FilePath& local_file_path,
|
| const UploadRangeCallback& callback,
|
| @@ -161,7 +164,7 @@ class MockDriveServiceWithUploadExpectation : public DummyDriveService {
|
| EXPECT_EQ(expected_upload_file_, local_file_path);
|
|
|
| // The upload data must be split into 512KB chunks.
|
| - const int64 expected_chunk_end =
|
| + const int64_t expected_chunk_end =
|
| std::min(received_bytes_ + kUploadChunkSize, expected_content_length_);
|
| EXPECT_EQ(expected_chunk_end, end_position);
|
|
|
| @@ -181,7 +184,7 @@ class MockDriveServiceWithUploadExpectation : public DummyDriveService {
|
| if (!progress_callback.is_null()) {
|
| // For the testing purpose, it always notifies the progress at the end of
|
| // each chunk uploading.
|
| - int64 chunk_size = end_position - start_position;
|
| + int64_t chunk_size = end_position - start_position;
|
| base::ThreadTaskRunnerHandle::Get()->PostTask(FROM_HERE,
|
| base::Bind(progress_callback, chunk_size, chunk_size));
|
| }
|
| @@ -192,7 +195,7 @@ class MockDriveServiceWithUploadExpectation : public DummyDriveService {
|
|
|
| // Handles a request to fetch the current upload status.
|
| CancelCallback GetUploadStatus(const GURL& upload_location,
|
| - int64 content_length,
|
| + int64_t content_length,
|
| const UploadRangeCallback& callback) override {
|
| EXPECT_EQ(expected_content_length_, content_length);
|
| // The upload URL returned by InitiateUpload() must be used.
|
| @@ -228,7 +231,7 @@ class MockDriveServiceWithUploadExpectation : public DummyDriveService {
|
|
|
| CancelCallback MultipartUploadNewFile(
|
| const std::string& content_type,
|
| - int64 content_length,
|
| + int64_t content_length,
|
| const std::string& parent_resource_id,
|
| const std::string& title,
|
| const base::FilePath& local_file_path,
|
| @@ -249,7 +252,7 @@ class MockDriveServiceWithUploadExpectation : public DummyDriveService {
|
|
|
| CancelCallback MultipartUploadExistingFile(
|
| const std::string& content_type,
|
| - int64 content_length,
|
| + int64_t content_length,
|
| const std::string& resource_id,
|
| const base::FilePath& local_file_path,
|
| const UploadExistingFileOptions& options,
|
| @@ -275,10 +278,10 @@ class MockDriveServiceWithUploadExpectation : public DummyDriveService {
|
| }
|
|
|
| const base::FilePath expected_upload_file_;
|
| - const int64 expected_content_length_;
|
| - int64 received_bytes_;
|
| - int64 resume_upload_call_count_;
|
| - int64 multipart_upload_call_count_;
|
| + const int64_t expected_content_length_;
|
| + int64_t received_bytes_;
|
| + int64_t resume_upload_call_count_;
|
| + int64_t multipart_upload_call_count_;
|
| };
|
|
|
| // Mock DriveService that returns a failure at InitiateUpload().
|
| @@ -286,7 +289,7 @@ class MockDriveServiceNoConnectionAtInitiate : public DummyDriveService {
|
| // Returns error.
|
| CancelCallback InitiateUploadNewFile(
|
| const std::string& content_type,
|
| - int64 content_length,
|
| + int64_t content_length,
|
| const std::string& parent_resource_id,
|
| const std::string& title,
|
| const UploadNewFileOptions& options,
|
| @@ -298,7 +301,7 @@ class MockDriveServiceNoConnectionAtInitiate : public DummyDriveService {
|
|
|
| CancelCallback InitiateUploadExistingFile(
|
| const std::string& content_type,
|
| - int64 content_length,
|
| + int64_t content_length,
|
| const std::string& resource_id,
|
| const UploadExistingFileOptions& options,
|
| const InitiateUploadCallback& callback) override {
|
| @@ -310,9 +313,9 @@ class MockDriveServiceNoConnectionAtInitiate : public DummyDriveService {
|
| // Should not be used.
|
| CancelCallback ResumeUpload(
|
| const GURL& upload_url,
|
| - int64 start_position,
|
| - int64 end_position,
|
| - int64 content_length,
|
| + int64_t start_position,
|
| + int64_t end_position,
|
| + int64_t content_length,
|
| const std::string& content_type,
|
| const base::FilePath& local_file_path,
|
| const UploadRangeCallback& callback,
|
| @@ -323,7 +326,7 @@ class MockDriveServiceNoConnectionAtInitiate : public DummyDriveService {
|
|
|
| CancelCallback MultipartUploadNewFile(
|
| const std::string& content_type,
|
| - int64 content_length,
|
| + int64_t content_length,
|
| const std::string& parent_resource_id,
|
| const std::string& title,
|
| const base::FilePath& local_file_path,
|
| @@ -339,7 +342,7 @@ class MockDriveServiceNoConnectionAtInitiate : public DummyDriveService {
|
|
|
| CancelCallback MultipartUploadExistingFile(
|
| const std::string& content_type,
|
| - int64 content_length,
|
| + int64_t content_length,
|
| const std::string& resource_id,
|
| const base::FilePath& local_file_path,
|
| const UploadExistingFileOptions& options,
|
| @@ -358,7 +361,7 @@ class MockDriveServiceNoConnectionAtResume : public DummyDriveService {
|
| // Succeeds and returns an upload location URL.
|
| CancelCallback InitiateUploadNewFile(
|
| const std::string& content_type,
|
| - int64 content_length,
|
| + int64_t content_length,
|
| const std::string& parent_resource_id,
|
| const std::string& title,
|
| const UploadNewFileOptions& options,
|
| @@ -370,7 +373,7 @@ class MockDriveServiceNoConnectionAtResume : public DummyDriveService {
|
|
|
| CancelCallback InitiateUploadExistingFile(
|
| const std::string& content_type,
|
| - int64 content_length,
|
| + int64_t content_length,
|
| const std::string& resource_id,
|
| const UploadExistingFileOptions& options,
|
| const InitiateUploadCallback& callback) override {
|
| @@ -382,9 +385,9 @@ class MockDriveServiceNoConnectionAtResume : public DummyDriveService {
|
| // Returns error.
|
| CancelCallback ResumeUpload(
|
| const GURL& upload_url,
|
| - int64 start_position,
|
| - int64 end_position,
|
| - int64 content_length,
|
| + int64_t start_position,
|
| + int64_t end_position,
|
| + int64_t content_length,
|
| const std::string& content_type,
|
| const base::FilePath& local_file_path,
|
| const UploadRangeCallback& callback,
|
| @@ -401,7 +404,7 @@ class MockDriveServiceNoConnectionAtResume : public DummyDriveService {
|
| class MockDriveServiceNoConnectionAtGetUploadStatus : public DummyDriveService {
|
| // Returns error.
|
| CancelCallback GetUploadStatus(const GURL& upload_url,
|
| - int64 content_length,
|
| + int64_t content_length,
|
| const UploadRangeCallback& callback) override {
|
| base::ThreadTaskRunnerHandle::Get()->PostTask(FROM_HERE,
|
| base::Bind(callback,
|
| @@ -771,7 +774,7 @@ class MockDriveServiceForBatchProcessing : public DummyDriveService {
|
| struct UploadFileInfo {
|
| enum { NEW_FILE, EXISTING_FILE } type;
|
| std::string content_type;
|
| - uint64 content_length;
|
| + uint64_t content_length;
|
| std::string parent_resource_id;
|
| std::string resource_id;
|
| std::string title;
|
| @@ -788,7 +791,7 @@ class MockDriveServiceForBatchProcessing : public DummyDriveService {
|
|
|
| CancelCallback MultipartUploadNewFile(
|
| const std::string& content_type,
|
| - int64 content_length,
|
| + int64_t content_length,
|
| const std::string& parent_resource_id,
|
| const std::string& title,
|
| const base::FilePath& local_file_path,
|
| @@ -810,7 +813,7 @@ class MockDriveServiceForBatchProcessing : public DummyDriveService {
|
|
|
| CancelCallback MultipartUploadExistingFile(
|
| const std::string& content_type,
|
| - int64 content_length,
|
| + int64_t content_length,
|
| const std::string& resource_id,
|
| const base::FilePath& local_file_path,
|
| const UploadExistingFileOptions& options,
|
|
|