mirror of
https://github.com/oxen-io/session-ios.git
synced 2023-12-13 21:30:14 +01:00
We do this by manually managing the RTCAudioSession. Unfortunately to do this we have to include a couple of RTC headers not exported by the default build of WebRTC.framework (see: Libraries/WebRTC) // FREEBIE
36 lines
1.2 KiB
Swift
36 lines
1.2 KiB
Swift
// Copyright © 2017 Open Whisper Systems. All rights reserved.
|
|
//
|
|
|
|
import XCTest
|
|
import AVKit
|
|
import WebRTC
|
|
|
|
/**
|
|
* These tests are obtuse - they just assert the exact implementation of the methods. Normally I wouldn't include them,
|
|
* but these methods make use of a header not included in the standard distribution of the WebRTC.framework. We've
|
|
* included the header in our local project, and test the methods here to make sure that they are still available when
|
|
* we upgrade the framework.
|
|
*
|
|
* If they are failing, it's possible the RTCAudioSession header, and our usage of it, need to be updated.
|
|
*/
|
|
class CallAudioSessionTest: XCTestCase {
|
|
func testAudioSession() {
|
|
|
|
let rtcAudioSession = RTCAudioSession.sharedInstance()
|
|
// Sanity Check
|
|
XCTAssertFalse(rtcAudioSession.useManualAudio)
|
|
|
|
CallAudioSession().configure()
|
|
XCTAssertTrue(rtcAudioSession.useManualAudio)
|
|
XCTAssertFalse(rtcAudioSession.isAudioEnabled)
|
|
|
|
CallAudioSession().start()
|
|
XCTAssertTrue(rtcAudioSession.useManualAudio)
|
|
XCTAssertTrue(rtcAudioSession.isAudioEnabled)
|
|
|
|
CallAudioSession().stop()
|
|
XCTAssertTrue(rtcAudioSession.useManualAudio)
|
|
XCTAssertFalse(rtcAudioSession.isAudioEnabled)
|
|
}
|
|
}
|