session-ios/Signal/test/call/CallAudioSessionTest.swift
Michael Kirk dbb29d7d7e Don't require recording permissions until call is ringing.
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
2017-01-17 21:49:13 -05:00

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)
}
}