OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 "build/build_config.h" | 5 #include "build/build_config.h" |
6 #include "cc/layers/content_layer_client.h" | 6 #include "cc/layers/content_layer_client.h" |
7 #include "cc/layers/picture_image_layer.h" | 7 #include "cc/layers/picture_image_layer.h" |
8 #include "cc/layers/picture_layer.h" | 8 #include "cc/layers/picture_layer.h" |
9 #include "cc/layers/solid_color_layer.h" | 9 #include "cc/layers/solid_color_layer.h" |
10 #include "cc/test/fake_content_layer_client.h" | 10 #include "cc/test/fake_content_layer_client.h" |
(...skipping 18 matching lines...) Expand all Loading... |
29 } | 29 } |
30 }; | 30 }; |
31 | 31 |
32 TEST_F(LayerTreeHostSynchronousPixelTest, OneContentLayer) { | 32 TEST_F(LayerTreeHostSynchronousPixelTest, OneContentLayer) { |
33 gfx::Size bounds(200, 200); | 33 gfx::Size bounds(200, 200); |
34 | 34 |
35 FakeContentLayerClient client; | 35 FakeContentLayerClient client; |
36 SkPaint green_paint; | 36 SkPaint green_paint; |
37 green_paint.setColor(SkColorSetARGB(255, 0, 255, 0)); | 37 green_paint.setColor(SkColorSetARGB(255, 0, 255, 0)); |
38 client.add_draw_rect(gfx::RectF(bounds), green_paint); | 38 client.add_draw_rect(gfx::RectF(bounds), green_paint); |
39 scoped_refptr<PictureLayer> root = PictureLayer::Create(&client); | 39 scoped_refptr<PictureLayer> root = |
| 40 PictureLayer::Create(layer_settings(), &client); |
40 root->SetBounds(bounds); | 41 root->SetBounds(bounds); |
41 root->SetIsDrawable(true); | 42 root->SetIsDrawable(true); |
42 | 43 |
43 RunSingleThreadedPixelTest( | 44 RunSingleThreadedPixelTest( |
44 PIXEL_TEST_GL, root, base::FilePath(FILE_PATH_LITERAL("green.png"))); | 45 PIXEL_TEST_GL, root, base::FilePath(FILE_PATH_LITERAL("green.png"))); |
45 } | 46 } |
46 | 47 |
47 class LayerTreeHostSynchronousGPUPixelTest : public LayerTreePixelTest { | 48 class LayerTreeHostSynchronousGPUPixelTest : public LayerTreePixelTest { |
48 public: | 49 public: |
49 void InitializeSettings(LayerTreeSettings* settings) override { | 50 void InitializeSettings(LayerTreeSettings* settings) override { |
50 LayerTreePixelTest::InitializeSettings(settings); | 51 LayerTreePixelTest::InitializeSettings(settings); |
51 settings->single_thread_proxy_scheduler = false; | 52 settings->single_thread_proxy_scheduler = false; |
52 settings->gpu_rasterization_enabled = true; | 53 settings->gpu_rasterization_enabled = true; |
53 settings->gpu_rasterization_forced = true; | 54 settings->gpu_rasterization_forced = true; |
54 } | 55 } |
55 | 56 |
56 void BeginTest() override { | 57 void BeginTest() override { |
57 LayerTreePixelTest::BeginTest(); | 58 LayerTreePixelTest::BeginTest(); |
58 PostCompositeImmediatelyToMainThread(); | 59 PostCompositeImmediatelyToMainThread(); |
59 } | 60 } |
60 }; | 61 }; |
61 | 62 |
62 TEST_F(LayerTreeHostSynchronousGPUPixelTest, OneContentLayer) { | 63 TEST_F(LayerTreeHostSynchronousGPUPixelTest, OneContentLayer) { |
63 gfx::Size bounds(200, 200); | 64 gfx::Size bounds(200, 200); |
64 | 65 |
65 FakeContentLayerClient client; | 66 FakeContentLayerClient client; |
66 SkPaint green_paint; | 67 SkPaint green_paint; |
67 green_paint.setColor(SkColorSetARGB(255, 0, 255, 0)); | 68 green_paint.setColor(SkColorSetARGB(255, 0, 255, 0)); |
68 client.add_draw_rect(gfx::RectF(bounds), green_paint); | 69 client.add_draw_rect(gfx::RectF(bounds), green_paint); |
69 scoped_refptr<PictureLayer> root = PictureLayer::Create(&client); | 70 scoped_refptr<PictureLayer> root = |
| 71 PictureLayer::Create(layer_settings(), &client); |
70 root->SetBounds(bounds); | 72 root->SetBounds(bounds); |
71 root->SetIsDrawable(true); | 73 root->SetIsDrawable(true); |
72 | 74 |
73 RunSingleThreadedPixelTest(PIXEL_TEST_GL, root, | 75 RunSingleThreadedPixelTest(PIXEL_TEST_GL, root, |
74 base::FilePath(FILE_PATH_LITERAL("green.png"))); | 76 base::FilePath(FILE_PATH_LITERAL("green.png"))); |
75 } | 77 } |
76 | 78 |
77 } // namespace | 79 } // namespace |
78 } // namespace cc | 80 } // namespace cc |
79 | 81 |
80 #endif // OS_ANDROID | 82 #endif // OS_ANDROID |
OLD | NEW |