-
Notifications
You must be signed in to change notification settings - Fork 205
/
UserAgentSpy.swift
60 lines (49 loc) · 1.74 KB
/
UserAgentSpy.swift
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
//
// UserAgentSpy.swift
// Telephone
//
// Copyright © 2008-2016 Alexey Kuznetsov
// Copyright © 2016-2018 64 Characters
//
// Telephone is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// Telephone is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
import Domain
import UseCases
public final class UserAgentSpy {
public var isStarted = false
public var maxCalls = 0
public var didCallStart = false
public private(set) var didCallAudioDevices = false
public var audioDevicesResult = [UserAgentAudioDevice]()
public private(set) var didCallUpdateAudioDevices = false
public private(set) var soundIOSelectionCallCount = 0
public var didSelectSoundIO: Bool { return soundIOSelectionCallCount > 0 }
public private(set) var invokedInputDeviceID: Int?
public private(set) var invokedOutputDeviceID: Int?
public init() {}
}
extension UserAgentSpy: UserAgent {
public func start() {
didCallStart = true
}
public func audioDevices() throws -> [UserAgentAudioDevice] {
didCallAudioDevices = true
return audioDevicesResult
}
public func updateAudioDevices() {
didCallUpdateAudioDevices = true
}
public func selectSoundIODeviceIDs(input: Int, output: Int) throws {
soundIOSelectionCallCount += 1
invokedInputDeviceID = input
invokedOutputDeviceID = output
}
}