OLD | NEW |
1 // Copyright 2012 The Chromium Authors. All rights reserved. | 1 // Copyright 2012 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/layers/content_layer.h" | 5 #include "cc/layers/content_layer.h" |
6 | 6 |
7 #include "cc/layers/content_layer_client.h" | 7 #include "cc/layers/content_layer_client.h" |
8 #include "cc/resources/bitmap_content_layer_updater.h" | 8 #include "cc/resources/bitmap_content_layer_updater.h" |
| 9 #include "cc/test/fake_rendering_stats_instrumentation.h" |
9 #include "cc/test/geometry_test_utils.h" | 10 #include "cc/test/geometry_test_utils.h" |
10 #include "skia/ext/platform_canvas.h" | 11 #include "skia/ext/platform_canvas.h" |
11 #include "testing/gtest/include/gtest/gtest.h" | 12 #include "testing/gtest/include/gtest/gtest.h" |
12 #include "ui/gfx/rect_conversions.h" | 13 #include "ui/gfx/rect_conversions.h" |
13 | 14 |
14 using namespace WebKit; | 15 using namespace WebKit; |
15 | 16 |
16 namespace cc { | 17 namespace cc { |
17 namespace { | 18 namespace { |
18 | 19 |
(...skipping 12 matching lines...) Expand all Loading... |
31 gfx::Rect opaque_layer_rect_; | 32 gfx::Rect opaque_layer_rect_; |
32 }; | 33 }; |
33 | 34 |
34 TEST(ContentLayerTest, ContentLayerPainterWithDeviceScale) { | 35 TEST(ContentLayerTest, ContentLayerPainterWithDeviceScale) { |
35 float contents_scale = 2.f; | 36 float contents_scale = 2.f; |
36 gfx::Rect content_rect(10, 10, 100, 100); | 37 gfx::Rect content_rect(10, 10, 100, 100); |
37 gfx::Rect opaque_rect_in_layer_space(5, 5, 20, 20); | 38 gfx::Rect opaque_rect_in_layer_space(5, 5, 20, 20); |
38 gfx::RectF opaque_rect_in_content_space = gfx::ScaleRect( | 39 gfx::RectF opaque_rect_in_content_space = gfx::ScaleRect( |
39 opaque_rect_in_layer_space, contents_scale, contents_scale); | 40 opaque_rect_in_layer_space, contents_scale, contents_scale); |
40 MockContentLayerClient client(opaque_rect_in_layer_space); | 41 MockContentLayerClient client(opaque_rect_in_layer_space); |
| 42 FakeRenderingStatsInstrumentation stats_instrumentation; |
41 scoped_refptr<BitmapContentLayerUpdater> updater = | 43 scoped_refptr<BitmapContentLayerUpdater> updater = |
42 BitmapContentLayerUpdater::Create(ContentLayerPainter::Create(&client). | 44 BitmapContentLayerUpdater::Create( |
43 PassAs<LayerPainter>()); | 45 ContentLayerPainter::Create(&client).PassAs<LayerPainter>(), |
| 46 &stats_instrumentation); |
44 | 47 |
45 gfx::Rect resulting_opaque_rect; | 48 gfx::Rect resulting_opaque_rect; |
46 updater->PrepareToUpdate(content_rect, | 49 updater->PrepareToUpdate(content_rect, |
47 gfx::Size(256, 256), | 50 gfx::Size(256, 256), |
48 contents_scale, | 51 contents_scale, |
49 contents_scale, | 52 contents_scale, |
50 &resulting_opaque_rect, | 53 &resulting_opaque_rect); |
51 NULL); | |
52 | 54 |
53 EXPECT_RECT_EQ(gfx::ToEnclosingRect(opaque_rect_in_content_space), | 55 EXPECT_RECT_EQ(gfx::ToEnclosingRect(opaque_rect_in_content_space), |
54 resulting_opaque_rect); | 56 resulting_opaque_rect); |
55 } | 57 } |
56 | 58 |
57 } // namespace | 59 } // namespace |
58 } // namespace cc | 60 } // namespace cc |
OLD | NEW |