Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 <algorithm> | 5 #include <algorithm> |
| 6 | 6 |
| 7 #include "base/message_loop/message_loop.h" | |
| 7 #include "content/renderer/media/webrtc/webrtc_video_capturer_adapter.h" | 8 #include "content/renderer/media/webrtc/webrtc_video_capturer_adapter.h" |
| 8 #include "media/base/video_frame.h" | 9 #include "media/base/video_frame.h" |
| 9 #include "testing/gtest/include/gtest/gtest.h" | 10 #include "testing/gtest/include/gtest/gtest.h" |
| 10 | 11 |
| 11 namespace content { | 12 namespace content { |
| 12 | 13 |
| 13 class WebRtcVideoCapturerAdapterTest | 14 class WebRtcVideoCapturerAdapterTest |
| 14 : public sigslot::has_slots<>, | 15 : public sigslot::has_slots<>, |
| 15 public ::testing::Test { | 16 public ::testing::Test { |
| 16 public: | 17 public: |
| 17 WebRtcVideoCapturerAdapterTest() | 18 WebRtcVideoCapturerAdapterTest() |
| 18 : adapter_(false), | 19 : adapter_(base::MessageLoopProxy::current(), false), |
| 19 output_frame_width_(0), | 20 output_frame_width_(0), |
| 20 output_frame_height_(0) { | 21 output_frame_height_(0) { |
| 21 adapter_.SignalFrameCaptured.connect( | 22 adapter_.SignalFrameCaptured.connect( |
| 22 this, &WebRtcVideoCapturerAdapterTest::OnFrameCaptured); | 23 this, &WebRtcVideoCapturerAdapterTest::OnFrameCaptured); |
| 23 } | 24 } |
| 24 virtual ~WebRtcVideoCapturerAdapterTest() {} | 25 virtual ~WebRtcVideoCapturerAdapterTest() {} |
| 25 | 26 |
| 26 void TestSourceCropFrame(int capture_width, | 27 void TestSourceCropFrame(int capture_width, |
| 27 int capture_height, | 28 int capture_height, |
| 28 int expected_width, | 29 int expected_width, |
| (...skipping 14 matching lines...) Expand all Loading... | |
| 43 EXPECT_EQ(expected_height, output_frame_height_); | 44 EXPECT_EQ(expected_height, output_frame_height_); |
| 44 } | 45 } |
| 45 protected: | 46 protected: |
| 46 void OnFrameCaptured(cricket::VideoCapturer* capturer, | 47 void OnFrameCaptured(cricket::VideoCapturer* capturer, |
| 47 const cricket::CapturedFrame* frame) { | 48 const cricket::CapturedFrame* frame) { |
| 48 output_frame_width_ = frame->width; | 49 output_frame_width_ = frame->width; |
| 49 output_frame_height_ = frame->height; | 50 output_frame_height_ = frame->height; |
| 50 } | 51 } |
| 51 | 52 |
| 52 private: | 53 private: |
| 54 base::MessageLoop message_loop_; | |
|
tommi (sloooow) - chröme
2014/05/12 14:20:41
for ui or for io?
perkj_chrome
2014/05/12 15:39:51
neither, its the libjingle worker thread proxy.
| |
| 53 WebRtcVideoCapturerAdapter adapter_; | 55 WebRtcVideoCapturerAdapter adapter_; |
| 54 int output_frame_width_; | 56 int output_frame_width_; |
| 55 int output_frame_height_; | 57 int output_frame_height_; |
| 56 }; | 58 }; |
| 57 | 59 |
| 58 TEST_F(WebRtcVideoCapturerAdapterTest, CropFrameTo640360) { | 60 TEST_F(WebRtcVideoCapturerAdapterTest, CropFrameTo640360) { |
| 59 TestSourceCropFrame(640, 480, 640, 360); | 61 TestSourceCropFrame(640, 480, 640, 360); |
| 60 } | 62 } |
| 61 | 63 |
| 62 TEST_F(WebRtcVideoCapturerAdapterTest, CropFrameTo732489) { | 64 TEST_F(WebRtcVideoCapturerAdapterTest, CropFrameTo732489) { |
| 63 TestSourceCropFrame(1280, 720, 731, 489); | 65 TestSourceCropFrame(1280, 720, 731, 489); |
| 64 } | 66 } |
| 65 | 67 |
| 66 } // namespace content | 68 } // namespace content |
| OLD | NEW |