update_engine: Standarize mock/fake filenames.

Mock classes implement mostly MOCK_METHOD* methods used with gmock.
Those classes should be named with the prefix "Mock" in the class
name and "mock_" in the header filename.

Fake classes implement a working version of the interface they provide,
often with extra functionality to change their behavior. Those classes
should be prefixed with "Fake" in the class name and "fake_" in the
file name.

Other minor include order fixes are included in this patch.

BUG=None
TEST=Unittest still pass.

Change-Id: I23de7cb11e25182d5855afacca47d431c97b82bb
Reviewed-on: https://chromium-review.googlesource.com/227779
Reviewed-by: Alex Deymo <deymo@chromium.org>
Commit-Queue: Alex Deymo <deymo@chromium.org>
Tested-by: Alex Deymo <deymo@chromium.org>
diff --git a/mock_file_writer.h b/mock_file_writer.h
index 5231e40..65a5531 100644
--- a/mock_file_writer.h
+++ b/mock_file_writer.h
@@ -1,61 +1,20 @@
-// Copyright (c) 2009 The Chromium OS Authors. All rights reserved.
+// 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 UPDATE_ENGINE_MOCK_FILE_WRITER_H_
 #define UPDATE_ENGINE_MOCK_FILE_WRITER_H_
 
-#include <vector>
-
-#include <base/macros.h>
-
+#include <gmock/gmock.h>
 #include "update_engine/file_writer.h"
 
-// MockFileWriter is an implementation of FileWriter. It will succeed
-// calls to Open(), Close(), but not do any work. All calls to Write()
-// will append the passed data to an internal vector.
-
 namespace chromeos_update_engine {
 
 class MockFileWriter : public FileWriter {
  public:
-  MockFileWriter() : was_opened_(false), was_closed_(false) {}
-
-  virtual int Open(const char* path, int flags, mode_t mode) {
-    CHECK(!was_opened_);
-    CHECK(!was_closed_);
-    was_opened_ = true;
-    return 0;
-  }
-
-  virtual ssize_t Write(const void* bytes, size_t count) {
-    CHECK(was_opened_);
-    CHECK(!was_closed_);
-    const char* char_bytes = reinterpret_cast<const char*>(bytes);
-    bytes_.insert(bytes_.end(), char_bytes, char_bytes + count);
-    return count;
-  }
-
-  virtual int Close() {
-    CHECK(was_opened_);
-    CHECK(!was_closed_);
-    was_closed_ = true;
-    return 0;
-  }
-
-  const std::vector<char>& bytes() {
-    return bytes_;
-  }
-
- private:
-  // The internal store of all bytes that have been written
-  std::vector<char> bytes_;
-
-  // These are just to ensure FileWriter methods are called properly.
-  bool was_opened_;
-  bool was_closed_;
-
-  DISALLOW_COPY_AND_ASSIGN(MockFileWriter);
+  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