diff options
author | ricea <ricea@chromium.org> | 2015-09-19 22:52:07 -0700 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2015-09-20 05:52:40 +0000 |
commit | 12de5596316369e2b2043af0bf4a71caf8fbb129 (patch) | |
tree | 943b5c50f8e4deb89e4ec0f4c4b371cec218e0a5 | |
parent | db3076d350ca550e664e36b7fedca07eedaa6c9b (diff) | |
download | chromium_src-12de5596316369e2b2043af0bf4a71caf8fbb129.zip chromium_src-12de5596316369e2b2043af0bf4a71caf8fbb129.tar.gz chromium_src-12de5596316369e2b2043af0bf4a71caf8fbb129.tar.bz2 |
Use the appropriate variant of IntToString in //google_apis
Using the wrong variant of IntToString() can lead to unexpected
behaviour and bugs. Use the appropriate variant for the type being
converted.
No behaviour change intended.
BUG=505479
TEST=compiled
Review URL: https://codereview.chromium.org/1354923004
Cr-Commit-Position: refs/heads/master@{#349875}
-rw-r--r-- | google_apis/drive/drive_api_requests_unittest.cc | 42 | ||||
-rw-r--r-- | google_apis/gcm/engine/gcm_store_impl.cc | 2 | ||||
-rw-r--r-- | google_apis/gcm/engine/mcs_client.cc | 2 |
3 files changed, 23 insertions, 23 deletions
diff --git a/google_apis/drive/drive_api_requests_unittest.cc b/google_apis/drive/drive_api_requests_unittest.cc index 358715e..15cb7cc 100644 --- a/google_apis/drive/drive_api_requests_unittest.cc +++ b/google_apis/drive/drive_api_requests_unittest.cc @@ -1081,7 +1081,7 @@ TEST_F(DriveApiRequestsTest, UploadNewFileRequest) { EXPECT_EQ(HTTP_SUCCESS, error); EXPECT_EQ(kTestUploadNewFilePath, upload_url.path()); EXPECT_EQ(kTestContentType, http_request_.headers["X-Upload-Content-Type"]); - EXPECT_EQ(base::Int64ToString(kTestContent.size()), + EXPECT_EQ(base::SizeTToString(kTestContent.size()), http_request_.headers["X-Upload-Content-Length"]); EXPECT_EQ(net::test_server::METHOD_POST, http_request_.method); @@ -1129,8 +1129,8 @@ TEST_F(DriveApiRequestsTest, UploadNewFileRequest) { EXPECT_EQ(upload_url.path(), http_request_.relative_url); // Content-Range header should be added. EXPECT_EQ("bytes 0-" + - base::Int64ToString(kTestContent.size() - 1) + "/" + - base::Int64ToString(kTestContent.size()), + base::SizeTToString(kTestContent.size() - 1) + "/" + + base::SizeTToString(kTestContent.size()), http_request_.headers["Content-Range"]); // The upload content should be set in the HTTP request. EXPECT_TRUE(http_request_.has_content); @@ -1266,7 +1266,7 @@ TEST_F(DriveApiRequestsTest, UploadNewLargeFileRequest) { EXPECT_EQ(HTTP_SUCCESS, error); EXPECT_EQ(kTestUploadNewFilePath, upload_url.path()); EXPECT_EQ(kTestContentType, http_request_.headers["X-Upload-Content-Type"]); - EXPECT_EQ(base::Int64ToString(kTestContent.size()), + EXPECT_EQ(base::SizeTToString(kTestContent.size()), http_request_.headers["X-Upload-Content-Length"]); EXPECT_EQ(net::test_server::METHOD_POST, http_request_.method); @@ -1307,7 +1307,7 @@ TEST_F(DriveApiRequestsTest, UploadNewLargeFileRequest) { // Request should go to the upload URL. EXPECT_EQ(upload_url.path(), http_request_.relative_url); // Content-Range header should be added. - EXPECT_EQ("bytes */" + base::Int64ToString(kTestContent.size()), + EXPECT_EQ("bytes */" + base::SizeTToString(kTestContent.size()), http_request_.headers["Content-Range"]); EXPECT_TRUE(http_request_.has_content); EXPECT_TRUE(http_request_.content.empty()); @@ -1354,9 +1354,9 @@ TEST_F(DriveApiRequestsTest, UploadNewLargeFileRequest) { EXPECT_EQ(upload_url.path(), http_request_.relative_url); // Content-Range header should be added. EXPECT_EQ("bytes " + - base::Int64ToString(start_position) + "-" + - base::Int64ToString(end_position - 1) + "/" + - base::Int64ToString(kTestContent.size()), + base::SizeTToString(start_position) + "-" + + base::SizeTToString(end_position - 1) + "/" + + base::SizeTToString(kTestContent.size()), http_request_.headers["Content-Range"]); // The upload content should be set in the HTTP request. EXPECT_TRUE(http_request_.has_content); @@ -1397,7 +1397,7 @@ TEST_F(DriveApiRequestsTest, UploadNewLargeFileRequest) { // Request should go to the upload URL. EXPECT_EQ(upload_url.path(), http_request_.relative_url); // Content-Range header should be added. - EXPECT_EQ("bytes */" + base::Int64ToString(kTestContent.size()), + EXPECT_EQ("bytes */" + base::SizeTToString(kTestContent.size()), http_request_.headers["Content-Range"]); EXPECT_TRUE(http_request_.has_content); EXPECT_TRUE(http_request_.content.empty()); @@ -1448,7 +1448,7 @@ TEST_F(DriveApiRequestsTest, UploadNewFileWithMetadataRequest) { EXPECT_EQ(HTTP_SUCCESS, error); EXPECT_EQ(kTestUploadNewFilePath, upload_url.path()); EXPECT_EQ(kTestContentType, http_request_.headers["X-Upload-Content-Type"]); - EXPECT_EQ(base::Int64ToString(kTestContent.size()), + EXPECT_EQ(base::SizeTToString(kTestContent.size()), http_request_.headers["X-Upload-Content-Length"]); EXPECT_EQ(net::test_server::METHOD_POST, http_request_.method); @@ -1499,7 +1499,7 @@ TEST_F(DriveApiRequestsTest, UploadExistingFileRequest) { EXPECT_EQ(HTTP_SUCCESS, error); EXPECT_EQ(kTestUploadExistingFilePath, upload_url.path()); EXPECT_EQ(kTestContentType, http_request_.headers["X-Upload-Content-Type"]); - EXPECT_EQ(base::Int64ToString(kTestContent.size()), + EXPECT_EQ(base::SizeTToString(kTestContent.size()), http_request_.headers["X-Upload-Content-Length"]); EXPECT_EQ("*", http_request_.headers["If-Match"]); @@ -1542,8 +1542,8 @@ TEST_F(DriveApiRequestsTest, UploadExistingFileRequest) { EXPECT_EQ(upload_url.path(), http_request_.relative_url); // Content-Range header should be added. EXPECT_EQ("bytes 0-" + - base::Int64ToString(kTestContent.size() - 1) + "/" + - base::Int64ToString(kTestContent.size()), + base::SizeTToString(kTestContent.size() - 1) + "/" + + base::SizeTToString(kTestContent.size()), http_request_.headers["Content-Range"]); // The upload content should be set in the HTTP request. EXPECT_TRUE(http_request_.has_content); @@ -1590,7 +1590,7 @@ TEST_F(DriveApiRequestsTest, UploadExistingFileRequestWithETag) { EXPECT_EQ(HTTP_SUCCESS, error); EXPECT_EQ(kTestUploadExistingFilePath, upload_url.path()); EXPECT_EQ(kTestContentType, http_request_.headers["X-Upload-Content-Type"]); - EXPECT_EQ(base::Int64ToString(kTestContent.size()), + EXPECT_EQ(base::SizeTToString(kTestContent.size()), http_request_.headers["X-Upload-Content-Length"]); EXPECT_EQ(kTestETag, http_request_.headers["If-Match"]); @@ -1629,8 +1629,8 @@ TEST_F(DriveApiRequestsTest, UploadExistingFileRequestWithETag) { EXPECT_EQ(upload_url.path(), http_request_.relative_url); // Content-Range header should be added. EXPECT_EQ("bytes 0-" + - base::Int64ToString(kTestContent.size() - 1) + "/" + - base::Int64ToString(kTestContent.size()), + base::SizeTToString(kTestContent.size() - 1) + "/" + + base::SizeTToString(kTestContent.size()), http_request_.headers["Content-Range"]); // The upload content should be set in the HTTP request. EXPECT_TRUE(http_request_.has_content); @@ -1678,7 +1678,7 @@ TEST_F(DriveApiRequestsTest, UploadExistingFileRequestWithETagConflicting) { EXPECT_EQ(HTTP_PRECONDITION, error); EXPECT_EQ(kTestContentType, http_request_.headers["X-Upload-Content-Type"]); - EXPECT_EQ(base::Int64ToString(kTestContent.size()), + EXPECT_EQ(base::SizeTToString(kTestContent.size()), http_request_.headers["X-Upload-Content-Length"]); EXPECT_EQ("Conflicting-etag", http_request_.headers["If-Match"]); @@ -1724,7 +1724,7 @@ TEST_F(DriveApiRequestsTest, EXPECT_EQ(HTTP_SUCCESS, error); EXPECT_EQ(kTestUploadExistingFilePath, upload_url.path()); EXPECT_EQ(kTestContentType, http_request_.headers["X-Upload-Content-Type"]); - EXPECT_EQ(base::Int64ToString(kTestContent.size()), + EXPECT_EQ(base::SizeTToString(kTestContent.size()), http_request_.headers["X-Upload-Content-Length"]); EXPECT_EQ(kTestETag, http_request_.headers["If-Match"]); @@ -1768,8 +1768,8 @@ TEST_F(DriveApiRequestsTest, EXPECT_EQ(upload_url.path(), http_request_.relative_url); // Content-Range header should be added. EXPECT_EQ("bytes 0-" + - base::Int64ToString(kTestContent.size() - 1) + "/" + - base::Int64ToString(kTestContent.size()), + base::SizeTToString(kTestContent.size() - 1) + "/" + + base::SizeTToString(kTestContent.size()), http_request_.headers["Content-Range"]); // The upload content should be set in the HTTP request. EXPECT_TRUE(http_request_.has_content); @@ -1826,7 +1826,7 @@ TEST_F(DriveApiRequestsTest, UploadExistingFileWithMetadataRequest) { EXPECT_EQ(HTTP_SUCCESS, error); EXPECT_EQ(kTestUploadExistingFilePath, upload_url.path()); EXPECT_EQ(kTestContentType, http_request_.headers["X-Upload-Content-Type"]); - EXPECT_EQ(base::Int64ToString(kTestContent.size()), + EXPECT_EQ(base::SizeTToString(kTestContent.size()), http_request_.headers["X-Upload-Content-Length"]); EXPECT_EQ(kTestETag, http_request_.headers["If-Match"]); diff --git a/google_apis/gcm/engine/gcm_store_impl.cc b/google_apis/gcm/engine/gcm_store_impl.cc index 8ac2521..3ad9b99 100644 --- a/google_apis/gcm/engine/gcm_store_impl.cc +++ b/google_apis/gcm/engine/gcm_store_impl.cc @@ -1002,7 +1002,7 @@ bool GCMStoreImpl::Backend::LoadOutgoingMessages( return false; } DVLOG(1) << "Found outgoing message with id " << id << " of type " - << base::IntToString(tag); + << base::UintToString(tag); (*outgoing_messages)[id] = make_linked_ptr(message.release()); } diff --git a/google_apis/gcm/engine/mcs_client.cc b/google_apis/gcm/engine/mcs_client.cc index a63192c..f20d937 100644 --- a/google_apis/gcm/engine/mcs_client.cc +++ b/google_apis/gcm/engine/mcs_client.cc @@ -924,7 +924,7 @@ void MCSClient::HandleServerConfirmedReceipt(StreamId device_stream_id) { } MCSClient::PersistentId MCSClient::GetNextPersistentId() { - return base::Uint64ToString(base::TimeTicks::Now().ToInternalValue()); + return base::Int64ToString(base::TimeTicks::Now().ToInternalValue()); } void MCSClient::OnConnectionResetByHeartbeat( |