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/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 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
43 VideoResourceUpdaterTest() { | 43 VideoResourceUpdaterTest() { |
44 scoped_ptr<WebGraphicsContext3DUploadCounter> context3d( | 44 scoped_ptr<WebGraphicsContext3DUploadCounter> context3d( |
45 new WebGraphicsContext3DUploadCounter()); | 45 new WebGraphicsContext3DUploadCounter()); |
46 | 46 |
47 context3d_ = context3d.get(); | 47 context3d_ = context3d.get(); |
48 | 48 |
49 output_surface3d_ = | 49 output_surface3d_ = |
50 FakeOutputSurface::Create3d(context3d.Pass()); | 50 FakeOutputSurface::Create3d(context3d.Pass()); |
51 CHECK(output_surface3d_->BindToClient(&client_)); | 51 CHECK(output_surface3d_->BindToClient(&client_)); |
52 shared_bitmap_manager_.reset(new TestSharedBitmapManager()); | 52 shared_bitmap_manager_.reset(new TestSharedBitmapManager()); |
53 resource_provider3d_ = | 53 resource_provider3d_ = ResourceProvider::Create( |
54 ResourceProvider::Create(output_surface3d_.get(), | 54 output_surface3d_.get(), shared_bitmap_manager_.get(), NULL, NULL, 0, |
55 shared_bitmap_manager_.get(), | 55 false, false, 1); |
56 NULL, | |
57 NULL, | |
58 0, | |
59 false, | |
60 1); | |
61 } | 56 } |
62 | 57 |
63 scoped_refptr<media::VideoFrame> CreateTestYUVVideoFrame() { | 58 scoped_refptr<media::VideoFrame> CreateTestYUVVideoFrame() { |
64 const int kDimension = 10; | 59 const int kDimension = 10; |
65 gfx::Size size(kDimension, kDimension); | 60 gfx::Size size(kDimension, kDimension); |
66 static uint8 y_data[kDimension * kDimension] = { 0 }; | 61 static uint8 y_data[kDimension * kDimension] = { 0 }; |
67 static uint8 u_data[kDimension * kDimension / 2] = { 0 }; | 62 static uint8 u_data[kDimension * kDimension / 2] = { 0 }; |
68 static uint8 v_data[kDimension * kDimension / 2] = { 0 }; | 63 static uint8 v_data[kDimension * kDimension / 2] = { 0 }; |
69 | 64 |
70 return media::VideoFrame::WrapExternalYuvData( | 65 return media::VideoFrame::WrapExternalYuvData( |
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
141 resources = updater.CreateExternalResourcesFromVideoFrame(video_frame); | 136 resources = updater.CreateExternalResourcesFromVideoFrame(video_frame); |
142 EXPECT_EQ(VideoFrameExternalResources::YUV_RESOURCE, resources.type); | 137 EXPECT_EQ(VideoFrameExternalResources::YUV_RESOURCE, resources.type); |
143 EXPECT_EQ(size_t(3), resources.mailboxes.size()); | 138 EXPECT_EQ(size_t(3), resources.mailboxes.size()); |
144 EXPECT_EQ(size_t(3), resources.release_callbacks.size()); | 139 EXPECT_EQ(size_t(3), resources.release_callbacks.size()); |
145 // The data should be reused so expect no texture uploads. | 140 // The data should be reused so expect no texture uploads. |
146 EXPECT_EQ(0, context3d_->UploadCount()); | 141 EXPECT_EQ(0, context3d_->UploadCount()); |
147 } | 142 } |
148 | 143 |
149 } // namespace | 144 } // namespace |
150 } // namespace cc | 145 } // namespace cc |
OLD | NEW |