AU: Speed up updates by using buffered writes.
Given that SSD writes are really slow, this improves performance significantly.
This reduces update time on AGZ from 375 to 100 seconds.
BUG=6901
TEST=unit tests, gmerged on device and measured speed
Change-Id: Idac7743f6eaa8f26878a2d1f6b9401513e2ca600
Review URL: http://codereview.chromium.org/3471006
diff --git a/file_writer_mock.h b/file_writer_mock.h
new file mode 100644
index 0000000..004c3b1
--- /dev/null
+++ b/file_writer_mock.h
@@ -0,0 +1,22 @@
+// Copyright (c) 2010 The Chromium OS Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef CHROMEOS_PLATFORM_UPDATE_ENGINE_FILE_WRITER_MOCK_H__
+#define CHROMEOS_PLATFORM_UPDATE_ENGINE_FILE_WRITER_MOCK_H__
+
+#include "gmock/gmock.h"
+#include "update_engine/file_writer.h"
+
+namespace chromeos_update_engine {
+
+class FileWriterMock : public FileWriter {
+ public:
+ MOCK_METHOD3(Open, int(const char* path, int flags, mode_t mode));
+ MOCK_METHOD2(Write, ssize_t(const void* bytes, size_t count));
+ MOCK_METHOD0(Close, int());
+};
+
+} // namespace chromeos_update_engine
+
+#endif // CHROMEOS_PLATFORM_UPDATE_ENGINE_FILE_WRITER_MOCK_H__