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 13 matching lines...) Expand all Loading... |
32 gfx::Rect opaque_layer_rect_; | 33 gfx::Rect opaque_layer_rect_; |
33 }; | 34 }; |
34 | 35 |
35 TEST(ContentLayerTest, ContentLayerPainterWithDeviceScale) { | 36 TEST(ContentLayerTest, ContentLayerPainterWithDeviceScale) { |
36 float contents_scale = 2.f; | 37 float contents_scale = 2.f; |
37 gfx::Rect content_rect(10, 10, 100, 100); | 38 gfx::Rect content_rect(10, 10, 100, 100); |
38 gfx::Rect opaque_rect_in_layer_space(5, 5, 20, 20); | 39 gfx::Rect opaque_rect_in_layer_space(5, 5, 20, 20); |
39 gfx::RectF opaque_rect_in_content_space = gfx::ScaleRect( | 40 gfx::RectF opaque_rect_in_content_space = gfx::ScaleRect( |
40 opaque_rect_in_layer_space, contents_scale, contents_scale); | 41 opaque_rect_in_layer_space, contents_scale, contents_scale); |
41 MockContentLayerClient client(opaque_rect_in_layer_space); | 42 MockContentLayerClient client(opaque_rect_in_layer_space); |
| 43 FakeRenderingStatsInstrumentation stats_instrumentation; |
42 scoped_refptr<BitmapContentLayerUpdater> updater = | 44 scoped_refptr<BitmapContentLayerUpdater> updater = |
43 BitmapContentLayerUpdater::Create(ContentLayerPainter::Create(&client). | 45 BitmapContentLayerUpdater::Create( |
44 PassAs<LayerPainter>()); | 46 ContentLayerPainter::Create(&client).PassAs<LayerPainter>(), |
| 47 &stats_instrumentation); |
45 | 48 |
46 gfx::Rect resulting_opaque_rect; | 49 gfx::Rect resulting_opaque_rect; |
47 updater->PrepareToUpdate(content_rect, | 50 updater->PrepareToUpdate(content_rect, |
48 gfx::Size(256, 256), | 51 gfx::Size(256, 256), |
49 contents_scale, | 52 contents_scale, |
50 contents_scale, | 53 contents_scale, |
51 &resulting_opaque_rect, | 54 &resulting_opaque_rect); |
52 NULL); | |
53 | 55 |
54 EXPECT_RECT_EQ(gfx::ToEnclosingRect(opaque_rect_in_content_space), | 56 EXPECT_RECT_EQ(gfx::ToEnclosingRect(opaque_rect_in_content_space), |
55 resulting_opaque_rect); | 57 resulting_opaque_rect); |
56 } | 58 } |
57 | 59 |
58 } // namespace | 60 } // namespace |
59 } // namespace cc | 61 } // namespace cc |
OLD | NEW |