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 154 matching lines...) Loading... |
165 } | 165 } |
166 | 166 |
167 RTCTestStats empty_stats_different_id("testId2", 123); | 167 RTCTestStats empty_stats_different_id("testId2", 123); |
168 EXPECT_NE(empty_stats, empty_stats_different_id); | 168 EXPECT_NE(empty_stats, empty_stats_different_id); |
169 RTCTestStats empty_stats_different_timestamp("testId", 321); | 169 RTCTestStats empty_stats_different_timestamp("testId", 321); |
170 EXPECT_NE(empty_stats, empty_stats_different_timestamp); | 170 EXPECT_NE(empty_stats, empty_stats_different_timestamp); |
171 | 171 |
172 RTCChildStats child("childId", 42); | 172 RTCChildStats child("childId", 42); |
173 RTCGrandChildStats grandchild("grandchildId", 42); | 173 RTCGrandChildStats grandchild("grandchildId", 42); |
174 EXPECT_NE(child, grandchild); | 174 EXPECT_NE(child, grandchild); |
| 175 |
| 176 RTCChildStats stats_with_defined_member("leId", 0); |
| 177 stats_with_defined_member.child_int = 0; |
| 178 RTCChildStats stats_with_undefined_member("leId", 0); |
| 179 EXPECT_NE(stats_with_defined_member, stats_with_undefined_member); |
| 180 EXPECT_NE(stats_with_undefined_member, stats_with_defined_member); |
175 } | 181 } |
176 | 182 |
177 TEST(RTCStatsTest, RTCStatsGrandChild) { | 183 TEST(RTCStatsTest, RTCStatsGrandChild) { |
178 RTCGrandChildStats stats("grandchild", 0.0); | 184 RTCGrandChildStats stats("grandchild", 0.0); |
179 stats.child_int = 1; | 185 stats.child_int = 1; |
180 stats.grandchild_int = 2; | 186 stats.grandchild_int = 2; |
181 int32_t sum = 0; | 187 int32_t sum = 0; |
182 for (const RTCStatsMemberInterface* member : stats.Members()) { | 188 for (const RTCStatsMemberInterface* member : stats.Members()) { |
183 sum += *member->cast_to<const RTCStatsMember<int32_t>>(); | 189 sum += *member->cast_to<const RTCStatsMember<int32_t>>(); |
184 } | 190 } |
(...skipping 17 matching lines...) Loading... |
202 } | 208 } |
203 | 209 |
204 TEST(RTCStatsDeathTest, InvalidCasting) { | 210 TEST(RTCStatsDeathTest, InvalidCasting) { |
205 RTCGrandChildStats stats("grandchild", 0.0); | 211 RTCGrandChildStats stats("grandchild", 0.0); |
206 EXPECT_DEATH(stats.cast_to<RTCChildStats>(), ""); | 212 EXPECT_DEATH(stats.cast_to<RTCChildStats>(), ""); |
207 } | 213 } |
208 | 214 |
209 #endif // RTC_DCHECK_IS_ON && GTEST_HAS_DEATH_TEST && !defined(WEBRTC_ANDROID) | 215 #endif // RTC_DCHECK_IS_ON && GTEST_HAS_DEATH_TEST && !defined(WEBRTC_ANDROID) |
210 | 216 |
211 } // namespace webrtc | 217 } // namespace webrtc |
OLD | NEW |