OLD | NEW |
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2013 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 "base/bind.h" | 5 #include "base/bind.h" |
6 #include "base/files/file_path.h" | 6 #include "base/files/file_path.h" |
7 #include "base/message_loop_proxy.h" | 7 #include "base/message_loop_proxy.h" |
8 #include "base/strings/string_number_conversions.h" | 8 #include "base/strings/string_number_conversions.h" |
9 #include "base/values.h" | 9 #include "base/values.h" |
10 #include "chrome/browser/google_apis/drive_api_operations.h" | 10 #include "chrome/browser/google_apis/drive_api_operations.h" |
(...skipping 849 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
860 // Initiate uploading a new file to the directory with "parent_resource_id". | 860 // Initiate uploading a new file to the directory with "parent_resource_id". |
861 drive::InitiateUploadExistingFileOperation* operation = | 861 drive::InitiateUploadExistingFileOperation* operation = |
862 new drive::InitiateUploadExistingFileOperation( | 862 new drive::InitiateUploadExistingFileOperation( |
863 &operation_registry_, | 863 &operation_registry_, |
864 request_context_getter_.get(), | 864 request_context_getter_.get(), |
865 *url_generator_, | 865 *url_generator_, |
866 base::FilePath(FILE_PATH_LITERAL("drive/file/path")), | 866 base::FilePath(FILE_PATH_LITERAL("drive/file/path")), |
867 kTestContentType, | 867 kTestContentType, |
868 kTestContent.size(), | 868 kTestContent.size(), |
869 "resource_id", // The resource id of the file to be overwritten. | 869 "resource_id", // The resource id of the file to be overwritten. |
870 "", // No etag. | 870 std::string(), // No etag. |
871 CreateComposedCallback( | 871 CreateComposedCallback( |
872 base::Bind(&test_util::RunAndQuit), | 872 base::Bind(&test_util::RunAndQuit), |
873 test_util::CreateCopyResultCallback(&error, &upload_url))); | 873 test_util::CreateCopyResultCallback(&error, &upload_url))); |
874 operation->Start(kTestDriveApiAuthToken, kTestUserAgent, | 874 operation->Start(kTestDriveApiAuthToken, kTestUserAgent, |
875 base::Bind(&test_util::DoNothingForReAuthenticateCallback)); | 875 base::Bind(&test_util::DoNothingForReAuthenticateCallback)); |
876 MessageLoop::current()->Run(); | 876 MessageLoop::current()->Run(); |
877 | 877 |
878 EXPECT_EQ(HTTP_SUCCESS, error); | 878 EXPECT_EQ(HTTP_SUCCESS, error); |
879 EXPECT_EQ(kTestUploadExistingFilePath, upload_url.path()); | 879 EXPECT_EQ(kTestUploadExistingFilePath, upload_url.path()); |
880 EXPECT_EQ(kTestContentType, http_request_.headers["X-Upload-Content-Type"]); | 880 EXPECT_EQ(kTestContentType, http_request_.headers["X-Upload-Content-Type"]); |
(...skipping 175 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1056 EXPECT_EQ("Conflicting-etag", http_request_.headers["If-Match"]); | 1056 EXPECT_EQ("Conflicting-etag", http_request_.headers["If-Match"]); |
1057 | 1057 |
1058 EXPECT_EQ(test_server::METHOD_PUT, http_request_.method); | 1058 EXPECT_EQ(test_server::METHOD_PUT, http_request_.method); |
1059 EXPECT_EQ("/upload/drive/v2/files/resource_id?uploadType=resumable", | 1059 EXPECT_EQ("/upload/drive/v2/files/resource_id?uploadType=resumable", |
1060 http_request_.relative_url); | 1060 http_request_.relative_url); |
1061 EXPECT_TRUE(http_request_.has_content); | 1061 EXPECT_TRUE(http_request_.has_content); |
1062 EXPECT_TRUE(http_request_.content.empty()); | 1062 EXPECT_TRUE(http_request_.content.empty()); |
1063 } | 1063 } |
1064 | 1064 |
1065 } // namespace google_apis | 1065 } // namespace google_apis |
OLD | NEW |