Thieu Le | 3426c8f | 2012-01-11 17:35:11 -0800 | [diff] [blame] | 1 | // Copyright (c) 2012 The Chromium OS Authors. All rights reserved. |
Chris Masone | 6515aab | 2011-10-12 16:19:09 -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 <string> |
Paul Stewart | 99dc9f3 | 2013-06-27 07:39:25 -0700 | [diff] [blame] | 6 | #include <vector> |
Chris Masone | 6515aab | 2011-10-12 16:19:09 -0700 | [diff] [blame] | 7 | |
| 8 | #include "shill/service.h" |
| 9 | |
| 10 | namespace shill { |
| 11 | |
| 12 | class ControlInterface; |
| 13 | class Error; |
| 14 | class EventDispatcher; |
| 15 | class Manager; |
Thieu Le | 3426c8f | 2012-01-11 17:35:11 -0800 | [diff] [blame] | 16 | class Metrics; |
Chris Masone | 6515aab | 2011-10-12 16:19:09 -0700 | [diff] [blame] | 17 | |
Paul Stewart | 99dc9f3 | 2013-06-27 07:39:25 -0700 | [diff] [blame] | 18 | // This is a simple Service subclass with all the pure-virtual methods stubbed. |
Chris Masone | 6515aab | 2011-10-12 16:19:09 -0700 | [diff] [blame] | 19 | class ServiceUnderTest : public Service { |
| 20 | public: |
| 21 | static const char kRpcId[]; |
Paul Stewart | 99dc9f3 | 2013-06-27 07:39:25 -0700 | [diff] [blame] | 22 | static const char kStringsProperty[]; |
Chris Masone | 6515aab | 2011-10-12 16:19:09 -0700 | [diff] [blame] | 23 | static const char kStorageId[]; |
| 24 | |
| 25 | ServiceUnderTest(ControlInterface *control_interface, |
| 26 | EventDispatcher *dispatcher, |
Thieu Le | 3426c8f | 2012-01-11 17:35:11 -0800 | [diff] [blame] | 27 | Metrics *metrics, |
Chris Masone | 6515aab | 2011-10-12 16:19:09 -0700 | [diff] [blame] | 28 | Manager *manager); |
| 29 | virtual ~ServiceUnderTest(); |
| 30 | |
Chris Masone | 6515aab | 2011-10-12 16:19:09 -0700 | [diff] [blame] | 31 | virtual std::string GetRpcIdentifier() const; |
Hristo Stefanov | ed2c28c | 2011-11-29 15:37:30 -0800 | [diff] [blame] | 32 | virtual std::string GetDeviceRpcId(Error *error); |
Chris Masone | 6515aab | 2011-10-12 16:19:09 -0700 | [diff] [blame] | 33 | virtual std::string GetStorageIdentifier() const; |
| 34 | |
Paul Stewart | 99dc9f3 | 2013-06-27 07:39:25 -0700 | [diff] [blame] | 35 | // Getter and setter for a string array property for use in testing. |
| 36 | void set_strings(const std::vector<std::string> &strings) { |
| 37 | strings_ = strings; |
| 38 | } |
| 39 | const std::vector<std::string> &strings() const { return strings_; } |
| 40 | |
Chris Masone | 6515aab | 2011-10-12 16:19:09 -0700 | [diff] [blame] | 41 | private: |
Paul Stewart | 99dc9f3 | 2013-06-27 07:39:25 -0700 | [diff] [blame] | 42 | // The Service superclass has no string array properties but we need one |
| 43 | // in order to test Service::Configure. |
| 44 | std::vector<std::string> strings_; |
| 45 | |
Chris Masone | 6515aab | 2011-10-12 16:19:09 -0700 | [diff] [blame] | 46 | DISALLOW_COPY_AND_ASSIGN(ServiceUnderTest); |
| 47 | }; |
| 48 | |
| 49 | } // namespace shill |