| 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 <stddef.h> | 7 #include <stddef.h> |
| 8 #include <stdint.h> | 8 #include <stdint.h> |
| 9 | 9 |
| 10 #include "base/command_line.h" | 10 #include "base/command_line.h" |
| (...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 98 } | 98 } |
| 99 | 99 |
| 100 void LayerTreePixelTest::ReadbackResult( | 100 void LayerTreePixelTest::ReadbackResult( |
| 101 std::unique_ptr<CopyOutputResult> result) { | 101 std::unique_ptr<CopyOutputResult> result) { |
| 102 ASSERT_TRUE(result->HasBitmap()); | 102 ASSERT_TRUE(result->HasBitmap()); |
| 103 result_bitmap_ = result->TakeBitmap(); | 103 result_bitmap_ = result->TakeBitmap(); |
| 104 EndTest(); | 104 EndTest(); |
| 105 } | 105 } |
| 106 | 106 |
| 107 void LayerTreePixelTest::BeginTest() { | 107 void LayerTreePixelTest::BeginTest() { |
| 108 Layer* target = readback_target_ ? readback_target_ | 108 Layer* target = |
| 109 : layer_tree_host()->root_layer(); | 109 readback_target_ ? readback_target_ : layer_tree()->root_layer(); |
| 110 target->RequestCopyOfOutput(CreateCopyOutputRequest()); | 110 target->RequestCopyOfOutput(CreateCopyOutputRequest()); |
| 111 PostSetNeedsCommitToMainThread(); | 111 PostSetNeedsCommitToMainThread(); |
| 112 } | 112 } |
| 113 | 113 |
| 114 void LayerTreePixelTest::AfterTest() { | 114 void LayerTreePixelTest::AfterTest() { |
| 115 base::FilePath test_data_dir; | 115 base::FilePath test_data_dir; |
| 116 EXPECT_TRUE(PathService::Get(CCPaths::DIR_TEST_DATA, &test_data_dir)); | 116 EXPECT_TRUE(PathService::Get(CCPaths::DIR_TEST_DATA, &test_data_dir)); |
| 117 base::FilePath ref_file_path = test_data_dir.Append(ref_file_); | 117 base::FilePath ref_file_path = test_data_dir.Append(ref_file_); |
| 118 | 118 |
| 119 base::CommandLine* cmd = base::CommandLine::ForCurrentProcess(); | 119 base::CommandLine* cmd = base::CommandLine::ForCurrentProcess(); |
| (...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 212 content_root_ = content_root; | 212 content_root_ = content_root; |
| 213 readback_target_ = target; | 213 readback_target_ = target; |
| 214 ref_file_ = file_name; | 214 ref_file_ = file_name; |
| 215 RunTest(CompositorMode::THREADED); | 215 RunTest(CompositorMode::THREADED); |
| 216 } | 216 } |
| 217 | 217 |
| 218 void LayerTreePixelTest::SetupTree() { | 218 void LayerTreePixelTest::SetupTree() { |
| 219 scoped_refptr<Layer> root = Layer::Create(); | 219 scoped_refptr<Layer> root = Layer::Create(); |
| 220 root->SetBounds(content_root_->bounds()); | 220 root->SetBounds(content_root_->bounds()); |
| 221 root->AddChild(content_root_); | 221 root->AddChild(content_root_); |
| 222 layer_tree_host()->SetRootLayer(root); | 222 layer_tree()->SetRootLayer(root); |
| 223 LayerTreeTest::SetupTree(); | 223 LayerTreeTest::SetupTree(); |
| 224 } | 224 } |
| 225 | 225 |
| 226 std::unique_ptr<SkBitmap> LayerTreePixelTest::CopyTextureMailboxToBitmap( | 226 std::unique_ptr<SkBitmap> LayerTreePixelTest::CopyTextureMailboxToBitmap( |
| 227 const gfx::Size& size, | 227 const gfx::Size& size, |
| 228 const TextureMailbox& texture_mailbox) { | 228 const TextureMailbox& texture_mailbox) { |
| 229 DCHECK(texture_mailbox.IsTexture()); | 229 DCHECK(texture_mailbox.IsTexture()); |
| 230 if (!texture_mailbox.IsTexture()) | 230 if (!texture_mailbox.IsTexture()) |
| 231 return nullptr; | 231 return nullptr; |
| 232 | 232 |
| (...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 290 } | 290 } |
| 291 | 291 |
| 292 void LayerTreePixelTest::Finish() { | 292 void LayerTreePixelTest::Finish() { |
| 293 std::unique_ptr<gpu::GLInProcessContext> context = | 293 std::unique_ptr<gpu::GLInProcessContext> context = |
| 294 CreateTestInProcessContext(); | 294 CreateTestInProcessContext(); |
| 295 GLES2Interface* gl = context->GetImplementation(); | 295 GLES2Interface* gl = context->GetImplementation(); |
| 296 gl->Finish(); | 296 gl->Finish(); |
| 297 } | 297 } |
| 298 | 298 |
| 299 } // namespace cc | 299 } // namespace cc |
| OLD | NEW |