Chris Masone | a82b711 | 2011-05-25 15:16:29 -0700 | [diff] [blame] | 1 | // Copyright (c) 2011 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 "shill/mock_service.h" |
| 6 | |
| 7 | #include <string> |
| 8 | |
| 9 | #include <base/memory/ref_counted.h> |
| 10 | #include <base/stringprintf.h> |
| 11 | #include <gmock/gmock.h> |
| 12 | |
Chris Masone | 7aa5f90 | 2011-07-11 11:13:35 -0700 | [diff] [blame] | 13 | #include "shill/refptr_types.h" |
Chris Masone | 6515aab | 2011-10-12 16:19:09 -0700 | [diff] [blame^] | 14 | #include "shill/store_interface.h" |
Chris Masone | 7aa5f90 | 2011-07-11 11:13:35 -0700 | [diff] [blame] | 15 | |
| 16 | using std::string; |
Paul Stewart | 22aa71b | 2011-09-16 12:15:11 -0700 | [diff] [blame] | 17 | using testing::_; |
Chris Masone | 6791a43 | 2011-07-12 13:23:19 -0700 | [diff] [blame] | 18 | using testing::Return; |
Chris Masone | 7aa5f90 | 2011-07-11 11:13:35 -0700 | [diff] [blame] | 19 | |
Chris Masone | a82b711 | 2011-05-25 15:16:29 -0700 | [diff] [blame] | 20 | namespace shill { |
| 21 | |
| 22 | class ControlInterface; |
| 23 | class EventDispatcher; |
Chris Masone | 6791a43 | 2011-07-12 13:23:19 -0700 | [diff] [blame] | 24 | class Manager; |
Chris Masone | a82b711 | 2011-05-25 15:16:29 -0700 | [diff] [blame] | 25 | |
Chris Masone | a82b711 | 2011-05-25 15:16:29 -0700 | [diff] [blame] | 26 | MockService::MockService(ControlInterface *control_interface, |
| 27 | EventDispatcher *dispatcher, |
mukesh agrawal | 51a7e93 | 2011-07-27 16:18:26 -0700 | [diff] [blame] | 28 | Manager *manager) |
mukesh agrawal | 7a4e400 | 2011-09-06 11:26:05 -0700 | [diff] [blame] | 29 | : Service(control_interface, dispatcher, manager, "mock") { |
Chris Masone | 6515aab | 2011-10-12 16:19:09 -0700 | [diff] [blame^] | 30 | const string &id = UniqueName(); |
| 31 | EXPECT_CALL(*this, GetRpcIdentifier()).WillRepeatedly(Return(id)); |
| 32 | EXPECT_CALL(*this, GetStorageIdentifier()).WillRepeatedly(Return(id)); |
Paul Stewart | 22aa71b | 2011-09-16 12:15:11 -0700 | [diff] [blame] | 33 | ON_CALL(*this, state()).WillByDefault(Return(kStateUnknown)); |
| 34 | ON_CALL(*this, failure()).WillByDefault(Return(kFailureUnknown)); |
| 35 | ON_CALL(*this, TechnologyIs(_)).WillByDefault(Return(false)); |
Chris Masone | a82b711 | 2011-05-25 15:16:29 -0700 | [diff] [blame] | 36 | } |
| 37 | |
| 38 | MockService::~MockService() {} |
| 39 | |
Chris Masone | 6515aab | 2011-10-12 16:19:09 -0700 | [diff] [blame^] | 40 | bool MockService::FauxSave(StoreInterface *store) { |
| 41 | return store->SetString(UniqueName(), "dummy", "dummy"); |
| 42 | } |
| 43 | |
Chris Masone | a82b711 | 2011-05-25 15:16:29 -0700 | [diff] [blame] | 44 | } // namespace shill |