tkchin | 0ce3bf9 | 2016-03-12 16:52:04 -0800 | [diff] [blame] | 1 | /* |
| 2 | * Copyright 2016 The WebRTC project authors. All Rights Reserved. |
| 3 | * |
| 4 | * Use of this source code is governed by a BSD-style license |
| 5 | * that can be found in the LICENSE file in the root of the source |
| 6 | * tree. An additional intellectual property rights grant can be found |
| 7 | * in the file PATENTS. All contributing project authors may |
| 8 | * be found in the AUTHORS file in the root of the source tree. |
| 9 | */ |
| 10 | |
| 11 | #import <Foundation/Foundation.h> |
jtteh | f84c1d6 | 2017-04-21 13:56:39 -0700 | [diff] [blame] | 12 | #import <OCMock/OCMock.h> |
tkchin | 0ce3bf9 | 2016-03-12 16:52:04 -0800 | [diff] [blame] | 13 | |
Joe Chen | 0b3a6e3 | 2019-12-26 23:01:42 -0800 | [diff] [blame] | 14 | #include <vector> |
| 15 | |
Mirko Bonadei | 92ea95e | 2017-09-15 06:47:31 +0200 | [diff] [blame] | 16 | #include "rtc_base/gunit.h" |
tkchin | 0ce3bf9 | 2016-03-12 16:52:04 -0800 | [diff] [blame] | 17 | |
Anders Carlsson | 7bca8ca | 2018-08-30 09:30:29 +0200 | [diff] [blame] | 18 | #import "components/audio/RTCAudioSession+Private.h" |
denicija | 59ee91b | 2017-06-05 05:48:47 -0700 | [diff] [blame] | 19 | |
Anders Carlsson | 7bca8ca | 2018-08-30 09:30:29 +0200 | [diff] [blame] | 20 | #import "components/audio/RTCAudioSession.h" |
| 21 | #import "components/audio/RTCAudioSessionConfiguration.h" |
tkchin | e54467f | 2016-03-15 16:54:03 -0700 | [diff] [blame] | 22 | |
Mirko Bonadei | a81e9c8 | 2020-05-04 16:14:32 +0200 | [diff] [blame^] | 23 | @interface RTC_OBJC_TYPE (RTCAudioSession) |
| 24 | (UnitTesting) |
Peter Hanspers | 4721736 | 2017-10-05 11:39:15 +0200 | [diff] [blame] | 25 | |
Mirko Bonadei | a81e9c8 | 2020-05-04 16:14:32 +0200 | [diff] [blame^] | 26 | @property(nonatomic, |
| 27 | readonly) std::vector<__weak id<RTC_OBJC_TYPE(RTCAudioSessionDelegate)> > delegates; |
Joe Chen | 0b3a6e3 | 2019-12-26 23:01:42 -0800 | [diff] [blame] | 28 | |
Peter Hanspers | 4721736 | 2017-10-05 11:39:15 +0200 | [diff] [blame] | 29 | - (instancetype)initWithAudioSession:(id)audioSession; |
| 30 | |
| 31 | @end |
| 32 | |
| 33 | @interface MockAVAudioSession : NSObject |
| 34 | |
| 35 | @property (nonatomic, readwrite, assign) float outputVolume; |
| 36 | |
| 37 | @end |
| 38 | |
| 39 | @implementation MockAVAudioSession |
| 40 | @synthesize outputVolume = _outputVolume; |
| 41 | @end |
| 42 | |
Mirko Bonadei | a81e9c8 | 2020-05-04 16:14:32 +0200 | [diff] [blame^] | 43 | @interface RTCAudioSessionTestDelegate : NSObject <RTC_OBJC_TYPE (RTCAudioSessionDelegate)> |
jtteh | 13ae11a | 2017-05-25 17:52:20 -0700 | [diff] [blame] | 44 | |
| 45 | @property (nonatomic, readonly) float outputVolume; |
| 46 | |
tkchin | e54467f | 2016-03-15 16:54:03 -0700 | [diff] [blame] | 47 | @end |
| 48 | |
| 49 | @implementation RTCAudioSessionTestDelegate |
| 50 | |
jtteh | 13ae11a | 2017-05-25 17:52:20 -0700 | [diff] [blame] | 51 | @synthesize outputVolume = _outputVolume; |
| 52 | |
| 53 | - (instancetype)init { |
| 54 | if (self = [super init]) { |
| 55 | _outputVolume = -1; |
| 56 | } |
| 57 | return self; |
| 58 | } |
| 59 | |
Mirko Bonadei | a81e9c8 | 2020-05-04 16:14:32 +0200 | [diff] [blame^] | 60 | - (void)audioSessionDidBeginInterruption:(RTC_OBJC_TYPE(RTCAudioSession) *)session { |
tkchin | e54467f | 2016-03-15 16:54:03 -0700 | [diff] [blame] | 61 | } |
| 62 | |
Mirko Bonadei | a81e9c8 | 2020-05-04 16:14:32 +0200 | [diff] [blame^] | 63 | - (void)audioSessionDidEndInterruption:(RTC_OBJC_TYPE(RTCAudioSession) *)session |
tkchin | e54467f | 2016-03-15 16:54:03 -0700 | [diff] [blame] | 64 | shouldResumeSession:(BOOL)shouldResumeSession { |
| 65 | } |
| 66 | |
Mirko Bonadei | a81e9c8 | 2020-05-04 16:14:32 +0200 | [diff] [blame^] | 67 | - (void)audioSessionDidChangeRoute:(RTC_OBJC_TYPE(RTCAudioSession) *)session |
| 68 | reason:(AVAudioSessionRouteChangeReason)reason |
| 69 | previousRoute:(AVAudioSessionRouteDescription *)previousRoute { |
tkchin | e54467f | 2016-03-15 16:54:03 -0700 | [diff] [blame] | 70 | } |
| 71 | |
Mirko Bonadei | a81e9c8 | 2020-05-04 16:14:32 +0200 | [diff] [blame^] | 72 | - (void)audioSessionMediaServerTerminated:(RTC_OBJC_TYPE(RTCAudioSession) *)session { |
tkchin | e54467f | 2016-03-15 16:54:03 -0700 | [diff] [blame] | 73 | } |
| 74 | |
Mirko Bonadei | a81e9c8 | 2020-05-04 16:14:32 +0200 | [diff] [blame^] | 75 | - (void)audioSessionMediaServerReset:(RTC_OBJC_TYPE(RTCAudioSession) *)session { |
tkchin | e54467f | 2016-03-15 16:54:03 -0700 | [diff] [blame] | 76 | } |
| 77 | |
Mirko Bonadei | a81e9c8 | 2020-05-04 16:14:32 +0200 | [diff] [blame^] | 78 | - (void)audioSessionShouldConfigure:(RTC_OBJC_TYPE(RTCAudioSession) *)session { |
tkchin | e54467f | 2016-03-15 16:54:03 -0700 | [diff] [blame] | 79 | } |
| 80 | |
Mirko Bonadei | a81e9c8 | 2020-05-04 16:14:32 +0200 | [diff] [blame^] | 81 | - (void)audioSessionShouldUnconfigure:(RTC_OBJC_TYPE(RTCAudioSession) *)session { |
tkchin | e54467f | 2016-03-15 16:54:03 -0700 | [diff] [blame] | 82 | } |
| 83 | |
Mirko Bonadei | a81e9c8 | 2020-05-04 16:14:32 +0200 | [diff] [blame^] | 84 | - (void)audioSession:(RTC_OBJC_TYPE(RTCAudioSession) *)audioSession |
jtteh | 13ae11a | 2017-05-25 17:52:20 -0700 | [diff] [blame] | 85 | didChangeOutputVolume:(float)outputVolume { |
| 86 | _outputVolume = outputVolume; |
| 87 | } |
| 88 | |
tkchin | e54467f | 2016-03-15 16:54:03 -0700 | [diff] [blame] | 89 | @end |
| 90 | |
tkchin | efdd930 | 2016-04-11 12:00:59 -0700 | [diff] [blame] | 91 | // A delegate that adds itself to the audio session on init and removes itself |
| 92 | // in its dealloc. |
| 93 | @interface RTCTestRemoveOnDeallocDelegate : RTCAudioSessionTestDelegate |
| 94 | @end |
| 95 | |
| 96 | @implementation RTCTestRemoveOnDeallocDelegate |
| 97 | |
| 98 | - (instancetype)init { |
| 99 | if (self = [super init]) { |
Mirko Bonadei | a81e9c8 | 2020-05-04 16:14:32 +0200 | [diff] [blame^] | 100 | RTC_OBJC_TYPE(RTCAudioSession) *session = [RTC_OBJC_TYPE(RTCAudioSession) sharedInstance]; |
tkchin | efdd930 | 2016-04-11 12:00:59 -0700 | [diff] [blame] | 101 | [session addDelegate:self]; |
| 102 | } |
| 103 | return self; |
| 104 | } |
| 105 | |
| 106 | - (void)dealloc { |
Mirko Bonadei | a81e9c8 | 2020-05-04 16:14:32 +0200 | [diff] [blame^] | 107 | RTC_OBJC_TYPE(RTCAudioSession) *session = [RTC_OBJC_TYPE(RTCAudioSession) sharedInstance]; |
tkchin | efdd930 | 2016-04-11 12:00:59 -0700 | [diff] [blame] | 108 | [session removeDelegate:self]; |
| 109 | } |
| 110 | |
| 111 | @end |
| 112 | |
tkchin | 0ce3bf9 | 2016-03-12 16:52:04 -0800 | [diff] [blame] | 113 | |
| 114 | @interface RTCAudioSessionTest : NSObject |
| 115 | |
| 116 | - (void)testLockForConfiguration; |
| 117 | |
| 118 | @end |
| 119 | |
| 120 | @implementation RTCAudioSessionTest |
| 121 | |
| 122 | - (void)testLockForConfiguration { |
Mirko Bonadei | a81e9c8 | 2020-05-04 16:14:32 +0200 | [diff] [blame^] | 123 | RTC_OBJC_TYPE(RTCAudioSession) *session = [RTC_OBJC_TYPE(RTCAudioSession) sharedInstance]; |
tkchin | 0ce3bf9 | 2016-03-12 16:52:04 -0800 | [diff] [blame] | 124 | |
| 125 | for (size_t i = 0; i < 2; i++) { |
| 126 | [session lockForConfiguration]; |
| 127 | EXPECT_TRUE(session.isLocked); |
| 128 | } |
| 129 | for (size_t i = 0; i < 2; i++) { |
| 130 | EXPECT_TRUE(session.isLocked); |
| 131 | [session unlockForConfiguration]; |
| 132 | } |
| 133 | EXPECT_FALSE(session.isLocked); |
| 134 | } |
| 135 | |
tkchin | e54467f | 2016-03-15 16:54:03 -0700 | [diff] [blame] | 136 | - (void)testAddAndRemoveDelegates { |
Mirko Bonadei | a81e9c8 | 2020-05-04 16:14:32 +0200 | [diff] [blame^] | 137 | RTC_OBJC_TYPE(RTCAudioSession) *session = [RTC_OBJC_TYPE(RTCAudioSession) sharedInstance]; |
tkchin | e54467f | 2016-03-15 16:54:03 -0700 | [diff] [blame] | 138 | NSMutableArray *delegates = [NSMutableArray array]; |
| 139 | const size_t count = 5; |
| 140 | for (size_t i = 0; i < count; ++i) { |
| 141 | RTCAudioSessionTestDelegate *delegate = |
| 142 | [[RTCAudioSessionTestDelegate alloc] init]; |
| 143 | [session addDelegate:delegate]; |
| 144 | [delegates addObject:delegate]; |
| 145 | EXPECT_EQ(i + 1, session.delegates.size()); |
| 146 | } |
| 147 | [delegates enumerateObjectsUsingBlock:^(RTCAudioSessionTestDelegate *obj, |
| 148 | NSUInteger idx, |
| 149 | BOOL *stop) { |
| 150 | [session removeDelegate:obj]; |
| 151 | }]; |
| 152 | EXPECT_EQ(0u, session.delegates.size()); |
| 153 | } |
| 154 | |
| 155 | - (void)testPushDelegate { |
Mirko Bonadei | a81e9c8 | 2020-05-04 16:14:32 +0200 | [diff] [blame^] | 156 | RTC_OBJC_TYPE(RTCAudioSession) *session = [RTC_OBJC_TYPE(RTCAudioSession) sharedInstance]; |
tkchin | e54467f | 2016-03-15 16:54:03 -0700 | [diff] [blame] | 157 | NSMutableArray *delegates = [NSMutableArray array]; |
| 158 | const size_t count = 2; |
| 159 | for (size_t i = 0; i < count; ++i) { |
| 160 | RTCAudioSessionTestDelegate *delegate = |
| 161 | [[RTCAudioSessionTestDelegate alloc] init]; |
| 162 | [session addDelegate:delegate]; |
| 163 | [delegates addObject:delegate]; |
| 164 | } |
| 165 | // Test that it gets added to the front of the list. |
| 166 | RTCAudioSessionTestDelegate *pushedDelegate = |
| 167 | [[RTCAudioSessionTestDelegate alloc] init]; |
| 168 | [session pushDelegate:pushedDelegate]; |
| 169 | EXPECT_TRUE(pushedDelegate == session.delegates[0]); |
| 170 | |
| 171 | // Test that it stays at the front of the list. |
| 172 | for (size_t i = 0; i < count; ++i) { |
| 173 | RTCAudioSessionTestDelegate *delegate = |
| 174 | [[RTCAudioSessionTestDelegate alloc] init]; |
| 175 | [session addDelegate:delegate]; |
| 176 | [delegates addObject:delegate]; |
| 177 | } |
| 178 | EXPECT_TRUE(pushedDelegate == session.delegates[0]); |
| 179 | |
| 180 | // Test that the next one goes to the front too. |
| 181 | pushedDelegate = [[RTCAudioSessionTestDelegate alloc] init]; |
| 182 | [session pushDelegate:pushedDelegate]; |
| 183 | EXPECT_TRUE(pushedDelegate == session.delegates[0]); |
| 184 | } |
| 185 | |
| 186 | // Tests that delegates added to the audio session properly zero out. This is |
| 187 | // checking an implementation detail (that vectors of __weak work as expected). |
| 188 | - (void)testZeroingWeakDelegate { |
Mirko Bonadei | a81e9c8 | 2020-05-04 16:14:32 +0200 | [diff] [blame^] | 189 | RTC_OBJC_TYPE(RTCAudioSession) *session = [RTC_OBJC_TYPE(RTCAudioSession) sharedInstance]; |
tkchin | e54467f | 2016-03-15 16:54:03 -0700 | [diff] [blame] | 190 | @autoreleasepool { |
| 191 | // Add a delegate to the session. There should be one delegate at this |
| 192 | // point. |
| 193 | RTCAudioSessionTestDelegate *delegate = |
| 194 | [[RTCAudioSessionTestDelegate alloc] init]; |
| 195 | [session addDelegate:delegate]; |
| 196 | EXPECT_EQ(1u, session.delegates.size()); |
| 197 | EXPECT_TRUE(session.delegates[0]); |
| 198 | } |
| 199 | // The previously created delegate should've de-alloced, leaving a nil ptr. |
| 200 | EXPECT_FALSE(session.delegates[0]); |
| 201 | RTCAudioSessionTestDelegate *delegate = |
| 202 | [[RTCAudioSessionTestDelegate alloc] init]; |
| 203 | [session addDelegate:delegate]; |
| 204 | // On adding a new delegate, nil ptrs should've been cleared. |
| 205 | EXPECT_EQ(1u, session.delegates.size()); |
| 206 | EXPECT_TRUE(session.delegates[0]); |
| 207 | } |
| 208 | |
tkchin | efdd930 | 2016-04-11 12:00:59 -0700 | [diff] [blame] | 209 | // Tests that we don't crash when removing delegates in dealloc. |
| 210 | // Added as a regression test. |
| 211 | - (void)testRemoveDelegateOnDealloc { |
| 212 | @autoreleasepool { |
| 213 | RTCTestRemoveOnDeallocDelegate *delegate = |
| 214 | [[RTCTestRemoveOnDeallocDelegate alloc] init]; |
| 215 | EXPECT_TRUE(delegate); |
| 216 | } |
Mirko Bonadei | a81e9c8 | 2020-05-04 16:14:32 +0200 | [diff] [blame^] | 217 | RTC_OBJC_TYPE(RTCAudioSession) *session = [RTC_OBJC_TYPE(RTCAudioSession) sharedInstance]; |
tkchin | efdd930 | 2016-04-11 12:00:59 -0700 | [diff] [blame] | 218 | EXPECT_EQ(0u, session.delegates.size()); |
| 219 | } |
| 220 | |
jtteh | 3c9a6c0 | 2017-04-18 09:09:35 -0700 | [diff] [blame] | 221 | - (void)testAudioSessionActivation { |
Mirko Bonadei | a81e9c8 | 2020-05-04 16:14:32 +0200 | [diff] [blame^] | 222 | RTC_OBJC_TYPE(RTCAudioSession) *audioSession = [RTC_OBJC_TYPE(RTCAudioSession) sharedInstance]; |
jtteh | 3c9a6c0 | 2017-04-18 09:09:35 -0700 | [diff] [blame] | 223 | EXPECT_EQ(0, audioSession.activationCount); |
| 224 | [audioSession audioSessionDidActivate:[AVAudioSession sharedInstance]]; |
| 225 | EXPECT_EQ(1, audioSession.activationCount); |
| 226 | [audioSession audioSessionDidDeactivate:[AVAudioSession sharedInstance]]; |
| 227 | EXPECT_EQ(0, audioSession.activationCount); |
| 228 | } |
| 229 | |
jtteh | f84c1d6 | 2017-04-21 13:56:39 -0700 | [diff] [blame] | 230 | // Hack - fixes OCMVerify link error |
| 231 | // Link error is: Undefined symbols for architecture i386: |
| 232 | // "OCMMakeLocation(objc_object*, char const*, int)", referenced from: |
| 233 | // -[RTCAudioSessionTest testConfigureWebRTCSession] in RTCAudioSessionTest.o |
| 234 | // ld: symbol(s) not found for architecture i386 |
| 235 | // REASON: https://github.com/erikdoe/ocmock/issues/238 |
| 236 | OCMLocation *OCMMakeLocation(id testCase, const char *fileCString, int line){ |
| 237 | return [OCMLocation locationWithTestCase:testCase |
| 238 | file:[NSString stringWithUTF8String:fileCString] |
| 239 | line:line]; |
| 240 | } |
| 241 | |
| 242 | - (void)testConfigureWebRTCSession { |
| 243 | NSError *error = nil; |
| 244 | |
| 245 | void (^setActiveBlock)(NSInvocation *invocation) = ^(NSInvocation *invocation) { |
| 246 | __autoreleasing NSError **retError; |
| 247 | [invocation getArgument:&retError atIndex:4]; |
| 248 | *retError = [NSError errorWithDomain:@"AVAudioSession" |
| 249 | code:AVAudioSessionErrorInsufficientPriority |
| 250 | userInfo:nil]; |
| 251 | BOOL failure = NO; |
| 252 | [invocation setReturnValue:&failure]; |
| 253 | }; |
| 254 | |
| 255 | id mockAVAudioSession = OCMPartialMock([AVAudioSession sharedInstance]); |
| 256 | OCMStub([[mockAVAudioSession ignoringNonObjectArgs] |
| 257 | setActive:YES withOptions:0 error:((NSError __autoreleasing **)[OCMArg anyPointer])]). |
| 258 | andDo(setActiveBlock); |
| 259 | |
Mirko Bonadei | a81e9c8 | 2020-05-04 16:14:32 +0200 | [diff] [blame^] | 260 | id mockAudioSession = OCMPartialMock([RTC_OBJC_TYPE(RTCAudioSession) sharedInstance]); |
jtteh | f84c1d6 | 2017-04-21 13:56:39 -0700 | [diff] [blame] | 261 | OCMStub([mockAudioSession session]).andReturn(mockAVAudioSession); |
| 262 | |
Mirko Bonadei | a81e9c8 | 2020-05-04 16:14:32 +0200 | [diff] [blame^] | 263 | RTC_OBJC_TYPE(RTCAudioSession) *audioSession = mockAudioSession; |
jtteh | f84c1d6 | 2017-04-21 13:56:39 -0700 | [diff] [blame] | 264 | EXPECT_EQ(0, audioSession.activationCount); |
| 265 | [audioSession lockForConfiguration]; |
| 266 | EXPECT_TRUE([audioSession checkLock:nil]); |
| 267 | // configureWebRTCSession is forced to fail in the above mock interface, |
| 268 | // so activationCount should remain 0 |
| 269 | OCMExpect([[mockAVAudioSession ignoringNonObjectArgs] |
| 270 | setActive:YES withOptions:0 error:((NSError __autoreleasing **)[OCMArg anyPointer])]). |
| 271 | andDo(setActiveBlock); |
| 272 | OCMExpect([mockAudioSession session]).andReturn(mockAVAudioSession); |
| 273 | EXPECT_FALSE([audioSession configureWebRTCSession:&error]); |
| 274 | EXPECT_EQ(0, audioSession.activationCount); |
| 275 | |
| 276 | id session = audioSession.session; |
| 277 | EXPECT_EQ(session, mockAVAudioSession); |
| 278 | EXPECT_EQ(NO, [mockAVAudioSession setActive:YES withOptions:0 error:&error]); |
| 279 | [audioSession unlockForConfiguration]; |
| 280 | |
| 281 | OCMVerify([mockAudioSession session]); |
| 282 | OCMVerify([[mockAVAudioSession ignoringNonObjectArgs] setActive:YES withOptions:0 error:&error]); |
| 283 | OCMVerify([[mockAVAudioSession ignoringNonObjectArgs] setActive:NO withOptions:0 error:&error]); |
| 284 | |
| 285 | [mockAVAudioSession stopMocking]; |
| 286 | [mockAudioSession stopMocking]; |
| 287 | } |
| 288 | |
jtteh | 13ae11a | 2017-05-25 17:52:20 -0700 | [diff] [blame] | 289 | - (void)testAudioVolumeDidNotify { |
Peter Hanspers | 4721736 | 2017-10-05 11:39:15 +0200 | [diff] [blame] | 290 | MockAVAudioSession *mockAVAudioSession = [[MockAVAudioSession alloc] init]; |
Mirko Bonadei | a81e9c8 | 2020-05-04 16:14:32 +0200 | [diff] [blame^] | 291 | RTC_OBJC_TYPE(RTCAudioSession) *session = |
| 292 | [[RTC_OBJC_TYPE(RTCAudioSession) alloc] initWithAudioSession:mockAVAudioSession]; |
jtteh | 13ae11a | 2017-05-25 17:52:20 -0700 | [diff] [blame] | 293 | RTCAudioSessionTestDelegate *delegate = |
| 294 | [[RTCAudioSessionTestDelegate alloc] init]; |
| 295 | [session addDelegate:delegate]; |
| 296 | |
Peter Hanspers | 4721736 | 2017-10-05 11:39:15 +0200 | [diff] [blame] | 297 | float expectedVolume = 0.75; |
| 298 | mockAVAudioSession.outputVolume = expectedVolume; |
jtteh | 13ae11a | 2017-05-25 17:52:20 -0700 | [diff] [blame] | 299 | |
Peter Hanspers | 4721736 | 2017-10-05 11:39:15 +0200 | [diff] [blame] | 300 | EXPECT_EQ(expectedVolume, delegate.outputVolume); |
jtteh | 13ae11a | 2017-05-25 17:52:20 -0700 | [diff] [blame] | 301 | } |
| 302 | |
tkchin | 0ce3bf9 | 2016-03-12 16:52:04 -0800 | [diff] [blame] | 303 | @end |
| 304 | |
tkchin | e54467f | 2016-03-15 16:54:03 -0700 | [diff] [blame] | 305 | namespace webrtc { |
| 306 | |
| 307 | class AudioSessionTest : public ::testing::Test { |
| 308 | protected: |
Mirko Bonadei | 17aff35 | 2018-07-26 12:20:40 +0200 | [diff] [blame] | 309 | void TearDown() override { |
Mirko Bonadei | a81e9c8 | 2020-05-04 16:14:32 +0200 | [diff] [blame^] | 310 | RTC_OBJC_TYPE(RTCAudioSession) *session = [RTC_OBJC_TYPE(RTCAudioSession) sharedInstance]; |
| 311 | for (id<RTC_OBJC_TYPE(RTCAudioSessionDelegate)> delegate : session.delegates) { |
tkchin | e54467f | 2016-03-15 16:54:03 -0700 | [diff] [blame] | 312 | [session removeDelegate:delegate]; |
| 313 | } |
| 314 | } |
| 315 | }; |
| 316 | |
| 317 | TEST_F(AudioSessionTest, LockForConfiguration) { |
tkchin | 0ce3bf9 | 2016-03-12 16:52:04 -0800 | [diff] [blame] | 318 | RTCAudioSessionTest *test = [[RTCAudioSessionTest alloc] init]; |
| 319 | [test testLockForConfiguration]; |
| 320 | } |
tkchin | e54467f | 2016-03-15 16:54:03 -0700 | [diff] [blame] | 321 | |
| 322 | TEST_F(AudioSessionTest, AddAndRemoveDelegates) { |
| 323 | RTCAudioSessionTest *test = [[RTCAudioSessionTest alloc] init]; |
| 324 | [test testAddAndRemoveDelegates]; |
| 325 | } |
| 326 | |
| 327 | TEST_F(AudioSessionTest, PushDelegate) { |
| 328 | RTCAudioSessionTest *test = [[RTCAudioSessionTest alloc] init]; |
| 329 | [test testPushDelegate]; |
| 330 | } |
| 331 | |
| 332 | TEST_F(AudioSessionTest, ZeroingWeakDelegate) { |
| 333 | RTCAudioSessionTest *test = [[RTCAudioSessionTest alloc] init]; |
| 334 | [test testZeroingWeakDelegate]; |
| 335 | } |
| 336 | |
tkchin | efdd930 | 2016-04-11 12:00:59 -0700 | [diff] [blame] | 337 | TEST_F(AudioSessionTest, RemoveDelegateOnDealloc) { |
| 338 | RTCAudioSessionTest *test = [[RTCAudioSessionTest alloc] init]; |
| 339 | [test testRemoveDelegateOnDealloc]; |
| 340 | } |
| 341 | |
jtteh | 3c9a6c0 | 2017-04-18 09:09:35 -0700 | [diff] [blame] | 342 | TEST_F(AudioSessionTest, AudioSessionActivation) { |
| 343 | RTCAudioSessionTest *test = [[RTCAudioSessionTest alloc] init]; |
| 344 | [test testAudioSessionActivation]; |
| 345 | } |
| 346 | |
jtteh | f84c1d6 | 2017-04-21 13:56:39 -0700 | [diff] [blame] | 347 | TEST_F(AudioSessionTest, ConfigureWebRTCSession) { |
| 348 | RTCAudioSessionTest *test = [[RTCAudioSessionTest alloc] init]; |
| 349 | [test testConfigureWebRTCSession]; |
| 350 | } |
jtteh | 3c9a6c0 | 2017-04-18 09:09:35 -0700 | [diff] [blame] | 351 | |
jtteh | 13ae11a | 2017-05-25 17:52:20 -0700 | [diff] [blame] | 352 | TEST_F(AudioSessionTest, AudioVolumeDidNotify) { |
| 353 | RTCAudioSessionTest *test = [[RTCAudioSessionTest alloc] init]; |
| 354 | [test testAudioVolumeDidNotify]; |
| 355 | } |
| 356 | |
tkchin | e54467f | 2016-03-15 16:54:03 -0700 | [diff] [blame] | 357 | } // namespace webrtc |