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_test_utils.h" | 9 #include "cc/test/pixel_test_utils.h" |
10 #include "cc/trees/layer_tree_impl.h" | 10 #include "cc/trees/layer_tree_impl.h" |
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
59 bitmap.allocPixels(); | 59 bitmap.allocPixels(); |
60 unsigned char* pixels = static_cast<unsigned char*>(bitmap.getPixels()); | 60 unsigned char* pixels = static_cast<unsigned char*>(bitmap.getPixels()); |
61 host_impl->Readback(pixels, device_viewport_rect); | 61 host_impl->Readback(pixels, device_viewport_rect); |
62 | 62 |
63 base::FilePath test_data_dir; | 63 base::FilePath test_data_dir; |
64 EXPECT_TRUE(PathService::Get(cc::DIR_TEST_DATA, &test_data_dir)); | 64 EXPECT_TRUE(PathService::Get(cc::DIR_TEST_DATA, &test_data_dir)); |
65 | 65 |
66 // To rebaseline: | 66 // To rebaseline: |
67 // EXPECT_TRUE(WritePNGFile(bitmap, test_data_dir.Append(ref_file_))); | 67 // EXPECT_TRUE(WritePNGFile(bitmap, test_data_dir.Append(ref_file_))); |
68 | 68 |
69 EXPECT_TRUE(IsSameAsPNGFile(bitmap, test_data_dir.Append(ref_file_), true)); | 69 EXPECT_TRUE(MatchesPNGFile(bitmap, test_data_dir.Append(ref_file_), |
| 70 ExactPixelComparator(true))); |
70 | 71 |
71 EndTest(); | 72 EndTest(); |
72 } | 73 } |
73 | 74 |
74 void LayerTreePixelTest::BeginTest() { | 75 void LayerTreePixelTest::BeginTest() { |
75 PostSetNeedsCommitToMainThread(); | 76 PostSetNeedsCommitToMainThread(); |
76 } | 77 } |
77 | 78 |
78 void LayerTreePixelTest::AfterTest() {} | 79 void LayerTreePixelTest::AfterTest() {} |
79 | 80 |
(...skipping 18 matching lines...) Expand all Loading... |
98 | 99 |
99 void LayerTreePixelTest::SetupTree() { | 100 void LayerTreePixelTest::SetupTree() { |
100 scoped_refptr<Layer> root = Layer::Create(); | 101 scoped_refptr<Layer> root = Layer::Create(); |
101 root->SetBounds(content_root_->bounds()); | 102 root->SetBounds(content_root_->bounds()); |
102 root->AddChild(content_root_); | 103 root->AddChild(content_root_); |
103 layer_tree_host()->SetRootLayer(root); | 104 layer_tree_host()->SetRootLayer(root); |
104 LayerTreeTest::SetupTree(); | 105 LayerTreeTest::SetupTree(); |
105 } | 106 } |
106 | 107 |
107 } // namespace cc | 108 } // namespace cc |
OLD | NEW |