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

Unified Diff: google_apis/drive/drive_api_requests_unittest.cc

Issue 1965963003: Use new API to download blobs from Google Drive. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 7 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 | « components/drive/service/drive_api_service_unittest.cc ('k') | google_apis/drive/drive_api_url_generator.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 79ed2394e8d656fd81c6194834994c176aa478df..67a78e043d151fc0c84edc76e658ab8714c23331 100644
--- a/google_apis/drive/drive_api_requests_unittest.cc
+++ b/google_apis/drive/drive_api_requests_unittest.cc
@@ -53,7 +53,8 @@ const char kTestPermissionResponse[] =
const char kTestUploadExistingFilePath[] = "/upload/existingfile/path";
const char kTestUploadNewFilePath[] = "/upload/newfile/path";
-const char kTestDownloadPathPrefix[] = "/host/";
+const char kTestDownloadPathPrefix[] = "/drive/v2/files/";
+const char kTestDownloadFileQuery[] = "alt=media";
// Used as a GetContentCallback.
void AppendContent(std::string* out,
@@ -167,7 +168,7 @@ class DriveApiRequestsTest : public testing::Test {
GURL test_base_url = test_util::GetBaseUrlForTesting(test_server_.port());
url_generator_.reset(
- new DriveApiUrlGenerator(test_base_url, test_base_url, test_base_url));
+ new DriveApiUrlGenerator(test_base_url, test_base_url));
// Reset the server's expected behavior just in case.
ResetExpectedResponse();
@@ -442,9 +443,9 @@ class DriveApiRequestsTest : public testing::Test {
const GURL absolute_url = test_server_.GetURL(request.relative_url);
std::string id;
- if (!test_util::RemovePrefix(absolute_url.path(),
- kTestDownloadPathPrefix,
- &id)) {
+ if (!test_util::RemovePrefix(
+ absolute_url.path(), kTestDownloadPathPrefix, &id) ||
+ absolute_url.query() != kTestDownloadFileQuery) {
return std::unique_ptr<net::test_server::HttpResponse>();
}
@@ -1877,7 +1878,8 @@ TEST_F(DriveApiRequestsTest, DownloadFileRequest) {
EXPECT_EQ(HTTP_SUCCESS, result_code);
EXPECT_EQ(net::test_server::METHOD_GET, http_request_.method);
- EXPECT_EQ(kTestDownloadPathPrefix + kTestId, http_request_.relative_url);
+ EXPECT_EQ(kTestDownloadPathPrefix + kTestId + "?" + kTestDownloadFileQuery,
+ http_request_.relative_url);
EXPECT_EQ(kDownloadedFilePath, temp_file);
const std::string expected_contents = kTestId + kTestId + kTestId;
@@ -1912,7 +1914,8 @@ TEST_F(DriveApiRequestsTest, DownloadFileRequest_GetContentCallback) {
EXPECT_EQ(HTTP_SUCCESS, result_code);
EXPECT_EQ(net::test_server::METHOD_GET, http_request_.method);
- EXPECT_EQ(kTestDownloadPathPrefix + kTestId, http_request_.relative_url);
+ EXPECT_EQ(kTestDownloadPathPrefix + kTestId + "?" + kTestDownloadFileQuery,
+ http_request_.relative_url);
EXPECT_EQ(kDownloadedFilePath, temp_file);
const std::string expected_contents = kTestId + kTestId + kTestId;
« no previous file with comments | « components/drive/service/drive_api_service_unittest.cc ('k') | google_apis/drive/drive_api_url_generator.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698