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 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
46 void OveruseDetected() { ++overuse_; } | 46 void OveruseDetected() { ++overuse_; } |
47 void NormalUsage() { ++normaluse_; } | 47 void NormalUsage() { ++normaluse_; } |
48 | 48 |
49 int overuse_; | 49 int overuse_; |
50 int normaluse_; | 50 int normaluse_; |
51 }; | 51 }; |
52 | 52 |
53 class OveruseFrameDetectorTest : public ::testing::Test, | 53 class OveruseFrameDetectorTest : public ::testing::Test, |
54 public CpuOveruseMetricsObserver { | 54 public CpuOveruseMetricsObserver { |
55 protected: | 55 protected: |
56 void SetUp() override { | 56 virtual void SetUp() { |
57 clock_.reset(new SimulatedClock(1234)); | 57 clock_.reset(new SimulatedClock(1234)); |
58 observer_.reset(new MockCpuOveruseObserver()); | 58 observer_.reset(new MockCpuOveruseObserver()); |
59 options_.min_process_count = 0; | 59 options_.min_process_count = 0; |
60 ReinitializeOveruseDetector(); | 60 ReinitializeOveruseDetector(); |
61 } | 61 } |
62 | 62 |
63 void ReinitializeOveruseDetector() { | 63 void ReinitializeOveruseDetector() { |
64 overuse_detector_.reset(new OveruseFrameDetector( | 64 overuse_detector_.reset(new OveruseFrameDetector( |
65 clock_.get(), options_, observer_.get(), nullptr, this)); | 65 clock_.get(), options_, observer_.get(), nullptr, this)); |
66 } | 66 } |
(...skipping 227 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
294 // Encode heavier part, resulting in >85% usage total. | 294 // Encode heavier part, resulting in >85% usage total. |
295 clock_->AdvanceTimeMilliseconds(kDelayMs - 1); | 295 clock_->AdvanceTimeMilliseconds(kDelayMs - 1); |
296 overuse_detector_->FrameSent(timestamp); | 296 overuse_detector_->FrameSent(timestamp); |
297 clock_->AdvanceTimeMilliseconds(kIntervalMs - kDelayMs); | 297 clock_->AdvanceTimeMilliseconds(kIntervalMs - kDelayMs); |
298 timestamp += kIntervalMs * 90; | 298 timestamp += kIntervalMs * 90; |
299 overuse_detector_->Process(); | 299 overuse_detector_->Process(); |
300 } | 300 } |
301 } | 301 } |
302 | 302 |
303 } // namespace webrtc | 303 } // namespace webrtc |
OLD | NEW |