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

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

Issue 22645005: media::VideoFrame::WrapExternalSharedMemory (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@git-svn
Patch Set: 87b7a18a Rebase, added TODO Created 7 years, 4 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 | « no previous file | content/browser/renderer_host/media/video_capture_buffer_pool.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/test_web_graphics_context_3d.h" 10 #include "cc/test/test_web_graphics_context_3d.h"
(...skipping 18 matching lines...) Expand all
29 29
30 scoped_refptr<media::VideoFrame> CreateTestYUVVideoFrame() { 30 scoped_refptr<media::VideoFrame> CreateTestYUVVideoFrame() {
31 const int kDimension = 10; 31 const int kDimension = 10;
32 gfx::Size size(kDimension, kDimension); 32 gfx::Size size(kDimension, kDimension);
33 static uint8 y_data[kDimension * kDimension] = { 0 }; 33 static uint8 y_data[kDimension * kDimension] = { 0 };
34 static uint8 u_data[kDimension * kDimension / 2] = { 0 }; 34 static uint8 u_data[kDimension * kDimension / 2] = { 0 };
35 static uint8 v_data[kDimension * kDimension / 2] = { 0 }; 35 static uint8 v_data[kDimension * kDimension / 2] = { 0 };
36 36
37 return media::VideoFrame::WrapExternalYuvData( 37 return media::VideoFrame::WrapExternalYuvData(
38 media::VideoFrame::YV16, // format 38 media::VideoFrame::YV16, // format
39 size, // coded_size 39 size, // coded_size
40 gfx::Rect(size), // visible_rect 40 gfx::Rect(size), // visible_rect
41 size, // natural_size 41 size, // natural_size
42 size.width(), // y_stride 42 size.width(), // y_stride
43 size.width() / 2, // u_stride 43 size.width() / 2, // u_stride
44 size.width() / 2, // v_stride 44 size.width() / 2, // v_stride
45 y_data, // y_data 45 y_data, // y_data
46 u_data, // u_data 46 u_data, // u_data
47 v_data, // v_data 47 v_data, // v_data
48 base::TimeDelta(), // timestamp, 48 base::TimeDelta(), // timestamp,
49 base::SharedMemory::NULLHandle(), // shm_handle 49 base::Closure()); // no_longer_needed_cb
50 base::Closure()); // no_longer_needed_cb
51 } 50 }
52 51
53 TestWebGraphicsContext3D* context3d_; 52 TestWebGraphicsContext3D* context3d_;
54 scoped_ptr<FakeOutputSurface> output_surface3d_; 53 scoped_ptr<FakeOutputSurface> output_surface3d_;
55 scoped_ptr<ResourceProvider> resource_provider3d_; 54 scoped_ptr<ResourceProvider> resource_provider3d_;
56 }; 55 };
57 56
58 TEST_F(VideoResourceUpdaterTest, SoftwareFrame) { 57 TEST_F(VideoResourceUpdaterTest, SoftwareFrame) {
59 VideoResourceUpdater updater(resource_provider3d_.get()); 58 VideoResourceUpdater updater(resource_provider3d_.get());
60 scoped_refptr<media::VideoFrame> video_frame = CreateTestYUVVideoFrame(); 59 scoped_refptr<media::VideoFrame> video_frame = CreateTestYUVVideoFrame();
(...skipping 10 matching lines...) Expand all
71 // Fail while creating the mailbox for the second YUV plane. 70 // Fail while creating the mailbox for the second YUV plane.
72 context3d_->set_times_gen_mailbox_succeeds(1); 71 context3d_->set_times_gen_mailbox_succeeds(1);
73 72
74 VideoFrameExternalResources resources = 73 VideoFrameExternalResources resources =
75 updater.CreateExternalResourcesFromVideoFrame(video_frame); 74 updater.CreateExternalResourcesFromVideoFrame(video_frame);
76 EXPECT_EQ(VideoFrameExternalResources::NONE, resources.type); 75 EXPECT_EQ(VideoFrameExternalResources::NONE, resources.type);
77 } 76 }
78 77
79 } // namespace 78 } // namespace
80 } // namespace cc 79 } // namespace cc
OLDNEW
« no previous file with comments | « no previous file | content/browser/renderer_host/media/video_capture_buffer_pool.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698