summaryrefslogtreecommitdiffstats
path: root/base/platform_file_unittest.cc
diff options
context:
space:
mode:
authorrvargas@google.com <rvargas@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2011-08-26 22:17:19 +0000
committerrvargas@google.com <rvargas@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2011-08-26 22:17:19 +0000
commit29b5121000536bc5b11488a6235ef66302265ec5 (patch)
treead91611ccf0f06a2bbf7fd0a0920a40c7e378b1d /base/platform_file_unittest.cc
parent5e36e7f06e1be8b93ecdd09acfc0f26ea3177fb2 (diff)
downloadchromium_src-29b5121000536bc5b11488a6235ef66302265ec5.zip
chromium_src-29b5121000536bc5b11488a6235ef66302265ec5.tar.gz
chromium_src-29b5121000536bc5b11488a6235ef66302265ec5.tar.bz2
Base: WritePlatformFile now retries the operation if
the OS writes less than expected (for POSIX). BUG=94161 TEST=none Review URL: http://codereview.chromium.org/7745008 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@98497 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'base/platform_file_unittest.cc')
-rw-r--r--base/platform_file_unittest.cc18
1 files changed, 1 insertions, 17 deletions
diff --git a/base/platform_file_unittest.cc b/base/platform_file_unittest.cc
index 039c7ef..7eb1af9 100644
--- a/base/platform_file_unittest.cc
+++ b/base/platform_file_unittest.cc
@@ -37,23 +37,7 @@ int ReadFully(base::PlatformFile file, int64 offset, char* data, int size) {
// Returns the number of bytes written.
int WriteFully(base::PlatformFile file, int64 offset,
const char* data, int size) {
- int total_bytes_written = 0;
- int bytes_written;
- while (total_bytes_written < size) {
- bytes_written = base::WritePlatformFile(
- file, offset + total_bytes_written, &data[total_bytes_written],
- size - total_bytes_written);
-
- if ((bytes_written == 0) && (size == 0))
- return 0;
-
- if ((bytes_written <= 0) || (bytes_written > size - total_bytes_written))
- return -1;
-
- total_bytes_written += bytes_written;
- }
-
- return total_bytes_written;
+ return base::WritePlatformFile(file, offset, data, size);
}
} // namespace