1 /* 2 * Copyright 2019 The Android Open Source Project 3 * 4 * Licensed under the Apache License, Version 2.0 (the "License"); 5 * you may not use this file except in compliance with the License. 6 * You may obtain a copy of the License at 7 * 8 * http://www.apache.org/licenses/LICENSE-2.0 9 * 10 * Unless required by applicable law or agreed to in writing, software 11 * distributed under the License is distributed on an "AS IS" BASIS, 12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 * See the License for the specific language governing permissions and 14 * limitations under the License. 15 */ 16 #pragma once 17 18 #include "hci/acl_manager_mock.h" 19 #include "hci/address_with_type.h" 20 #include "l2cap/internal/scheduler_mock.h" 21 #include "l2cap/le/internal/link.h" 22 23 #include <gmock/gmock.h> 24 25 // Unit test interfaces 26 namespace bluetooth { 27 namespace l2cap { 28 namespace le { 29 namespace internal { 30 namespace testing { 31 32 using hci::testing::MockLeAclConnection; 33 34 class MockLink : public Link { 35 public: MockLink(os::Handler * handler,l2cap::internal::ParameterProvider * parameter_provider,std::unique_ptr<MockLeAclConnection> mock_acl_connection,LinkManager * link_manager)36 explicit MockLink(os::Handler* handler, l2cap::internal::ParameterProvider* parameter_provider, 37 std::unique_ptr<MockLeAclConnection> mock_acl_connection, LinkManager* link_manager) 38 : Link(handler, std::move(mock_acl_connection), parameter_provider, nullptr, nullptr, link_manager) {} 39 40 MOCK_METHOD(hci::AddressWithType, GetDevice, (), (const, override)); 41 MOCK_METHOD(hci::Role, GetRole, (), (override)); 42 MOCK_METHOD(void, OnAclDisconnected, (hci::ErrorCode status), (override)); 43 MOCK_METHOD(void, Disconnect, (), (override)); 44 MOCK_METHOD(std::shared_ptr<FixedChannelImpl>, AllocateFixedChannel, (Cid cid, SecurityPolicy security_policy), 45 (override)); 46 MOCK_METHOD(bool, IsFixedChannelAllocated, (Cid cid), (override)); 47 MOCK_METHOD(void, RefreshRefCount, (), (override)); 48 }; 49 50 } // namespace testing 51 } // namespace internal 52 } // namespace le 53 } // namespace l2cap 54 } // namespace bluetooth 55