OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/web_contents_video_capture_device.h" | 5 #include "content/browser/media/capture/web_contents_video_capture_device.h" |
6 | 6 |
7 #include "base/bind_helpers.h" | 7 #include "base/bind_helpers.h" |
8 #include "base/debug/debugger.h" | 8 #include "base/debug/debugger.h" |
9 #include "base/run_loop.h" | 9 #include "base/run_loop.h" |
10 #include "base/test/test_timeouts.h" | 10 #include "base/test/test_timeouts.h" |
(...skipping 1045 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1056 const gfx::Size& standard_size) { | 1056 const gfx::Size& standard_size) { |
1057 SCOPED_TRACE(::testing::Message() | 1057 SCOPED_TRACE(::testing::Message() |
1058 << "policy=" << policy | 1058 << "policy=" << policy |
1059 << ", oddball_size=" << oddball_size.ToString() | 1059 << ", oddball_size=" << oddball_size.ToString() |
1060 << ", standard_size=" << standard_size.ToString()); | 1060 << ", standard_size=" << standard_size.ToString()); |
1061 | 1061 |
1062 // Compute the expected preferred size. For the fixed-resolution use case, | 1062 // Compute the expected preferred size. For the fixed-resolution use case, |
1063 // the |oddball_size| is always the expected size; whereas for the | 1063 // the |oddball_size| is always the expected size; whereas for the |
1064 // variable-resolution cases, the |standard_size| is the expected size. | 1064 // variable-resolution cases, the |standard_size| is the expected size. |
1065 // Also, adjust to account for the device scale factor. | 1065 // Also, adjust to account for the device scale factor. |
1066 gfx::Size capture_preferred_size = gfx::ToFlooredSize(gfx::ScaleSize( | 1066 gfx::Size capture_preferred_size = gfx::ScaleToFlooredSize( |
1067 policy == media::RESOLUTION_POLICY_FIXED_RESOLUTION ? | 1067 policy == media::RESOLUTION_POLICY_FIXED_RESOLUTION ? oddball_size |
1068 oddball_size : standard_size, | 1068 : standard_size, |
1069 1.0f / GetDeviceScaleFactor())); | 1069 1.0f / GetDeviceScaleFactor()); |
1070 ASSERT_NE(capture_preferred_size, web_contents()->GetPreferredSize()); | 1070 ASSERT_NE(capture_preferred_size, web_contents()->GetPreferredSize()); |
1071 | 1071 |
1072 // Start the WebContentsVideoCaptureDevice. | 1072 // Start the WebContentsVideoCaptureDevice. |
1073 media::VideoCaptureParams capture_params; | 1073 media::VideoCaptureParams capture_params; |
1074 capture_params.requested_format.frame_size = oddball_size; | 1074 capture_params.requested_format.frame_size = oddball_size; |
1075 capture_params.requested_format.frame_rate = kTestFramesPerSecond; | 1075 capture_params.requested_format.frame_rate = kTestFramesPerSecond; |
1076 capture_params.requested_format.pixel_format = media::PIXEL_FORMAT_I420; | 1076 capture_params.requested_format.pixel_format = media::PIXEL_FORMAT_I420; |
1077 capture_params.resolution_change_policy = policy; | 1077 capture_params.resolution_change_policy = policy; |
1078 StubClientObserver unused_observer; | 1078 StubClientObserver unused_observer; |
1079 device()->AllocateAndStart(capture_params, unused_observer.PassClient()); | 1079 device()->AllocateAndStart(capture_params, unused_observer.PassClient()); |
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1135 policies[i], gfx::Size(1000, 1000), gfx::Size(1000, 1000)); | 1135 policies[i], gfx::Size(1000, 1000), gfx::Size(1000, 1000)); |
1136 RunTestForPreferredSize( | 1136 RunTestForPreferredSize( |
1137 policies[i], gfx::Size(1600, 1000), gfx::Size(1600, 1000)); | 1137 policies[i], gfx::Size(1600, 1000), gfx::Size(1600, 1000)); |
1138 RunTestForPreferredSize( | 1138 RunTestForPreferredSize( |
1139 policies[i], gfx::Size(837, 999), gfx::Size(837, 999)); | 1139 policies[i], gfx::Size(837, 999), gfx::Size(837, 999)); |
1140 } | 1140 } |
1141 } | 1141 } |
1142 | 1142 |
1143 } // namespace | 1143 } // namespace |
1144 } // namespace content | 1144 } // namespace content |
OLD | NEW |