Mike Frysinger | 1dad097 | 2019-02-23 18:36:37 -0500 | [diff] [blame] | 1 | // Copyright 2019 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 | #include "dev-install/dev_install.h" |
| 6 | |
| 7 | #include <gmock/gmock.h> |
| 8 | #include <gtest/gtest.h> |
| 9 | |
| 10 | using ::testing::_; |
| 11 | using ::testing::Return; |
| 12 | |
| 13 | namespace dev_install { |
| 14 | |
| 15 | namespace { |
| 16 | |
| 17 | class DevInstallMock : public DevInstall { |
| 18 | public: |
| 19 | MOCK_METHOD1(Exec, int(const std::vector<const char*>&)); |
| 20 | }; |
| 21 | |
| 22 | class DevInstallTest : public ::testing::Test { |
| 23 | protected: |
| 24 | DevInstallMock dev_install_; |
| 25 | }; |
| 26 | |
| 27 | } // namespace |
| 28 | |
| 29 | // Check default run through. |
| 30 | TEST_F(DevInstallTest, Run) { |
| 31 | EXPECT_CALL(dev_install_, Exec(_)).WillOnce(Return(1234)); |
| 32 | EXPECT_EQ(1234, dev_install_.Run()); |
| 33 | } |
| 34 | |
| 35 | } // namespace dev_install |