| Index: cc/resources/video_resource_updater_unittest.cc
|
| diff --git a/cc/resources/video_resource_updater_unittest.cc b/cc/resources/video_resource_updater_unittest.cc
|
| index 4788e0ec77b5fc6610065fb3c49e7e96cb325818..e7c982f52487dcdb880ddc5a06b10933e346a7bf 100644
|
| --- a/cc/resources/video_resource_updater_unittest.cc
|
| +++ b/cc/resources/video_resource_updater_unittest.cc
|
| @@ -311,6 +311,40 @@ TEST_F(VideoResourceUpdaterTestWithF16, HighBitFrame) {
|
| EXPECT_NEAR(resources2.offset, 0.5, 0.1);
|
| }
|
|
|
| +class VideoResourceUpdaterTestWithR16 : public VideoResourceUpdaterTest {
|
| + public:
|
| + VideoResourceUpdaterTestWithR16() : VideoResourceUpdaterTest() {
|
| + context3d_->set_support_texture_norm16(true);
|
| + }
|
| +};
|
| +
|
| +TEST_F(VideoResourceUpdaterTestWithR16, HighBitFrame) {
|
| + bool use_stream_video_draw_quad = false;
|
| + VideoResourceUpdater updater(context_provider_.get(),
|
| + resource_provider3d_.get(),
|
| + use_stream_video_draw_quad);
|
| + updater.UseR16ForTesting(true);
|
| + resource_provider3d_->SetYUVHighbitResourceFormatForTesting(viz::R16_EXT);
|
| + scoped_refptr<media::VideoFrame> video_frame = CreateTestHighBitFrame();
|
| +
|
| + VideoFrameExternalResources resources =
|
| + updater.CreateExternalResourcesFromVideoFrame(video_frame);
|
| + EXPECT_EQ(VideoFrameExternalResources::YUV_RESOURCE, resources.type);
|
| +
|
| + // multiplier = (1 << shift) + 1.0 / (1 << (bits_per_channel - shift))
|
| + // where shift = 16 - bits_per_channel, and bits_per_channel = 10
|
| + EXPECT_NEAR(resources.multiplier, 64.0625, 0.1);
|
| + EXPECT_NEAR(resources.offset, 0.0, 0.1);
|
| +
|
| + // Create the resource again, to test the path where the
|
| + // resources are cached.
|
| + VideoFrameExternalResources resources2 =
|
| + updater.CreateExternalResourcesFromVideoFrame(video_frame);
|
| + EXPECT_EQ(VideoFrameExternalResources::YUV_RESOURCE, resources2.type);
|
| + EXPECT_NEAR(resources2.multiplier, 64.0625, 0.1);
|
| + EXPECT_NEAR(resources2.offset, 0.0, 0.1);
|
| +}
|
| +
|
| TEST_F(VideoResourceUpdaterTest, HighBitFrameSoftwareCompositor) {
|
| bool use_stream_video_draw_quad = false;
|
| VideoResourceUpdater updater(nullptr, resource_provider_software_.get(),
|
|
|