| 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 21 matching lines...) Expand all Loading... |
| 32 - (instancetype)init { | 32 - (instancetype)init { |
| 33 self = [super init]; | 33 self = [super init]; |
| 34 if (self) { | 34 if (self) { |
| 35 _model = [[ARDSettingsModel alloc] init]; | 35 _model = [[ARDSettingsModel alloc] init]; |
| 36 } | 36 } |
| 37 return self; | 37 return self; |
| 38 } | 38 } |
| 39 | 39 |
| 40 - (id)setupMockStoreWithMediaConstraintString:(NSString *)constraintString { | 40 - (id)setupMockStoreWithMediaConstraintString:(NSString *)constraintString { |
| 41 id storeMock = [OCMockObject mockForClass:[ARDSettingsStore class]]; | 41 id storeMock = [OCMockObject mockForClass:[ARDSettingsStore class]]; |
| 42 [([[storeMock stub] andReturn:constraintString]) videoResolutionConstraintsSet
ting]; | 42 [([[storeMock stub] andReturn:constraintString]) videoResolutionConstraints]; |
| 43 | 43 |
| 44 id partialMock = [OCMockObject partialMockForObject:_model]; | 44 id partialMock = [OCMockObject partialMockForObject:_model]; |
| 45 [[[partialMock stub] andReturn:storeMock] settingsStore]; | 45 [[[partialMock stub] andReturn:storeMock] settingsStore]; |
| 46 | 46 |
| 47 return storeMock; | 47 return storeMock; |
| 48 } | 48 } |
| 49 | 49 |
| 50 - (void)testDefaultMediaFromStore { | 50 - (void)testDefaultMediaFromStore { |
| 51 // given | 51 // given |
| 52 id storeMock = [self setupMockStoreWithMediaConstraintString:nil]; | 52 id storeMock = [self setupMockStoreWithMediaConstraintString:nil]; |
| 53 | 53 |
| 54 [[storeMock expect] setVideoResolutionConstraintsSetting:@"640x480"]; | 54 [[storeMock expect] setVideoResolutionConstraints:@"640x480"]; |
| 55 | 55 |
| 56 // when | 56 // when |
| 57 NSString *string = [_model currentVideoResoultionConstraintFromStore]; | 57 NSString *string = [_model currentVideoResoultionConstraintFromStore]; |
| 58 | 58 |
| 59 // then | 59 // then |
| 60 EXPECT_TRUE([string isEqualToString:@"640x480"]); | 60 EXPECT_TRUE([string isEqualToString:@"640x480"]); |
| 61 [storeMock verify]; | 61 [storeMock verify]; |
| 62 } | 62 } |
| 63 | 63 |
| 64 - (void)testStoringInavlidConstraintReturnsNo { | 64 - (void)testStoringInavlidConstraintReturnsNo { |
| (...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 150 @autoreleasepool { | 150 @autoreleasepool { |
| 151 [test testConstraintComponentIsNilWhenInvalidConstraintString]; | 151 [test testConstraintComponentIsNilWhenInvalidConstraintString]; |
| 152 } | 152 } |
| 153 } | 153 } |
| 154 | 154 |
| 155 TEST_F(ARDSettingsModelTest, DictionaryIsNil) { | 155 TEST_F(ARDSettingsModelTest, DictionaryIsNil) { |
| 156 @autoreleasepool { | 156 @autoreleasepool { |
| 157 [test testConstraintsDictionaryIsNilWhenInvalidConstraintString]; | 157 [test testConstraintsDictionaryIsNilWhenInvalidConstraintString]; |
| 158 } | 158 } |
| 159 } | 159 } |
| OLD | NEW |