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

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

Issue 17140009: Support contents upload on FakeDriveService (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: style fix Created 7 years, 6 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
Index: chrome/browser/google_apis/test_util.cc
diff --git a/chrome/browser/google_apis/test_util.cc b/chrome/browser/google_apis/test_util.cc
index 84dab6cd709b89c39b0666bf9d1a65598972a382..f11de74f2a69e2e3fb814b4abed7022a0752f4b8 100644
--- a/chrome/browser/google_apis/test_util.cc
+++ b/chrome/browser/google_apis/test_util.cc
@@ -97,6 +97,24 @@ bool WriteStringToFile(const base::FilePath& file_path,
return content.size() == static_cast<size_t>(result);
}
+bool ReadFile(const base::FilePath& file_path,
+ int64 offset,
+ char* buffer,
+ int size) {
+ bool created = false;
+ base::PlatformFileError error = base::PLATFORM_FILE_ERROR_FAILED;
+ base::PlatformFile file = base::CreatePlatformFile(
+ file_path,
+ base::PLATFORM_FILE_OPEN | base::PLATFORM_FILE_READ,
+ &created, &error);
+ if (error != base::PLATFORM_FILE_OK)
+ return false;
+
+ int result = base::ReadPlatformFile(file, offset, buffer, size);
+ base::ClosePlatformFile(file);
+ return result == size;
+}
+
bool CreateFileOfSpecifiedSize(const base::FilePath& temp_dir,
size_t size,
base::FilePath* path,
« chrome/browser/google_apis/test_util.h ('K') | « chrome/browser/google_apis/test_util.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698