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/test/pixel_test.h" | 5 #include "cc/test/pixel_test.h" |
6 | 6 |
7 #include "base/path_service.h" | 7 #include "base/path_service.h" |
8 #include "base/run_loop.h" | 8 #include "base/run_loop.h" |
9 #include "cc/output/compositor_frame_metadata.h" | 9 #include "cc/output/compositor_frame_metadata.h" |
| 10 #include "cc/output/copy_output_request.h" |
10 #include "cc/output/gl_renderer.h" | 11 #include "cc/output/gl_renderer.h" |
11 #include "cc/output/output_surface.h" | 12 #include "cc/output/output_surface.h" |
12 #include "cc/output/software_renderer.h" | 13 #include "cc/output/software_renderer.h" |
13 #include "cc/resources/resource_provider.h" | 14 #include "cc/resources/resource_provider.h" |
14 #include "cc/test/paths.h" | 15 #include "cc/test/paths.h" |
15 #include "cc/test/pixel_test_utils.h" | 16 #include "cc/test/pixel_test_utils.h" |
16 #include "testing/gtest/include/gtest/gtest.h" | 17 #include "testing/gtest/include/gtest/gtest.h" |
17 #include "ui/gl/gl_implementation.h" | 18 #include "ui/gl/gl_implementation.h" |
18 #include "webkit/gpu/context_provider_in_process.h" | 19 #include "webkit/gpu/context_provider_in_process.h" |
19 #include "webkit/gpu/webgraphicscontext3d_in_process_command_buffer_impl.h" | 20 #include "webkit/gpu/webgraphicscontext3d_in_process_command_buffer_impl.h" |
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
67 comparator); | 68 comparator); |
68 } | 69 } |
69 | 70 |
70 bool PixelTest::RunPixelTestWithReadbackTarget( | 71 bool PixelTest::RunPixelTestWithReadbackTarget( |
71 RenderPassList* pass_list, | 72 RenderPassList* pass_list, |
72 RenderPass* target, | 73 RenderPass* target, |
73 const base::FilePath& ref_file, | 74 const base::FilePath& ref_file, |
74 const PixelComparator& comparator) { | 75 const PixelComparator& comparator) { |
75 base::RunLoop run_loop; | 76 base::RunLoop run_loop; |
76 | 77 |
77 target->copy_callbacks.push_back( | 78 target->copy_requests.push_back(CopyOutputRequest::CreateBitmapRequest( |
78 base::Bind(&PixelTest::ReadbackResult, | 79 base::Bind(&PixelTest::ReadbackResult, |
79 base::Unretained(this), | 80 base::Unretained(this), |
80 run_loop.QuitClosure())); | 81 run_loop.QuitClosure()))); |
81 | 82 |
82 renderer_->DecideRenderPassAllocationsForFrame(*pass_list); | 83 renderer_->DecideRenderPassAllocationsForFrame(*pass_list); |
83 renderer_->DrawFrame(pass_list); | 84 renderer_->DrawFrame(pass_list); |
84 | 85 |
85 // Wait for the readback to complete. | 86 // Wait for the readback to complete. |
86 resource_provider_->Finish(); | 87 resource_provider_->Finish(); |
87 run_loop.Run(); | 88 run_loop.Run(); |
88 | 89 |
89 return PixelsMatchReference(ref_file, comparator); | 90 return PixelsMatchReference(ref_file, comparator); |
90 } | 91 } |
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
142 scoped_ptr<SoftwareOutputDevice> device(new SoftwareOutputDevice()); | 143 scoped_ptr<SoftwareOutputDevice> device(new SoftwareOutputDevice()); |
143 output_surface_.reset(new OutputSurface(device.Pass())); | 144 output_surface_.reset(new OutputSurface(device.Pass())); |
144 resource_provider_ = ResourceProvider::Create(output_surface_.get(), 0); | 145 resource_provider_ = ResourceProvider::Create(output_surface_.get(), 0); |
145 renderer_ = SoftwareRenderer::Create( | 146 renderer_ = SoftwareRenderer::Create( |
146 fake_client_.get(), | 147 fake_client_.get(), |
147 output_surface_.get(), | 148 output_surface_.get(), |
148 resource_provider_.get()).PassAs<DirectRenderer>(); | 149 resource_provider_.get()).PassAs<DirectRenderer>(); |
149 } | 150 } |
150 | 151 |
151 } // namespace cc | 152 } // namespace cc |
OLD | NEW |