1c0beca55d290fe0b1c96d78cbbcf94b05c23f5a5Peter Qiu// 2c0beca55d290fe0b1c96d78cbbcf94b05c23f5a5Peter Qiu// Copyright (C) 2012 The Android Open Source Project 3c0beca55d290fe0b1c96d78cbbcf94b05c23f5a5Peter Qiu// 4c0beca55d290fe0b1c96d78cbbcf94b05c23f5a5Peter Qiu// Licensed under the Apache License, Version 2.0 (the "License"); 5c0beca55d290fe0b1c96d78cbbcf94b05c23f5a5Peter Qiu// you may not use this file except in compliance with the License. 6c0beca55d290fe0b1c96d78cbbcf94b05c23f5a5Peter Qiu// You may obtain a copy of the License at 7c0beca55d290fe0b1c96d78cbbcf94b05c23f5a5Peter Qiu// 8c0beca55d290fe0b1c96d78cbbcf94b05c23f5a5Peter Qiu// http://www.apache.org/licenses/LICENSE-2.0 9c0beca55d290fe0b1c96d78cbbcf94b05c23f5a5Peter Qiu// 10c0beca55d290fe0b1c96d78cbbcf94b05c23f5a5Peter Qiu// Unless required by applicable law or agreed to in writing, software 11c0beca55d290fe0b1c96d78cbbcf94b05c23f5a5Peter Qiu// distributed under the License is distributed on an "AS IS" BASIS, 12c0beca55d290fe0b1c96d78cbbcf94b05c23f5a5Peter Qiu// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13c0beca55d290fe0b1c96d78cbbcf94b05c23f5a5Peter Qiu// See the License for the specific language governing permissions and 14c0beca55d290fe0b1c96d78cbbcf94b05c23f5a5Peter Qiu// limitations under the License. 15c0beca55d290fe0b1c96d78cbbcf94b05c23f5a5Peter Qiu// 16a82b7111f2b0515a8d79e6e8034836a5d1342468Chris Masone 17a82b7111f2b0515a8d79e6e8034836a5d1342468Chris Masone#include "shill/mock_service.h" 18a82b7111f2b0515a8d79e6e8034836a5d1342468Chris Masone 19a82b7111f2b0515a8d79e6e8034836a5d1342468Chris Masone#include <string> 20a82b7111f2b0515a8d79e6e8034836a5d1342468Chris Masone 21a82b7111f2b0515a8d79e6e8034836a5d1342468Chris Masone#include <base/memory/ref_counted.h> 22a0ddf46e466bd4ba3d20952f0a6988c680c1af14Ben Chan#include <base/strings/stringprintf.h> 23a82b7111f2b0515a8d79e6e8034836a5d1342468Chris Masone#include <gmock/gmock.h> 24a82b7111f2b0515a8d79e6e8034836a5d1342468Chris Masone 257aa5f90848b530999d8b6788ecb40aa30871c7aeChris Masone#include "shill/refptr_types.h" 266515aabcd1fbbb9ff2090c9675c17eeef64e7474Chris Masone#include "shill/store_interface.h" 27435de2cd55a95836381b53acbce8cbbad98ec04dGaurav Shah#include "shill/technology.h" 287aa5f90848b530999d8b6788ecb40aa30871c7aeChris Masone 297aa5f90848b530999d8b6788ecb40aa30871c7aeChris Masoneusing std::string; 3022aa71b334c716f20999c2e08e5b797207b0afaePaul Stewartusing testing::_; 316791a43add38926966bd420e89541717fb2cb2b5Chris Masoneusing testing::Return; 32ce4ec19216ccd15ae349ee42498657afc2c75bd8Paul Stewartusing testing::ReturnRef; 337aa5f90848b530999d8b6788ecb40aa30871c7aeChris Masone 34a82b7111f2b0515a8d79e6e8034836a5d1342468Chris Masonenamespace shill { 35a82b7111f2b0515a8d79e6e8034836a5d1342468Chris Masone 36a82b7111f2b0515a8d79e6e8034836a5d1342468Chris Masoneclass ControlInterface; 37a82b7111f2b0515a8d79e6e8034836a5d1342468Chris Masoneclass EventDispatcher; 386791a43add38926966bd420e89541717fb2cb2b5Chris Masoneclass Manager; 39a82b7111f2b0515a8d79e6e8034836a5d1342468Chris Masone 401e006c610db980bca337121134d2ba54497b7a59Paul StewartMockService::MockService(ControlInterface* control_interface, 411e006c610db980bca337121134d2ba54497b7a59Paul Stewart EventDispatcher* dispatcher, 421e006c610db980bca337121134d2ba54497b7a59Paul Stewart Metrics* metrics, 431e006c610db980bca337121134d2ba54497b7a59Paul Stewart Manager* manager) 443426c8fc7a3943f2d8fcb2ec78f0593088b42bedThieu Le : Service(control_interface, dispatcher, metrics, manager, 453426c8fc7a3943f2d8fcb2ec78f0593088b42bedThieu Le Technology::kUnknown) { 461e006c610db980bca337121134d2ba54497b7a59Paul Stewart const string& id = unique_name(); 476515aabcd1fbbb9ff2090c9675c17eeef64e7474Chris Masone EXPECT_CALL(*this, GetRpcIdentifier()).WillRepeatedly(Return(id)); 486515aabcd1fbbb9ff2090c9675c17eeef64e7474Chris Masone EXPECT_CALL(*this, GetStorageIdentifier()).WillRepeatedly(Return(id)); 49bfb825563ecdf282162dfb4e43ded89c99b0fbb5Paul Stewart ON_CALL(*this, IsVisible()).WillByDefault(Return(true)); 5022aa71b334c716f20999c2e08e5b797207b0afaePaul Stewart ON_CALL(*this, state()).WillByDefault(Return(kStateUnknown)); 5122aa71b334c716f20999c2e08e5b797207b0afaePaul Stewart ON_CALL(*this, failure()).WillByDefault(Return(kFailureUnknown)); 5248e6d6d0ec0f90d9b2206f60c1ff2a825c5ce9c1Thieu Le ON_CALL(*this, technology()).WillByDefault(Return(Technology::kUnknown)); 53ce4ec19216ccd15ae349ee42498657afc2c75bd8Paul Stewart ON_CALL(*this, connection()).WillByDefault(ReturnRef(mock_connection_)); 54a82b7111f2b0515a8d79e6e8034836a5d1342468Chris Masone} 55a82b7111f2b0515a8d79e6e8034836a5d1342468Chris Masone 56a82b7111f2b0515a8d79e6e8034836a5d1342468Chris MasoneMockService::~MockService() {} 57a82b7111f2b0515a8d79e6e8034836a5d1342468Chris Masone 581e006c610db980bca337121134d2ba54497b7a59Paul Stewartbool MockService::FauxSave(StoreInterface* store) { 591b2531423a15ccc5ac5acaf09edac9a687902dfaPaul Stewart return store->SetString(GetStorageIdentifier(), "dummy", "dummy"); 606515aabcd1fbbb9ff2090c9675c17eeef64e7474Chris Masone} 616515aabcd1fbbb9ff2090c9675c17eeef64e7474Chris Masone 62a82b7111f2b0515a8d79e6e8034836a5d1342468Chris Masone} // namespace shill 63