blob: e04038c28773f378505f992294d28551207e31ec [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;
Paul Stewartce4ec192012-03-14 12:53:46 -070020using testing::ReturnRef;
Chris Masone7aa5f902011-07-11 11:13:35 -070021
Chris Masonea82b7112011-05-25 15:16:29 -070022namespace shill {
23
24class ControlInterface;
25class EventDispatcher;
Chris Masone6791a432011-07-12 13:23:19 -070026class Manager;
Chris Masonea82b7112011-05-25 15:16:29 -070027
Chris Masonea82b7112011-05-25 15:16:29 -070028MockService::MockService(ControlInterface *control_interface,
29 EventDispatcher *dispatcher,
Thieu Le3426c8f2012-01-11 17:35:11 -080030 Metrics *metrics,
mukesh agrawal51a7e932011-07-27 16:18:26 -070031 Manager *manager)
Thieu Le3426c8f2012-01-11 17:35:11 -080032 : Service(control_interface, dispatcher, metrics, manager,
33 Technology::kUnknown) {
Chris Masone6515aab2011-10-12 16:19:09 -070034 const string &id = UniqueName();
35 EXPECT_CALL(*this, GetRpcIdentifier()).WillRepeatedly(Return(id));
36 EXPECT_CALL(*this, GetStorageIdentifier()).WillRepeatedly(Return(id));
Paul Stewart22aa71b2011-09-16 12:15:11 -070037 ON_CALL(*this, state()).WillByDefault(Return(kStateUnknown));
38 ON_CALL(*this, failure()).WillByDefault(Return(kFailureUnknown));
39 ON_CALL(*this, TechnologyIs(_)).WillByDefault(Return(false));
Thieu Le48e6d6d2011-12-06 00:40:27 +000040 ON_CALL(*this, technology()).WillByDefault(Return(Technology::kUnknown));
Paul Stewartce4ec192012-03-14 12:53:46 -070041 ON_CALL(*this, connection()).WillByDefault(ReturnRef(mock_connection_));
Chris Masonea82b7112011-05-25 15:16:29 -070042}
43
44MockService::~MockService() {}
45
Chris Masone6515aab2011-10-12 16:19:09 -070046bool MockService::FauxSave(StoreInterface *store) {
Paul Stewart1b253142012-01-26 14:05:52 -080047 return store->SetString(GetStorageIdentifier(), "dummy", "dummy");
Chris Masone6515aab2011-10-12 16:19:09 -070048}
49
Chris Masonea82b7112011-05-25 15:16:29 -070050} // namespace shill