blob: 1e1aca223afe50bdceda1fd203b788d4050d8cb9 [file] [log] [blame]
mukesh agrawal8a3188d2011-12-01 20:56:44 +00001// Copyright (c) 2012 The Chromium OS Authors. All rights reserved.
Chris Masonea82b7112011-05-25 15:16:29 -07002// 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 Masone7aa5f902011-07-11 11:13:35 -070013#include "shill/refptr_types.h"
Chris Masone6515aab2011-10-12 16:19:09 -070014#include "shill/store_interface.h"
Gaurav Shah435de2c2011-11-17 19:01:07 -080015#include "shill/technology.h"
Chris Masone7aa5f902011-07-11 11:13:35 -070016
17using std::string;
Paul Stewart22aa71b2011-09-16 12:15:11 -070018using testing::_;
Chris Masone6791a432011-07-12 13:23:19 -070019using testing::Return;
Chris Masone7aa5f902011-07-11 11:13:35 -070020
Chris Masonea82b7112011-05-25 15:16:29 -070021namespace shill {
22
23class ControlInterface;
24class EventDispatcher;
Chris Masone6791a432011-07-12 13:23:19 -070025class Manager;
Chris Masonea82b7112011-05-25 15:16:29 -070026
Chris Masonea82b7112011-05-25 15:16:29 -070027MockService::MockService(ControlInterface *control_interface,
28 EventDispatcher *dispatcher,
Thieu Le3426c8f2012-01-11 17:35:11 -080029 Metrics *metrics,
mukesh agrawal51a7e932011-07-27 16:18:26 -070030 Manager *manager)
Thieu Le3426c8f2012-01-11 17:35:11 -080031 : Service(control_interface, dispatcher, metrics, manager,
32 Technology::kUnknown) {
Chris Masone6515aab2011-10-12 16:19:09 -070033 const string &id = UniqueName();
34 EXPECT_CALL(*this, GetRpcIdentifier()).WillRepeatedly(Return(id));
35 EXPECT_CALL(*this, GetStorageIdentifier()).WillRepeatedly(Return(id));
Paul Stewart22aa71b2011-09-16 12:15:11 -070036 ON_CALL(*this, state()).WillByDefault(Return(kStateUnknown));
37 ON_CALL(*this, failure()).WillByDefault(Return(kFailureUnknown));
38 ON_CALL(*this, TechnologyIs(_)).WillByDefault(Return(false));
Thieu Le48e6d6d2011-12-06 00:40:27 +000039 ON_CALL(*this, technology()).WillByDefault(Return(Technology::kUnknown));
Chris Masonea82b7112011-05-25 15:16:29 -070040}
41
42MockService::~MockService() {}
43
Chris Masone6515aab2011-10-12 16:19:09 -070044bool MockService::FauxSave(StoreInterface *store) {
45 return store->SetString(UniqueName(), "dummy", "dummy");
46}
47
Chris Masonea82b7112011-05-25 15:16:29 -070048} // namespace shill