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