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; |
Paul Stewart | ce4ec19 | 2012-03-14 12:53:46 -0700 | [diff] [blame] | 20 | using testing::ReturnRef; |
Chris Masone | 7aa5f90 | 2011-07-11 11:13:35 -0700 | [diff] [blame] | 21 | |
Chris Masone | a82b711 | 2011-05-25 15:16:29 -0700 | [diff] [blame] | 22 | namespace shill { |
| 23 | |
| 24 | class ControlInterface; |
| 25 | class EventDispatcher; |
Chris Masone | 6791a43 | 2011-07-12 13:23:19 -0700 | [diff] [blame] | 26 | class Manager; |
Chris Masone | a82b711 | 2011-05-25 15:16:29 -0700 | [diff] [blame] | 27 | |
Chris Masone | a82b711 | 2011-05-25 15:16:29 -0700 | [diff] [blame] | 28 | MockService::MockService(ControlInterface *control_interface, |
| 29 | EventDispatcher *dispatcher, |
Thieu Le | 3426c8f | 2012-01-11 17:35:11 -0800 | [diff] [blame] | 30 | Metrics *metrics, |
mukesh agrawal | 51a7e93 | 2011-07-27 16:18:26 -0700 | [diff] [blame] | 31 | Manager *manager) |
Thieu Le | 3426c8f | 2012-01-11 17:35:11 -0800 | [diff] [blame] | 32 | : Service(control_interface, dispatcher, metrics, manager, |
| 33 | Technology::kUnknown) { |
Chris Masone | 6515aab | 2011-10-12 16:19:09 -0700 | [diff] [blame] | 34 | const string &id = UniqueName(); |
| 35 | EXPECT_CALL(*this, GetRpcIdentifier()).WillRepeatedly(Return(id)); |
| 36 | EXPECT_CALL(*this, GetStorageIdentifier()).WillRepeatedly(Return(id)); |
Paul Stewart | 22aa71b | 2011-09-16 12:15:11 -0700 | [diff] [blame] | 37 | ON_CALL(*this, state()).WillByDefault(Return(kStateUnknown)); |
| 38 | ON_CALL(*this, failure()).WillByDefault(Return(kFailureUnknown)); |
| 39 | ON_CALL(*this, TechnologyIs(_)).WillByDefault(Return(false)); |
Thieu Le | 48e6d6d | 2011-12-06 00:40:27 +0000 | [diff] [blame] | 40 | ON_CALL(*this, technology()).WillByDefault(Return(Technology::kUnknown)); |
Paul Stewart | ce4ec19 | 2012-03-14 12:53:46 -0700 | [diff] [blame] | 41 | ON_CALL(*this, connection()).WillByDefault(ReturnRef(mock_connection_)); |
Chris Masone | a82b711 | 2011-05-25 15:16:29 -0700 | [diff] [blame] | 42 | } |
| 43 | |
| 44 | MockService::~MockService() {} |
| 45 | |
Chris Masone | 6515aab | 2011-10-12 16:19:09 -0700 | [diff] [blame] | 46 | bool MockService::FauxSave(StoreInterface *store) { |
Paul Stewart | 1b25314 | 2012-01-26 14:05:52 -0800 | [diff] [blame] | 47 | return store->SetString(GetStorageIdentifier(), "dummy", "dummy"); |
Chris Masone | 6515aab | 2011-10-12 16:19:09 -0700 | [diff] [blame] | 48 | } |
| 49 | |
Chris Masone | a82b711 | 2011-05-25 15:16:29 -0700 | [diff] [blame] | 50 | } // namespace shill |