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

Unified Diff: chrome/browser/chromeos/drive/drive_file_system_unittest.cc

Issue 11530004: google_apis: DriveServiceInterface::GetResourceEntry() returns ResourceEntry (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase Created 8 years 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
Index: chrome/browser/chromeos/drive/drive_file_system_unittest.cc
diff --git a/chrome/browser/chromeos/drive/drive_file_system_unittest.cc b/chrome/browser/chromeos/drive/drive_file_system_unittest.cc
index 98f8e9f6d8a2c6cdac4a2d6ce585d66a837e08c4..f1a0c131a220998ec0ed54c0048dbc55c4f5a4e4 100644
--- a/chrome/browser/chromeos/drive/drive_file_system_unittest.cc
+++ b/chrome/browser/chromeos/drive/drive_file_system_unittest.cc
@@ -84,9 +84,9 @@ void DriveSearchCallback(
// Action used to set mock expectations for
// DriveServiceInterface::GetResourceEntry().
-ACTION_P2(MockGetResourceEntry, status, value) {
+ACTION_P2(MockGetResourceEntry, status, entry) {
base::MessageLoopProxy::current()->PostTask(FROM_HERE,
- base::Bind(arg1, status, base::Passed(value)));
+ base::Bind(arg1, status, entry));
}
// Action used to set mock expectations for
@@ -619,10 +619,13 @@ class DriveFileSystemTest : public testing::Test {
}
}
- void SetExpectationsForGetResourceEntry(scoped_ptr<base::Value>* document,
+ void SetExpectationsForGetResourceEntry(const base::Value& value,
const std::string& resource_id) {
+ scoped_ptr<google_apis::ResourceEntry> entry =
+ google_apis::ResourceEntry::ExtractAndParse(value);
EXPECT_CALL(*mock_drive_service_, GetResourceEntry(resource_id, _))
- .WillOnce(MockGetResourceEntry(google_apis::HTTP_SUCCESS, document));
+ .WillOnce(MockGetResourceEntry(google_apis::HTTP_SUCCESS,
+ base::Passed(&entry)));
}
// Loads serialized proto file from GCache, and makes sure the root
@@ -1402,7 +1405,7 @@ TEST_F(DriveFileSystemTest, TransferFileFromRemoteToLocal_RegularFile) {
// We will read content url from the result.
scoped_ptr<base::Value> document =
google_apis::test_util::LoadJSONFile("gdata/document_to_download.json");
- SetExpectationsForGetResourceEntry(&document, "file:2_file_resource_id");
+ SetExpectationsForGetResourceEntry(*document, "file:2_file_resource_id");
// The file is obtained with the mock DriveService.
EXPECT_CALL(*mock_drive_service_,
@@ -2018,7 +2021,7 @@ TEST_F(DriveFileSystemTest, GetFileByPath_FromGData_EnoughSpace) {
// We will read content url from the result.
scoped_ptr<base::Value> document =
google_apis::test_util::LoadJSONFile("gdata/document_to_download.json");
- SetExpectationsForGetResourceEntry(&document, "file:2_file_resource_id");
+ SetExpectationsForGetResourceEntry(*document, "file:2_file_resource_id");
// The file is obtained with the mock DriveService.
EXPECT_CALL(*mock_drive_service_,
@@ -2059,7 +2062,7 @@ TEST_F(DriveFileSystemTest, GetFileByPath_FromGData_NoSpaceAtAll) {
// We will read content url from the result.
scoped_ptr<base::Value> document =
google_apis::test_util::LoadJSONFile("gdata/document_to_download.json");
- SetExpectationsForGetResourceEntry(&document, "file:2_file_resource_id");
+ SetExpectationsForGetResourceEntry(*document, "file:2_file_resource_id");
// The file is not obtained with the mock DriveService, because of no space.
EXPECT_CALL(*mock_drive_service_,
@@ -2115,7 +2118,7 @@ TEST_F(DriveFileSystemTest, GetFileByPath_FromGData_NoEnoughSpaceButCanFreeUp) {
// We will read content url from the result.
scoped_ptr<base::Value> document =
google_apis::test_util::LoadJSONFile("gdata/document_to_download.json");
- SetExpectationsForGetResourceEntry(&document, "file:2_file_resource_id");
+ SetExpectationsForGetResourceEntry(*document, "file:2_file_resource_id");
// The file is obtained with the mock DriveService, because of we freed up the
// space.
@@ -2168,7 +2171,7 @@ TEST_F(DriveFileSystemTest, GetFileByPath_FromGData_EnoughSpaceButBecomeFull) {
// We will read content url from the result.
scoped_ptr<base::Value> document =
google_apis::test_util::LoadJSONFile("gdata/document_to_download.json");
- SetExpectationsForGetResourceEntry(&document, "file:2_file_resource_id");
+ SetExpectationsForGetResourceEntry(*document, "file:2_file_resource_id");
// The file is obtained with the mock DriveService.
EXPECT_CALL(*mock_drive_service_,
@@ -2275,7 +2278,7 @@ TEST_F(DriveFileSystemTest, GetFileByResourceId) {
// We will read content url from the result.
scoped_ptr<base::Value> document =
google_apis::test_util::LoadJSONFile("gdata/document_to_download.json");
- SetExpectationsForGetResourceEntry(&document, "file:2_file_resource_id");
+ SetExpectationsForGetResourceEntry(*document, "file:2_file_resource_id");
// The file is obtained with the mock DriveService, because it's not stored in
// the cache.
@@ -2622,7 +2625,7 @@ TEST_F(DriveFileSystemTest, OpenAndCloseFile) {
// We will read content url from the result.
scoped_ptr<base::Value> document =
google_apis::test_util::LoadJSONFile("gdata/document_to_download.json");
- SetExpectationsForGetResourceEntry(&document, "file:2_file_resource_id");
+ SetExpectationsForGetResourceEntry(*document, "file:2_file_resource_id");
// The file is obtained with the mock DriveService.
EXPECT_CALL(*mock_drive_service_,
« no previous file with comments | « chrome/browser/chromeos/drive/drive_file_system.cc ('k') | chrome/browser/chromeos/drive/drive_scheduler_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698