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 <gmock/gmock.h> 19 20 #include <memory> 21 22 #include "hci/address.h" 23 #include "hci/le_scanning_manager.h" 24 #include "hci/uuid.h" 25 26 namespace bluetooth { 27 namespace hci { 28 namespace testing { 29 30 class MockScanningCallback : public ScanningCallback { 31 MOCK_METHOD(void, OnScannerRegistered, (const bluetooth::hci::Uuid, ScannerId, ScanningStatus)); 32 MOCK_METHOD(void, OnSetScannerParameterComplete, (ScannerId scanner_id, ScanningStatus status)); 33 MOCK_METHOD( 34 void, 35 OnScanResult, 36 (uint16_t, uint8_t, Address, uint8_t, uint8_t, uint8_t, int8_t, int8_t, uint16_t, std::vector<uint8_t>)); 37 MOCK_METHOD(void, OnTrackAdvFoundLost, (AdvertisingFilterOnFoundOnLostInfo)); 38 MOCK_METHOD(void, OnBatchScanReports, (int, int, int, int, std::vector<uint8_t>)); 39 MOCK_METHOD(void, OnBatchScanThresholdCrossed, (int)); 40 MOCK_METHOD(void, OnTimeout, ()); 41 MOCK_METHOD(void, OnFilterEnable, (Enable, uint8_t)); 42 MOCK_METHOD(void, OnFilterParamSetup, (uint8_t, ApcfAction, uint8_t)); 43 MOCK_METHOD(void, OnFilterConfigCallback, (ApcfFilterType, uint8_t, ApcfAction, uint8_t)); 44 MOCK_METHOD(void, OnPeriodicSyncStarted, (int, uint8_t, uint16_t, uint8_t, AddressWithType, uint8_t, uint16_t)); 45 MOCK_METHOD(void, OnPeriodicSyncReport, (uint16_t, int8_t, int8_t, uint8_t, std::vector<uint8_t>)); 46 MOCK_METHOD(void, OnPeriodicSyncLost, (uint16_t)); 47 MOCK_METHOD(void, OnPeriodicSyncTransferred, (int, uint8_t, Address)); 48 }; 49 50 class MockLeScanningManager : public LeScanningManager { 51 public: 52 MOCK_METHOD(void, RegisterScanner, (const Uuid)); 53 MOCK_METHOD(void, Unregister, (ScannerId)); 54 MOCK_METHOD(void, Scan, (bool)); 55 MOCK_METHOD(void, SetScanParameters, (ScannerId, LeScanType, uint16_t, uint16_t, uint8_t)); 56 MOCK_METHOD(void, ScanFilterEnable, (bool)); 57 MOCK_METHOD(void, ScanFilterParameterSetup, (ApcfAction, uint8_t, AdvertisingFilterParameter)); 58 MOCK_METHOD(void, ScanFilterAdd, (uint8_t, std::vector<AdvertisingPacketContentFilterCommand>)); 59 MOCK_METHOD(void, BatchScanConifgStorage, (uint8_t, uint8_t, uint8_t, ScannerId)); 60 MOCK_METHOD(void, BatchScanEnable, (BatchScanMode, uint32_t, uint32_t, BatchScanDiscardRule)); 61 MOCK_METHOD(void, BatchScanDisable, ()); 62 MOCK_METHOD(void, BatchScanReadReport, (ScannerId, BatchScanMode)); 63 MOCK_METHOD(void, TrackAdvertiser, (uint8_t, ScannerId)); 64 MOCK_METHOD(void, RegisterScanningCallback, (ScanningCallback*)); 65 MOCK_METHOD(void, StartSync, (uint8_t, const AddressWithType&, uint16_t, uint16_t, int)); 66 MOCK_METHOD(void, StopSync, (uint16_t)); 67 MOCK_METHOD(void, CancelCreateSync, (uint8_t, const Address&)); 68 MOCK_METHOD( 69 void, 70 TransferSync, 71 (const Address&, 72 uint16_t connection_handle, 73 uint16_t service_data, 74 uint16_t sync_handle, 75 int pa_source)); 76 MOCK_METHOD( 77 void, 78 TransferSetInfo, 79 (const Address&, uint16_t connection_handle, uint16_t service_data, uint8_t, int)); 80 MOCK_METHOD(void, SyncTxParameters, (const Address&, uint8_t, uint16_t, uint16_t, int)); 81 }; 82 83 } // namespace testing 84 } // namespace hci 85 } // namespace bluetooth 86