| mukesh agrawal | 8a3188d | 2011-12-01 20:56:44 +0000 | [diff] [blame] | 1 | // Copyright (c) 2012 The Chromium OS Authors. All rights reserved. |
| Chris Masone | a82b711 | 2011-05-25 15:16:29 -0700 | [diff] [blame] | 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, |
| Thieu Le | 3426c8f | 2012-01-11 17:35:11 -0800 | [diff] [blame^] | 29 | Metrics *metrics, |
| mukesh agrawal | 51a7e93 | 2011-07-27 16:18:26 -0700 | [diff] [blame] | 30 | Manager *manager) |
| Thieu Le | 3426c8f | 2012-01-11 17:35:11 -0800 | [diff] [blame^] | 31 | : Service(control_interface, dispatcher, metrics, manager, |
| 32 | Technology::kUnknown) { |
| Chris Masone | 6515aab | 2011-10-12 16:19:09 -0700 | [diff] [blame] | 33 | const string &id = UniqueName(); |
| 34 | EXPECT_CALL(*this, GetRpcIdentifier()).WillRepeatedly(Return(id)); |
| 35 | EXPECT_CALL(*this, GetStorageIdentifier()).WillRepeatedly(Return(id)); |
| Paul Stewart | 22aa71b | 2011-09-16 12:15:11 -0700 | [diff] [blame] | 36 | ON_CALL(*this, state()).WillByDefault(Return(kStateUnknown)); |
| 37 | ON_CALL(*this, failure()).WillByDefault(Return(kFailureUnknown)); |
| 38 | ON_CALL(*this, TechnologyIs(_)).WillByDefault(Return(false)); |
| Thieu Le | 48e6d6d | 2011-12-06 00:40:27 +0000 | [diff] [blame] | 39 | ON_CALL(*this, technology()).WillByDefault(Return(Technology::kUnknown)); |
| Chris Masone | a82b711 | 2011-05-25 15:16:29 -0700 | [diff] [blame] | 40 | } |
| 41 | |
| 42 | MockService::~MockService() {} |
| 43 | |
| Chris Masone | 6515aab | 2011-10-12 16:19:09 -0700 | [diff] [blame] | 44 | bool MockService::FauxSave(StoreInterface *store) { |
| 45 | return store->SetString(UniqueName(), "dummy", "dummy"); |
| 46 | } |
| 47 | |
| Chris Masone | a82b711 | 2011-05-25 15:16:29 -0700 | [diff] [blame] | 48 | } // namespace shill |