| Index: google_apis/drive/drive_api_requests_unittest.cc
|
| diff --git a/google_apis/drive/drive_api_requests_unittest.cc b/google_apis/drive/drive_api_requests_unittest.cc
|
| index deb2845536a9bb142b9add983c7a00847f423f57..ccf8b6c21276eb57c62246f9943aeb50a15a0666 100644
|
| --- a/google_apis/drive/drive_api_requests_unittest.cc
|
| +++ b/google_apis/drive/drive_api_requests_unittest.cc
|
| @@ -62,6 +62,18 @@ void AppendContent(std::string* out,
|
| class DriveApiRequestsTest : public testing::Test {
|
| public:
|
| DriveApiRequestsTest() {
|
| + // Testing properties used by multiple test cases.
|
| + drive::Property private_property;
|
| + private_property.set_key("key1");
|
| + private_property.set_value("value1");
|
| +
|
| + drive::Property public_property;
|
| + public_property.set_visibility(drive::Property::VISIBILITY_PUBLIC);
|
| + public_property.set_key("key2");
|
| + public_property.set_value("value2");
|
| +
|
| + testing_properties_.push_back(private_property);
|
| + testing_properties_.push_back(public_property);
|
| }
|
|
|
| void SetUp() override {
|
| @@ -140,6 +152,9 @@ class DriveApiRequestsTest : public testing::Test {
|
| // instead of GET).
|
| net::test_server::HttpRequest http_request_;
|
|
|
| + // Testing properties used by multiple test cases.
|
| + drive::Properties testing_properties_;
|
| +
|
| private:
|
| void ResetExpectedResponse() {
|
| expected_data_file_path_.clear();
|
| @@ -511,20 +526,7 @@ TEST_F(DriveApiRequestsTest, FilesPatchRequest) {
|
| base::Time::FromUTCExploded(kLastViewedByMeDate));
|
| request->add_parent("parent_resource_id");
|
|
|
| - drive::Property private_property;
|
| - private_property.set_key("key1");
|
| - private_property.set_value("value1");
|
| -
|
| - drive::Property public_property;
|
| - public_property.set_visibility(drive::Property::VISIBILITY_PUBLIC);
|
| - public_property.set_key("key2");
|
| - public_property.set_value("value2");
|
| -
|
| - drive::Properties properties;
|
| - properties.push_back(private_property);
|
| - properties.push_back(public_property);
|
| - request->set_properties(properties);
|
| -
|
| + request->set_properties(testing_properties_);
|
| request_sender_->StartRequestWithRetry(request);
|
| run_loop.Run();
|
| }
|
| @@ -964,6 +966,7 @@ TEST_F(DriveApiRequestsTest, UploadNewFileRequest) {
|
| test_util::CreateQuitCallback(
|
| &run_loop,
|
| test_util::CreateCopyResultCallback(&error, &upload_url)));
|
| + request->set_properties(testing_properties_);
|
| request_sender_->StartRequestWithRetry(request);
|
| run_loop.Run();
|
| }
|
| @@ -979,12 +982,16 @@ TEST_F(DriveApiRequestsTest, UploadNewFileRequest) {
|
| http_request_.relative_url);
|
| EXPECT_EQ("application/json", http_request_.headers["Content-Type"]);
|
| EXPECT_TRUE(http_request_.has_content);
|
| - EXPECT_EQ("{\"parents\":[{"
|
| - "\"id\":\"parent_resource_id\","
|
| - "\"kind\":\"drive#fileLink\""
|
| - "}],"
|
| - "\"title\":\"new file title\"}",
|
| - http_request_.content);
|
| + EXPECT_EQ(
|
| + "{\"parents\":[{"
|
| + "\"id\":\"parent_resource_id\","
|
| + "\"kind\":\"drive#fileLink\""
|
| + "}],"
|
| + "\"properties\":["
|
| + "{\"key\":\"key1\",\"value\":\"value1\",\"visibility\":\"PRIVATE\"},"
|
| + "{\"key\":\"key2\",\"value\":\"value2\",\"visibility\":\"PUBLIC\"}],"
|
| + "\"title\":\"new file title\"}",
|
| + http_request_.content);
|
|
|
| // Upload the content to the upload URL.
|
| UploadRangeResponse response;
|
| @@ -1377,6 +1384,7 @@ TEST_F(DriveApiRequestsTest, UploadExistingFileRequest) {
|
| test_util::CreateQuitCallback(
|
| &run_loop,
|
| test_util::CreateCopyResultCallback(&error, &upload_url)));
|
| + request->set_properties(testing_properties_);
|
| request_sender_->StartRequestWithRetry(request);
|
| run_loop.Run();
|
| }
|
| @@ -1392,7 +1400,11 @@ TEST_F(DriveApiRequestsTest, UploadExistingFileRequest) {
|
| EXPECT_EQ("/upload/drive/v2/files/resource_id?uploadType=resumable",
|
| http_request_.relative_url);
|
| EXPECT_TRUE(http_request_.has_content);
|
| - EXPECT_TRUE(http_request_.content.empty());
|
| + EXPECT_EQ(
|
| + "{\"properties\":["
|
| + "{\"key\":\"key1\",\"value\":\"value1\",\"visibility\":\"PRIVATE\"},"
|
| + "{\"key\":\"key2\",\"value\":\"value2\",\"visibility\":\"PUBLIC\"}]}",
|
| + http_request_.content);
|
|
|
| // Upload the content to the upload URL.
|
| UploadRangeResponse response;
|
|
|