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