32 lines
1.1 KiB
Swift
32 lines
1.1 KiB
Swift
// Copyright 2013 The Flutter Authors
|
|
// Use of this source code is governed by a BSD-style license that can be
|
|
// found in the LICENSE file.
|
|
|
|
import Flutter
|
|
|
|
@testable import camera_avfoundation
|
|
|
|
final class MockCameraPermissionManager: CameraPermissionManager {
|
|
var requestCameraPermissionStub: ((@escaping CameraPermissionRequestCompletionHandler) -> Void)?
|
|
var requestAudioPermissionStub: ((@escaping CameraPermissionRequestCompletionHandler) -> Void)?
|
|
|
|
init() {
|
|
super.init(permissionService: DefaultPermissionService())
|
|
}
|
|
|
|
override func requestCameraPermission(completionHandler: @escaping (PigeonError?) -> Void) {
|
|
if let stub = requestCameraPermissionStub {
|
|
stub(completionHandler)
|
|
} else {
|
|
super.requestCameraPermission(completionHandler: completionHandler)
|
|
}
|
|
}
|
|
|
|
override func requestAudioPermission(completionHandler: @escaping (PigeonError?) -> Void) {
|
|
if let stub = requestAudioPermissionStub {
|
|
stub(completionHandler)
|
|
} else {
|
|
super.requestAudioPermission(completionHandler: completionHandler)
|
|
}
|
|
}
|
|
}
|