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

Side by Side Diff: chrome/browser/google_apis/drive_api_requests_unittest.cc

Issue 23477038: Misc clean up for Drive API service and requests. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 3 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « chrome/browser/google_apis/drive_api_requests.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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/file_util.h" 6 #include "base/file_util.h"
7 #include "base/files/file_path.h" 7 #include "base/files/file_path.h"
8 #include "base/files/scoped_temp_dir.h" 8 #include "base/files/scoped_temp_dir.h"
9 #include "base/message_loop/message_loop.h" 9 #include "base/message_loop/message_loop.h"
10 #include "base/run_loop.h" 10 #include "base/run_loop.h"
(...skipping 690 matching lines...) Expand 10 before | Expand all | Expand 10 after
701 request_sender_->StartRequestWithRetry(request); 701 request_sender_->StartRequestWithRetry(request);
702 run_loop.Run(); 702 run_loop.Run();
703 } 703 }
704 704
705 EXPECT_EQ(HTTP_SUCCESS, error); 705 EXPECT_EQ(HTTP_SUCCESS, error);
706 EXPECT_EQ(net::test_server::METHOD_GET, http_request_.method); 706 EXPECT_EQ(net::test_server::METHOD_GET, http_request_.method);
707 EXPECT_EQ("/continue/get/file/list", http_request_.relative_url); 707 EXPECT_EQ("/continue/get/file/list", http_request_.relative_url);
708 EXPECT_TRUE(result); 708 EXPECT_TRUE(result);
709 } 709 }
710 710
711 TEST_F(DriveApiRequestsTest, ContinueGetFileListRequest) {
712 // Set an expected data file containing valid result.
713 expected_data_file_path_ = test_util::GetTestFilePath(
714 "drive/filelist.json");
715
716 GDataErrorCode error = GDATA_OTHER_ERROR;
717 scoped_ptr<base::Value> result;
718
719 {
720 base::RunLoop run_loop;
721 drive::ContinueGetFileListRequest* request =
722 new drive::ContinueGetFileListRequest(
723 request_sender_.get(),
724 test_server_.GetURL("/continue/get/file/list"),
725 test_util::CreateQuitCallback(
726 &run_loop,
727 test_util::CreateCopyResultCallback(&error, &result)));
728 request_sender_->StartRequestWithRetry(request);
729 run_loop.Run();
730 }
731
732 EXPECT_EQ(HTTP_SUCCESS, error);
733 EXPECT_EQ(net::test_server::METHOD_GET, http_request_.method);
734 EXPECT_EQ("/continue/get/file/list", http_request_.relative_url);
735 EXPECT_TRUE(result);
736 }
737
738 TEST_F(DriveApiRequestsTest, FilesTrashRequest) { 711 TEST_F(DriveApiRequestsTest, FilesTrashRequest) {
739 // Set data for the expected result. Directory entry should be returned 712 // Set data for the expected result. Directory entry should be returned
740 // if the trashing entry is a directory, so using it here should be fine. 713 // if the trashing entry is a directory, so using it here should be fine.
741 expected_data_file_path_ = 714 expected_data_file_path_ =
742 test_util::GetTestFilePath("drive/directory_entry.json"); 715 test_util::GetTestFilePath("drive/directory_entry.json");
743 716
744 GDataErrorCode error = GDATA_OTHER_ERROR; 717 GDataErrorCode error = GDATA_OTHER_ERROR;
745 scoped_ptr<FileResource> file_resource; 718 scoped_ptr<FileResource> file_resource;
746 719
747 // Trash a resource with the given resource id. 720 // Trash a resource with the given resource id.
(...skipping 782 matching lines...) Expand 10 before | Expand all | Expand 10 after
1530 EXPECT_EQ(HTTP_SUCCESS, result_code); 1503 EXPECT_EQ(HTTP_SUCCESS, result_code);
1531 EXPECT_EQ(net::test_server::METHOD_GET, http_request_.method); 1504 EXPECT_EQ(net::test_server::METHOD_GET, http_request_.method);
1532 EXPECT_EQ(kTestDownloadPathPrefix + kTestId, http_request_.relative_url); 1505 EXPECT_EQ(kTestDownloadPathPrefix + kTestId, http_request_.relative_url);
1533 EXPECT_EQ(kDownloadedFilePath, temp_file); 1506 EXPECT_EQ(kDownloadedFilePath, temp_file);
1534 1507
1535 const std::string expected_contents = kTestId + kTestId + kTestId; 1508 const std::string expected_contents = kTestId + kTestId + kTestId;
1536 EXPECT_EQ(expected_contents, contents); 1509 EXPECT_EQ(expected_contents, contents);
1537 } 1510 }
1538 1511
1539 } // namespace google_apis 1512 } // namespace google_apis
OLDNEW
« no previous file with comments | « chrome/browser/google_apis/drive_api_requests.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698