OLD | NEW |
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/debug/test_web_graphics_context_3d.h" | 8 #include "cc/debug/test_web_graphics_context_3d.h" |
9 #include "cc/resources/resource_provider.h" | 9 #include "cc/resources/resource_provider.h" |
10 #include "cc/test/fake_output_surface.h" | 10 #include "cc/test/fake_output_surface.h" |
11 #include "cc/test/fake_output_surface_client.h" | 11 #include "cc/test/fake_output_surface_client.h" |
12 #include "media/base/video_frame.h" | 12 #include "media/base/video_frame.h" |
13 #include "testing/gtest/include/gtest/gtest.h" | 13 #include "testing/gtest/include/gtest/gtest.h" |
14 | 14 |
15 namespace cc { | 15 namespace cc { |
16 namespace { | 16 namespace { |
17 | 17 |
18 class VideoResourceUpdaterTest : public testing::Test { | 18 class VideoResourceUpdaterTest : public testing::Test { |
19 protected: | 19 protected: |
20 VideoResourceUpdaterTest() { | 20 VideoResourceUpdaterTest() { |
21 scoped_ptr<TestWebGraphicsContext3D> context3d = | 21 scoped_ptr<TestWebGraphicsContext3D> context3d = |
22 TestWebGraphicsContext3D::Create(); | 22 TestWebGraphicsContext3D::Create(); |
23 context3d_ = context3d.get(); | 23 context3d_ = context3d.get(); |
24 | 24 |
25 output_surface3d_ = | 25 output_surface3d_ = |
26 FakeOutputSurface::Create3d(context3d.Pass()); | 26 FakeOutputSurface::Create3d(context3d.Pass()); |
27 CHECK(output_surface3d_->BindToClient(&client_)); | 27 CHECK(output_surface3d_->BindToClient(&client_)); |
28 resource_provider3d_ = | 28 resource_provider3d_ = |
29 ResourceProvider::Create(output_surface3d_.get(), 0); | 29 ResourceProvider::Create(output_surface3d_.get(), 0, false); |
30 } | 30 } |
31 | 31 |
32 scoped_refptr<media::VideoFrame> CreateTestYUVVideoFrame() { | 32 scoped_refptr<media::VideoFrame> CreateTestYUVVideoFrame() { |
33 const int kDimension = 10; | 33 const int kDimension = 10; |
34 gfx::Size size(kDimension, kDimension); | 34 gfx::Size size(kDimension, kDimension); |
35 static uint8 y_data[kDimension * kDimension] = { 0 }; | 35 static uint8 y_data[kDimension * kDimension] = { 0 }; |
36 static uint8 u_data[kDimension * kDimension / 2] = { 0 }; | 36 static uint8 u_data[kDimension * kDimension / 2] = { 0 }; |
37 static uint8 v_data[kDimension * kDimension / 2] = { 0 }; | 37 static uint8 v_data[kDimension * kDimension / 2] = { 0 }; |
38 | 38 |
39 return media::VideoFrame::WrapExternalYuvData( | 39 return media::VideoFrame::WrapExternalYuvData( |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
75 // Fail while creating the mailbox for the second YUV plane. | 75 // Fail while creating the mailbox for the second YUV plane. |
76 context3d_->set_times_gen_mailbox_succeeds(1); | 76 context3d_->set_times_gen_mailbox_succeeds(1); |
77 | 77 |
78 VideoFrameExternalResources resources = | 78 VideoFrameExternalResources resources = |
79 updater.CreateExternalResourcesFromVideoFrame(video_frame); | 79 updater.CreateExternalResourcesFromVideoFrame(video_frame); |
80 EXPECT_EQ(VideoFrameExternalResources::NONE, resources.type); | 80 EXPECT_EQ(VideoFrameExternalResources::NONE, resources.type); |
81 } | 81 } |
82 | 82 |
83 } // namespace | 83 } // namespace |
84 } // namespace cc | 84 } // namespace cc |
OLD | NEW |