Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(978)

Side by Side Diff: cc/resources/video_resource_updater_unittest.cc

Issue 1134643002: Add distinction between RGB and RGBA native texture video frames and resources (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix unit test breakage from bad merge Created 5 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « cc/resources/video_resource_updater.cc ('k') | cc/trees/layer_tree_host_unittest_context.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 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 "cc/resources/video_resource_updater.h" 5 #include "cc/resources/video_resource_updater.h"
6 6
7 #include "base/memory/shared_memory.h" 7 #include "base/memory/shared_memory.h"
8 #include "cc/resources/resource_provider.h" 8 #include "cc/resources/resource_provider.h"
9 #include "cc/test/fake_output_surface.h" 9 #include "cc/test/fake_output_surface.h"
10 #include "cc/test/fake_output_surface_client.h" 10 #include "cc/test/fake_output_surface_client.h"
(...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after
118 118
119 const unsigned sync_point = 7; 119 const unsigned sync_point = 7;
120 const unsigned target = GL_TEXTURE_2D; 120 const unsigned target = GL_TEXTURE_2D;
121 return media::VideoFrame::WrapNativeTexture( 121 return media::VideoFrame::WrapNativeTexture(
122 gpu::MailboxHolder(mailbox, target, sync_point), 122 gpu::MailboxHolder(mailbox, target, sync_point),
123 base::Bind(&ReleaseMailboxCB), 123 base::Bind(&ReleaseMailboxCB),
124 size, // coded_size 124 size, // coded_size
125 gfx::Rect(size), // visible_rect 125 gfx::Rect(size), // visible_rect
126 size, // natural_size 126 size, // natural_size
127 base::TimeDelta(), // timestamp 127 base::TimeDelta(), // timestamp
128 false); // allow_overlay 128 false, // allow_overlay
129 true); // has_alpha
129 } 130 }
130 131
131 scoped_refptr<media::VideoFrame> CreateTestYUVHardareVideoFrame() { 132 scoped_refptr<media::VideoFrame> CreateTestYUVHardareVideoFrame() {
132 const int kDimension = 10; 133 const int kDimension = 10;
133 gfx::Size size(kDimension, kDimension); 134 gfx::Size size(kDimension, kDimension);
134 135
135 const int kPlanesNum = 3; 136 const int kPlanesNum = 3;
136 gpu::Mailbox mailbox[kPlanesNum]; 137 gpu::Mailbox mailbox[kPlanesNum];
137 for (int i = 0; i < kPlanesNum; ++i) { 138 for (int i = 0; i < kPlanesNum; ++i) {
138 mailbox[i].name[0] = 50 + 1; 139 mailbox[i].name[0] = 50 + 1;
(...skipping 162 matching lines...) Expand 10 before | Expand all | Expand 10 after
301 302
302 TEST_F(VideoResourceUpdaterTest, CreateForHardwarePlanes) { 303 TEST_F(VideoResourceUpdaterTest, CreateForHardwarePlanes) {
303 VideoResourceUpdater updater(output_surface3d_->context_provider(), 304 VideoResourceUpdater updater(output_surface3d_->context_provider(),
304 resource_provider3d_.get()); 305 resource_provider3d_.get());
305 306
306 scoped_refptr<media::VideoFrame> video_frame = 307 scoped_refptr<media::VideoFrame> video_frame =
307 CreateTestRGBAHardwareVideoFrame(); 308 CreateTestRGBAHardwareVideoFrame();
308 309
309 VideoFrameExternalResources resources = 310 VideoFrameExternalResources resources =
310 updater.CreateExternalResourcesFromVideoFrame(video_frame); 311 updater.CreateExternalResourcesFromVideoFrame(video_frame);
311 EXPECT_EQ(VideoFrameExternalResources::RGB_RESOURCE, resources.type); 312 EXPECT_EQ(VideoFrameExternalResources::RGBA_RESOURCE, resources.type);
312 EXPECT_EQ(1u, resources.mailboxes.size()); 313 EXPECT_EQ(1u, resources.mailboxes.size());
313 EXPECT_EQ(1u, resources.release_callbacks.size()); 314 EXPECT_EQ(1u, resources.release_callbacks.size());
314 EXPECT_EQ(0u, resources.software_resources.size()); 315 EXPECT_EQ(0u, resources.software_resources.size());
315 316
316 video_frame = CreateTestYUVHardareVideoFrame(); 317 video_frame = CreateTestYUVHardareVideoFrame();
317 318
318 resources = updater.CreateExternalResourcesFromVideoFrame(video_frame); 319 resources = updater.CreateExternalResourcesFromVideoFrame(video_frame);
319 EXPECT_EQ(VideoFrameExternalResources::YUV_RESOURCE, resources.type); 320 EXPECT_EQ(VideoFrameExternalResources::YUV_RESOURCE, resources.type);
320 EXPECT_EQ(3u, resources.mailboxes.size()); 321 EXPECT_EQ(3u, resources.mailboxes.size());
321 EXPECT_EQ(3u, resources.release_callbacks.size()); 322 EXPECT_EQ(3u, resources.release_callbacks.size());
322 EXPECT_EQ(0u, resources.software_resources.size()); 323 EXPECT_EQ(0u, resources.software_resources.size());
323 } 324 }
324 } // namespace 325 } // namespace
325 } // namespace cc 326 } // namespace cc
OLDNEW
« no previous file with comments | « cc/resources/video_resource_updater.cc ('k') | cc/trees/layer_tree_host_unittest_context.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698