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> |
| 12 | |
| 13 | #include "testing/gtest/include/gtest/gtest.h" |
| 14 | |
| 15 | #import "webrtc/modules/audio_device/ios/objc/RTCAudioSession.h" |
| 16 | |
| 17 | @interface RTCAudioSessionTest : NSObject |
| 18 | |
| 19 | - (void)testLockForConfiguration; |
| 20 | |
| 21 | @end |
| 22 | |
| 23 | @implementation RTCAudioSessionTest |
| 24 | |
| 25 | - (void)testLockForConfiguration { |
| 26 | RTCAudioSession *session = [RTCAudioSession sharedInstance]; |
| 27 | |
| 28 | for (size_t i = 0; i < 2; i++) { |
| 29 | [session lockForConfiguration]; |
| 30 | EXPECT_TRUE(session.isLocked); |
| 31 | } |
| 32 | for (size_t i = 0; i < 2; i++) { |
| 33 | EXPECT_TRUE(session.isLocked); |
| 34 | [session unlockForConfiguration]; |
| 35 | } |
| 36 | EXPECT_FALSE(session.isLocked); |
| 37 | } |
| 38 | |
| 39 | @end |
| 40 | |
| 41 | TEST(RTCAudioSessionTest, LockForConfiguration) { |
| 42 | RTCAudioSessionTest *test = [[RTCAudioSessionTest alloc] init]; |
| 43 | [test testLockForConfiguration]; |
| 44 | } |