Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(15)

Side by Side Diff: webrtc/examples/objc/AppRTCMobile/tests/ARDSettingsModelTests.mm

Issue 2479153002: Rename media constraints model and store. (Closed)
Patch Set: Rebase master Created 4 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « webrtc/examples/objc/AppRTCMobile/tests/ARDMediaConstraintsModelTests.mm ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
11 #import <Foundation/Foundation.h> 11 #import <Foundation/Foundation.h>
12 #import <OCMock/OCMock.h> 12 #import <OCMock/OCMock.h>
13 #import "ARDMediaConstraintsModel+Private.h" 13 #import "ARDSettingsModel+Private.h"
14 #import "ARDMediaConstraintsSettingsStore.h" 14 #import "ARDSettingsStore.h"
15 #import "WebRTC/RTCMediaConstraints.h" 15 #import "WebRTC/RTCMediaConstraints.h"
16 #include "webrtc/base/gunit.h" 16 #include "webrtc/base/gunit.h"
17 17
18 18
19 @interface ARDMediaConstraintsModelTests : NSObject { 19 @interface ARDSettingsModelTests : NSObject {
20 ARDMediaConstraintsModel *_model; 20 ARDSettingsModel *_model;
21 } 21 }
22 22
23 - (void)testStoringInavlidConstraintReturnsNo; 23 - (void)testStoringInavlidConstraintReturnsNo;
24 - (void)testDefaultMediaFromStore; 24 - (void)testDefaultMediaFromStore;
25 - (void)testWidthConstraintFromStore; 25 - (void)testWidthConstraintFromStore;
26 - (void)testHeightConstraintFromStore; 26 - (void)testHeightConstraintFromStore;
27 27
28 @end 28 @end
29 29
30 @implementation ARDMediaConstraintsModelTests 30 @implementation ARDSettingsModelTests
31 31
32 - (instancetype)init { 32 - (instancetype)init {
33 self = [super init]; 33 self = [super init];
34 if (self) { 34 if (self) {
35 _model = [[ARDMediaConstraintsModel 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:[ARDMediaConstraintsSettingsStore cl ass]]; 41 id storeMock = [OCMockObject mockForClass:[ARDSettingsStore class]];
42 [([[storeMock stub] andReturn:constraintString]) videoResolutionConstraintsSet ting]; 42 [([[storeMock stub] andReturn:constraintString]) videoResolutionConstraintsSet ting];
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
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after
109 [self setupMockStoreWithMediaConstraintString:@"invalid"]; 109 [self setupMockStoreWithMediaConstraintString:@"invalid"];
110 110
111 // when 111 // when
112 NSDictionary *constraintsDictionary = [_model currentMediaConstraintFromStoreA sRTCDictionary]; 112 NSDictionary *constraintsDictionary = [_model currentMediaConstraintFromStoreA sRTCDictionary];
113 113
114 // then 114 // then
115 EXPECT_TRUE(constraintsDictionary == nil); 115 EXPECT_TRUE(constraintsDictionary == nil);
116 } 116 }
117 @end 117 @end
118 118
119 class ARDMediaConstraintsModelTest : public ::testing::Test { 119 class ARDSettingsModelTest : public ::testing::Test {
120 protected: 120 protected:
121 ARDMediaConstraintsModelTests *test; 121 ARDSettingsModelTests *test;
122 ARDMediaConstraintsModelTest() { test = [[ARDMediaConstraintsModelTests alloc] init]; } 122 ARDSettingsModelTest() { test = [[ARDSettingsModelTests alloc] init]; }
123 }; 123 };
124 124
125 TEST_F(ARDMediaConstraintsModelTest, DefaultMediaFromStore) { 125 TEST_F(ARDSettingsModelTest, DefaultMediaFromStore) {
126 @autoreleasepool { 126 @autoreleasepool {
127 [test testDefaultMediaFromStore]; 127 [test testDefaultMediaFromStore];
128 } 128 }
129 } 129 }
130 130
131 TEST_F(ARDMediaConstraintsModelTest, StoringInvalidConstraintsReturnsNo) { 131 TEST_F(ARDSettingsModelTest, StoringInvalidConstraintsReturnsNo) {
132 @autoreleasepool { 132 @autoreleasepool {
133 [test testStoringInavlidConstraintReturnsNo]; 133 [test testStoringInavlidConstraintReturnsNo];
134 } 134 }
135 } 135 }
136 136
137 TEST_F(ARDMediaConstraintsModelTest, WidthConstraintFromStore) { 137 TEST_F(ARDSettingsModelTest, WidthConstraintFromStore) {
138 @autoreleasepool { 138 @autoreleasepool {
139 [test testWidthConstraintFromStore]; 139 [test testWidthConstraintFromStore];
140 } 140 }
141 } 141 }
142 142
143 TEST_F(ARDMediaConstraintsModelTest, HeightConstraintFromStore) { 143 TEST_F(ARDSettingsModelTest, HeightConstraintFromStore) {
144 @autoreleasepool { 144 @autoreleasepool {
145 [test testHeightConstraintFromStore]; 145 [test testHeightConstraintFromStore];
146 } 146 }
147 } 147 }
148 148
149 TEST_F(ARDMediaConstraintsModelTest, ConstratintIsNil) { 149 TEST_F(ARDSettingsModelTest, ConstratintIsNil) {
150 @autoreleasepool { 150 @autoreleasepool {
151 [test testConstraintComponentIsNilWhenInvalidConstraintString]; 151 [test testConstraintComponentIsNilWhenInvalidConstraintString];
152 } 152 }
153 } 153 }
154 154
155 TEST_F(ARDMediaConstraintsModelTest, DictionaryIsNil) { 155 TEST_F(ARDSettingsModelTest, DictionaryIsNil) {
156 @autoreleasepool { 156 @autoreleasepool {
157 [test testConstraintsDictionaryIsNilWhenInvalidConstraintString]; 157 [test testConstraintsDictionaryIsNilWhenInvalidConstraintString];
158 } 158 }
159 } 159 }
OLDNEW
« no previous file with comments | « webrtc/examples/objc/AppRTCMobile/tests/ARDMediaConstraintsModelTests.mm ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698