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/test/paths.h" | 8 #include "cc/test/paths.h" |
9 #include "cc/test/pixel_comparator.h" | 9 #include "cc/test/pixel_comparator.h" |
10 #include "cc/test/pixel_test_utils.h" | 10 #include "cc/test/pixel_test_utils.h" |
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
59 device_viewport_rect.width(), | 59 device_viewport_rect.width(), |
60 device_viewport_rect.height()); | 60 device_viewport_rect.height()); |
61 bitmap.allocPixels(); | 61 bitmap.allocPixels(); |
62 unsigned char* pixels = static_cast<unsigned char*>(bitmap.getPixels()); | 62 unsigned char* pixels = static_cast<unsigned char*>(bitmap.getPixels()); |
63 host_impl->Readback(pixels, device_viewport_rect); | 63 host_impl->Readback(pixels, device_viewport_rect); |
64 | 64 |
65 base::FilePath test_data_dir; | 65 base::FilePath test_data_dir; |
66 EXPECT_TRUE(PathService::Get(cc::DIR_TEST_DATA, &test_data_dir)); | 66 EXPECT_TRUE(PathService::Get(cc::DIR_TEST_DATA, &test_data_dir)); |
67 | 67 |
68 // To rebaseline: | 68 // To rebaseline: |
69 // EXPECT_TRUE(WritePNGFile(bitmap, test_data_dir.Append(ref_file_))); | 69 // EXPECT_TRUE(WritePNGFile(bitmap, test_data_dir.Append(ref_file_), true)); |
70 | 70 |
71 EXPECT_TRUE(MatchesPNGFile(bitmap, | 71 EXPECT_TRUE(MatchesPNGFile(bitmap, |
72 test_data_dir.Append(ref_file_), | 72 test_data_dir.Append(ref_file_), |
73 *pixel_comparator_)); | 73 *pixel_comparator_)); |
74 | 74 |
75 EndTest(); | 75 EndTest(); |
76 } | 76 } |
77 | 77 |
78 void LayerTreePixelTest::BeginTest() { | 78 void LayerTreePixelTest::BeginTest() { |
79 PostSetNeedsCommitToMainThread(); | 79 PostSetNeedsCommitToMainThread(); |
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
130 | 130 |
131 void LayerTreePixelTest::SetupTree() { | 131 void LayerTreePixelTest::SetupTree() { |
132 scoped_refptr<Layer> root = Layer::Create(); | 132 scoped_refptr<Layer> root = Layer::Create(); |
133 root->SetBounds(content_root_->bounds()); | 133 root->SetBounds(content_root_->bounds()); |
134 root->AddChild(content_root_); | 134 root->AddChild(content_root_); |
135 layer_tree_host()->SetRootLayer(root); | 135 layer_tree_host()->SetRootLayer(root); |
136 LayerTreeTest::SetupTree(); | 136 LayerTreeTest::SetupTree(); |
137 } | 137 } |
138 | 138 |
139 } // namespace cc | 139 } // namespace cc |
OLD | NEW |