| OLD | NEW |
| 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "content/browser/media/capture/video_capture_oracle.h" | 5 #include "content/browser/media/capture/video_capture_oracle.h" |
| 6 | 6 |
| 7 #include <cstdlib> | 7 #include <cstdlib> |
| 8 #include <utility> | 8 #include <utility> |
| 9 #include <vector> | 9 #include <vector> |
| 10 | 10 |
| (...skipping 481 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 492 | 492 |
| 493 SmoothEventSampler sampler(base::TimeDelta::FromSeconds(1) / 30, true, 3); | 493 SmoothEventSampler sampler(base::TimeDelta::FromSeconds(1) / 30, true, 3); |
| 494 ReplayCheckingSamplerDecisions(data_points, arraysize(data_points), &sampler); | 494 ReplayCheckingSamplerDecisions(data_points, arraysize(data_points), &sampler); |
| 495 } | 495 } |
| 496 | 496 |
| 497 class AnimatedContentSamplerTest : public ::testing::Test { | 497 class AnimatedContentSamplerTest : public ::testing::Test { |
| 498 public: | 498 public: |
| 499 AnimatedContentSamplerTest() {} | 499 AnimatedContentSamplerTest() {} |
| 500 virtual ~AnimatedContentSamplerTest() {} | 500 virtual ~AnimatedContentSamplerTest() {} |
| 501 | 501 |
| 502 virtual void SetUp() OVERRIDE { | 502 virtual void SetUp() override { |
| 503 const base::TimeDelta since_epoch = | 503 const base::TimeDelta since_epoch = |
| 504 InitialTestTimeTicks() - base::TimeTicks::UnixEpoch(); | 504 InitialTestTimeTicks() - base::TimeTicks::UnixEpoch(); |
| 505 rand_seed_ = abs(static_cast<int>(since_epoch.InMicroseconds())); | 505 rand_seed_ = abs(static_cast<int>(since_epoch.InMicroseconds())); |
| 506 sampler_.reset(new AnimatedContentSampler(GetMinCapturePeriod())); | 506 sampler_.reset(new AnimatedContentSampler(GetMinCapturePeriod())); |
| 507 } | 507 } |
| 508 | 508 |
| 509 protected: | 509 protected: |
| 510 // Overridden by subclass for parameterized tests. | 510 // Overridden by subclass for parameterized tests. |
| 511 virtual base::TimeDelta GetMinCapturePeriod() const { | 511 virtual base::TimeDelta GetMinCapturePeriod() const { |
| 512 return base::TimeDelta::FromSeconds(1) / 30; | 512 return base::TimeDelta::FromSeconds(1) / 30; |
| (...skipping 152 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 665 : public AnimatedContentSamplerTest, | 665 : public AnimatedContentSamplerTest, |
| 666 public ::testing::WithParamInterface<Scenario> { | 666 public ::testing::WithParamInterface<Scenario> { |
| 667 public: | 667 public: |
| 668 AnimatedContentSamplerParameterizedTest() | 668 AnimatedContentSamplerParameterizedTest() |
| 669 : count_dropped_frames_(0), count_sampled_frames_(0) {} | 669 : count_dropped_frames_(0), count_sampled_frames_(0) {} |
| 670 virtual ~AnimatedContentSamplerParameterizedTest() {} | 670 virtual ~AnimatedContentSamplerParameterizedTest() {} |
| 671 | 671 |
| 672 protected: | 672 protected: |
| 673 typedef std::pair<gfx::Rect, base::TimeTicks> Event; | 673 typedef std::pair<gfx::Rect, base::TimeTicks> Event; |
| 674 | 674 |
| 675 virtual base::TimeDelta GetMinCapturePeriod() const OVERRIDE { | 675 virtual base::TimeDelta GetMinCapturePeriod() const override { |
| 676 return GetParam().min_capture_period; | 676 return GetParam().min_capture_period; |
| 677 } | 677 } |
| 678 | 678 |
| 679 // Generate a sequence of events from the compositor pipeline. The event | 679 // Generate a sequence of events from the compositor pipeline. The event |
| 680 // times will all be at compositor vsync boundaries. | 680 // times will all be at compositor vsync boundaries. |
| 681 std::vector<Event> GenerateEventSequence(base::TimeTicks begin, | 681 std::vector<Event> GenerateEventSequence(base::TimeTicks begin, |
| 682 base::TimeTicks end, | 682 base::TimeTicks end, |
| 683 bool include_content_frame_events, | 683 bool include_content_frame_events, |
| 684 bool include_random_events) { | 684 bool include_random_events) { |
| 685 DCHECK(GetParam().content_period >= GetParam().vsync_interval); | 685 DCHECK(GetParam().content_period >= GetParam().vsync_interval); |
| (...skipping 566 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1252 // |event_increment|. | 1252 // |event_increment|. |
| 1253 const base::TimeDelta max_acceptable_delta = (i % 100) == 78 ? | 1253 const base::TimeDelta max_acceptable_delta = (i % 100) == 78 ? |
| 1254 event_increment * 5 : event_increment * 2; | 1254 event_increment * 5 : event_increment * 2; |
| 1255 EXPECT_GE(max_acceptable_delta.InMicroseconds(), delta.InMicroseconds()); | 1255 EXPECT_GE(max_acceptable_delta.InMicroseconds(), delta.InMicroseconds()); |
| 1256 } | 1256 } |
| 1257 last_frame_timestamp = frame_timestamp; | 1257 last_frame_timestamp = frame_timestamp; |
| 1258 } | 1258 } |
| 1259 } | 1259 } |
| 1260 | 1260 |
| 1261 } // namespace content | 1261 } // namespace content |
| OLD | NEW |