Peter Qiu | 7751730 | 2015-01-08 16:22:16 -0800 | [diff] [blame] | 1 | // Copyright 2015 The Chromium OS Authors. All rights reserved. |
| 2 | // Use of this source code is governed by a BSD-style license that can be |
| 3 | // found in the LICENSE file. |
| 4 | |
| 5 | #ifndef APMANAGER_MOCK_FILE_WRITER_H_ |
| 6 | #define APMANAGER_MOCK_FILE_WRITER_H_ |
| 7 | |
| 8 | #include <string> |
| 9 | |
| 10 | #include <base/lazy_instance.h> |
| 11 | #include <gmock/gmock.h> |
| 12 | |
| 13 | #include "apmanager/file_writer.h" |
| 14 | |
| 15 | namespace apmanager { |
| 16 | |
| 17 | class MockFileWriter : public FileWriter { |
| 18 | public: |
| 19 | ~MockFileWriter() override; |
| 20 | |
| 21 | // This is a singleton. Use MockFileWriter::GetInstance()->Foo(). |
| 22 | static MockFileWriter* GetInstance(); |
| 23 | |
| 24 | MOCK_METHOD2(Write, bool(const std::string& file_name, |
| 25 | const std::string& content)); |
| 26 | |
| 27 | protected: |
| 28 | MockFileWriter(); |
| 29 | |
| 30 | private: |
| 31 | friend struct base::DefaultLazyInstanceTraits<MockFileWriter>; |
| 32 | |
| 33 | DISALLOW_COPY_AND_ASSIGN(MockFileWriter); |
| 34 | }; |
| 35 | |
| 36 | } // namespace apmanager |
| 37 | |
| 38 | #endif // APMANAGER_MOCK_FILE_WRITER_H_ |