| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright 2016 The WebRTC project authors. All Rights Reserved. | 2 * Copyright 2016 The WebRTC project authors. All Rights Reserved. |
| 3 * | 3 * |
| 4 * Use of this source code is governed by a BSD-style license | 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 | 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 | 6 * tree. An additional intellectual property rights grant can be found |
| 7 * in the file PATENTS. All contributing project authors may | 7 * in the file PATENTS. All contributing project authors may |
| 8 * be found in the AUTHORS file in the root of the source tree. | 8 * be found in the AUTHORS file in the root of the source tree. |
| 9 */ | 9 */ |
| 10 | 10 |
| (...skipping 158 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 169 - (void)testRemoveDelegateOnDealloc { | 169 - (void)testRemoveDelegateOnDealloc { |
| 170 @autoreleasepool { | 170 @autoreleasepool { |
| 171 RTCTestRemoveOnDeallocDelegate *delegate = | 171 RTCTestRemoveOnDeallocDelegate *delegate = |
| 172 [[RTCTestRemoveOnDeallocDelegate alloc] init]; | 172 [[RTCTestRemoveOnDeallocDelegate alloc] init]; |
| 173 EXPECT_TRUE(delegate); | 173 EXPECT_TRUE(delegate); |
| 174 } | 174 } |
| 175 RTCAudioSession *session = [RTCAudioSession sharedInstance]; | 175 RTCAudioSession *session = [RTCAudioSession sharedInstance]; |
| 176 EXPECT_EQ(0u, session.delegates.size()); | 176 EXPECT_EQ(0u, session.delegates.size()); |
| 177 } | 177 } |
| 178 | 178 |
| 179 - (void)testAudioSessionActivation { |
| 180 RTCAudioSession *audioSession = [RTCAudioSession sharedInstance]; |
| 181 EXPECT_EQ(0, audioSession.activationCount); |
| 182 [audioSession audioSessionDidActivate:[AVAudioSession sharedInstance]]; |
| 183 EXPECT_EQ(1, audioSession.activationCount); |
| 184 [audioSession audioSessionDidDeactivate:[AVAudioSession sharedInstance]]; |
| 185 EXPECT_EQ(0, audioSession.activationCount); |
| 186 } |
| 187 |
| 179 @end | 188 @end |
| 180 | 189 |
| 181 namespace webrtc { | 190 namespace webrtc { |
| 182 | 191 |
| 183 class AudioSessionTest : public ::testing::Test { | 192 class AudioSessionTest : public ::testing::Test { |
| 184 protected: | 193 protected: |
| 185 void TearDown() { | 194 void TearDown() { |
| 186 RTCAudioSession *session = [RTCAudioSession sharedInstance]; | 195 RTCAudioSession *session = [RTCAudioSession sharedInstance]; |
| 187 for (id<RTCAudioSessionDelegate> delegate : session.delegates) { | 196 for (id<RTCAudioSessionDelegate> delegate : session.delegates) { |
| 188 [session removeDelegate:delegate]; | 197 [session removeDelegate:delegate]; |
| (...skipping 19 matching lines...) Expand all Loading... |
| 208 TEST_F(AudioSessionTest, ZeroingWeakDelegate) { | 217 TEST_F(AudioSessionTest, ZeroingWeakDelegate) { |
| 209 RTCAudioSessionTest *test = [[RTCAudioSessionTest alloc] init]; | 218 RTCAudioSessionTest *test = [[RTCAudioSessionTest alloc] init]; |
| 210 [test testZeroingWeakDelegate]; | 219 [test testZeroingWeakDelegate]; |
| 211 } | 220 } |
| 212 | 221 |
| 213 TEST_F(AudioSessionTest, RemoveDelegateOnDealloc) { | 222 TEST_F(AudioSessionTest, RemoveDelegateOnDealloc) { |
| 214 RTCAudioSessionTest *test = [[RTCAudioSessionTest alloc] init]; | 223 RTCAudioSessionTest *test = [[RTCAudioSessionTest alloc] init]; |
| 215 [test testRemoveDelegateOnDealloc]; | 224 [test testRemoveDelegateOnDealloc]; |
| 216 } | 225 } |
| 217 | 226 |
| 227 TEST_F(AudioSessionTest, AudioSessionActivation) { |
| 228 RTCAudioSessionTest *test = [[RTCAudioSessionTest alloc] init]; |
| 229 [test testAudioSessionActivation]; |
| 230 } |
| 231 |
| 232 |
| 218 } // namespace webrtc | 233 } // namespace webrtc |
| OLD | NEW |