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

Unified Diff: chrome/browser/google_apis/drive_api_operations_unittest.cc

Issue 12090015: Implement CreateDirectoryOperation on Drive API v2. (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Add an empty line. Created 7 years, 11 months 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
« no previous file with comments | « chrome/browser/google_apis/drive_api_operations.cc ('k') | chrome/browser/google_apis/drive_api_service.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/google_apis/drive_api_operations_unittest.cc
diff --git a/chrome/browser/google_apis/drive_api_operations_unittest.cc b/chrome/browser/google_apis/drive_api_operations_unittest.cc
index e341eac2cc0077a9d5f3cf3132f4901565ce3634..f6f16bb6e1bebd5bebffed996de1ed445e36b2d9 100644
--- a/chrome/browser/google_apis/drive_api_operations_unittest.cc
+++ b/chrome/browser/google_apis/drive_api_operations_unittest.cc
@@ -143,4 +143,39 @@ TEST_F(DriveApiOperationsTest, GetAboutOperation_InvalidFeed) {
EXPECT_FALSE(feed_data.get());
}
+TEST_F(DriveApiOperationsTest, CreateDirectoryOperation) {
+ // Set an expected data file containing the directory's entry data.
+ expected_data_file_path_ =
+ test_util::GetTestFilePath("drive/directory_entry.json");
+
+ GDataErrorCode error = GDATA_OTHER_ERROR;
+ scoped_ptr<base::Value> feed_data;
+
+ // Create "new directory" in the root directory.
+ drive::CreateDirectoryOperation* operation =
+ new drive::CreateDirectoryOperation(
+ &operation_registry_,
+ request_context_getter_.get(),
+ *url_generator_,
+ "root",
+ "new directory",
+ base::Bind(&test_util::CopyResultsFromGetDataCallbackAndQuit,
+ &error, &feed_data));
+ operation->Start(kTestDriveApiAuthToken, kTestUserAgent,
+ base::Bind(&test_util::DoNothingForReAuthenticateCallback));
+ MessageLoop::current()->Run();
+
+ EXPECT_EQ(HTTP_SUCCESS, error);
+ EXPECT_EQ(test_server::METHOD_POST, http_request_.method);
+ EXPECT_EQ("/drive/v2/files", http_request_.relative_url);
+ EXPECT_EQ("application/json", http_request_.headers["Content-Type"]);
+
+ EXPECT_TRUE(http_request_.has_content);
+
+ EXPECT_EQ("{\"mimeType\":\"application/vnd.google-apps.folder\","
+ "\"parents\":[{\"id\":\"root\"}],"
+ "\"title\":\"new directory\"}",
+ http_request_.content);
+}
+
} // namespace google_apis
« no previous file with comments | « chrome/browser/google_apis/drive_api_operations.cc ('k') | chrome/browser/google_apis/drive_api_service.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698