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