| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (c) 2013 The WebRTC project authors. All Rights Reserved. | 2 * Copyright (c) 2013 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 170 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 181 clock_->AdvanceTimeMilliseconds(kProcessIntervalMs); | 181 clock_->AdvanceTimeMilliseconds(kProcessIntervalMs); |
| 182 overuse_detector_->Process(); | 182 overuse_detector_->Process(); |
| 183 EXPECT_EQ(1, overuse_observer.normaluse_); | 183 EXPECT_EQ(1, overuse_observer.normaluse_); |
| 184 } | 184 } |
| 185 | 185 |
| 186 TEST_F(OveruseFrameDetectorTest, ConstantOveruseGivesNoNormalUsage) { | 186 TEST_F(OveruseFrameDetectorTest, ConstantOveruseGivesNoNormalUsage) { |
| 187 options_.enable_extended_processing_usage = false; | 187 options_.enable_extended_processing_usage = false; |
| 188 ReinitializeOveruseDetector(); | 188 ReinitializeOveruseDetector(); |
| 189 EXPECT_CALL(*(observer_.get()), NormalUsage()).Times(0); | 189 EXPECT_CALL(*(observer_.get()), NormalUsage()).Times(0); |
| 190 EXPECT_CALL(*(observer_.get()), OveruseDetected()).Times(64); | 190 EXPECT_CALL(*(observer_.get()), OveruseDetected()).Times(64); |
| 191 for(size_t i = 0; i < 64; ++i) { | 191 for (size_t i = 0; i < 64; ++i) { |
| 192 TriggerOveruse(options_.high_threshold_consecutive_count); | 192 TriggerOveruse(options_.high_threshold_consecutive_count); |
| 193 } | 193 } |
| 194 } | 194 } |
| 195 | 195 |
| 196 TEST_F(OveruseFrameDetectorTest, ConsecutiveCountTriggersOveruse) { | 196 TEST_F(OveruseFrameDetectorTest, ConsecutiveCountTriggersOveruse) { |
| 197 EXPECT_CALL(*(observer_.get()), OveruseDetected()).Times(1); | 197 EXPECT_CALL(*(observer_.get()), OveruseDetected()).Times(1); |
| 198 options_.enable_extended_processing_usage = false; | 198 options_.enable_extended_processing_usage = false; |
| 199 options_.high_threshold_consecutive_count = 2; | 199 options_.high_threshold_consecutive_count = 2; |
| 200 ReinitializeOveruseDetector(); | 200 ReinitializeOveruseDetector(); |
| 201 TriggerOveruse(2); | 201 TriggerOveruse(2); |
| (...skipping 194 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 396 ReinitializeOveruseDetector(); | 396 ReinitializeOveruseDetector(); |
| 397 // usage > high => overuse | 397 // usage > high => overuse |
| 398 EXPECT_CALL(*(observer_.get()), OveruseDetected()).Times(0); | 398 EXPECT_CALL(*(observer_.get()), OveruseDetected()).Times(0); |
| 399 TriggerOveruse(options_.high_threshold_consecutive_count); | 399 TriggerOveruse(options_.high_threshold_consecutive_count); |
| 400 // usage < low => underuse | 400 // usage < low => underuse |
| 401 EXPECT_CALL(*(observer_.get()), NormalUsage()).Times(0); | 401 EXPECT_CALL(*(observer_.get()), NormalUsage()).Times(0); |
| 402 TriggerUnderuse(); | 402 TriggerUnderuse(); |
| 403 } | 403 } |
| 404 | 404 |
| 405 } // namespace webrtc | 405 } // namespace webrtc |
| OLD | NEW |