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, |