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/layer_tree_pixel_test.h" | 5 #include "cc/test/layer_tree_pixel_test.h" |
6 | 6 |
7 #include "base/path_service.h" | 7 #include "base/path_service.h" |
| 8 #include "cc/output/copy_output_request.h" |
8 #include "cc/test/paths.h" | 9 #include "cc/test/paths.h" |
9 #include "cc/test/pixel_comparator.h" | 10 #include "cc/test/pixel_comparator.h" |
10 #include "cc/test/pixel_test_utils.h" | 11 #include "cc/test/pixel_test_utils.h" |
11 #include "cc/trees/layer_tree_impl.h" | 12 #include "cc/trees/layer_tree_impl.h" |
12 #include "ui/gl/gl_implementation.h" | 13 #include "ui/gl/gl_implementation.h" |
13 #include "webkit/gpu/context_provider_in_process.h" | 14 #include "webkit/gpu/context_provider_in_process.h" |
14 #include "webkit/gpu/webgraphicscontext3d_in_process_command_buffer_impl.h" | 15 #include "webkit/gpu/webgraphicscontext3d_in_process_command_buffer_impl.h" |
15 | 16 |
16 namespace cc { | 17 namespace cc { |
17 | 18 |
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
58 | 59 |
59 EXPECT_TRUE(MatchesPNGFile(*bitmap, | 60 EXPECT_TRUE(MatchesPNGFile(*bitmap, |
60 test_data_dir.Append(ref_file_), | 61 test_data_dir.Append(ref_file_), |
61 *pixel_comparator_)); | 62 *pixel_comparator_)); |
62 EndTest(); | 63 EndTest(); |
63 } | 64 } |
64 | 65 |
65 void LayerTreePixelTest::BeginTest() { | 66 void LayerTreePixelTest::BeginTest() { |
66 Layer* target = readback_target_ ? readback_target_ | 67 Layer* target = readback_target_ ? readback_target_ |
67 : layer_tree_host()->root_layer(); | 68 : layer_tree_host()->root_layer(); |
68 target->RequestCopyAsBitmap( | 69 target->RequestCopyOfOutput(CopyOutputRequest::CreateBitmapRequest( |
69 base::Bind(&LayerTreePixelTest::ReadbackResult, | 70 base::Bind(&LayerTreePixelTest::ReadbackResult, |
70 base::Unretained(this))); | 71 base::Unretained(this)))); |
71 PostSetNeedsCommitToMainThread(); | 72 PostSetNeedsCommitToMainThread(); |
72 } | 73 } |
73 | 74 |
74 void LayerTreePixelTest::AfterTest() {} | 75 void LayerTreePixelTest::AfterTest() {} |
75 | 76 |
76 scoped_refptr<SolidColorLayer> LayerTreePixelTest::CreateSolidColorLayer( | 77 scoped_refptr<SolidColorLayer> LayerTreePixelTest::CreateSolidColorLayer( |
77 gfx::Rect rect, SkColor color) { | 78 gfx::Rect rect, SkColor color) { |
78 scoped_refptr<SolidColorLayer> layer = SolidColorLayer::Create(); | 79 scoped_refptr<SolidColorLayer> layer = SolidColorLayer::Create(); |
79 layer->SetIsDrawable(true); | 80 layer->SetIsDrawable(true); |
80 layer->SetAnchorPoint(gfx::PointF()); | 81 layer->SetAnchorPoint(gfx::PointF()); |
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
133 | 134 |
134 void LayerTreePixelTest::SetupTree() { | 135 void LayerTreePixelTest::SetupTree() { |
135 scoped_refptr<Layer> root = Layer::Create(); | 136 scoped_refptr<Layer> root = Layer::Create(); |
136 root->SetBounds(content_root_->bounds()); | 137 root->SetBounds(content_root_->bounds()); |
137 root->AddChild(content_root_); | 138 root->AddChild(content_root_); |
138 layer_tree_host()->SetRootLayer(root); | 139 layer_tree_host()->SetRootLayer(root); |
139 LayerTreeTest::SetupTree(); | 140 LayerTreeTest::SetupTree(); |
140 } | 141 } |
141 | 142 |
142 } // namespace cc | 143 } // namespace cc |
OLD | NEW |