Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(39)

Side by Side Diff: cc/layers/content_layer_unittest.cc

Issue 12426024: cc: Switch RenderingStats collection in Layer::Update() to RenderingStatsInstrumentation (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Rebase to 190965 Created 7 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « cc/layers/content_layer.cc ('k') | cc/layers/contents_scaling_layer.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 namespace cc { 15 namespace cc {
15 namespace { 16 namespace {
16 17
17 class MockContentLayerClient : public ContentLayerClient { 18 class MockContentLayerClient : public ContentLayerClient {
18 public: 19 public:
(...skipping 11 matching lines...) Expand all
30 gfx::Rect opaque_layer_rect_; 31 gfx::Rect opaque_layer_rect_;
31 }; 32 };
32 33
33 TEST(ContentLayerTest, ContentLayerPainterWithDeviceScale) { 34 TEST(ContentLayerTest, ContentLayerPainterWithDeviceScale) {
34 float contents_scale = 2.f; 35 float contents_scale = 2.f;
35 gfx::Rect content_rect(10, 10, 100, 100); 36 gfx::Rect content_rect(10, 10, 100, 100);
36 gfx::Rect opaque_rect_in_layer_space(5, 5, 20, 20); 37 gfx::Rect opaque_rect_in_layer_space(5, 5, 20, 20);
37 gfx::RectF opaque_rect_in_content_space = gfx::ScaleRect( 38 gfx::RectF opaque_rect_in_content_space = gfx::ScaleRect(
38 opaque_rect_in_layer_space, contents_scale, contents_scale); 39 opaque_rect_in_layer_space, contents_scale, contents_scale);
39 MockContentLayerClient client(opaque_rect_in_layer_space); 40 MockContentLayerClient client(opaque_rect_in_layer_space);
41 FakeRenderingStatsInstrumentation stats_instrumentation;
40 scoped_refptr<BitmapContentLayerUpdater> updater = 42 scoped_refptr<BitmapContentLayerUpdater> updater =
41 BitmapContentLayerUpdater::Create(ContentLayerPainter::Create(&client). 43 BitmapContentLayerUpdater::Create(
42 PassAs<LayerPainter>()); 44 ContentLayerPainter::Create(&client).PassAs<LayerPainter>(),
45 &stats_instrumentation);
43 46
44 gfx::Rect resulting_opaque_rect; 47 gfx::Rect resulting_opaque_rect;
45 updater->PrepareToUpdate(content_rect, 48 updater->PrepareToUpdate(content_rect,
46 gfx::Size(256, 256), 49 gfx::Size(256, 256),
47 contents_scale, 50 contents_scale,
48 contents_scale, 51 contents_scale,
49 &resulting_opaque_rect, 52 &resulting_opaque_rect);
50 NULL);
51 53
52 EXPECT_RECT_EQ(gfx::ToEnclosingRect(opaque_rect_in_content_space), 54 EXPECT_RECT_EQ(gfx::ToEnclosingRect(opaque_rect_in_content_space),
53 resulting_opaque_rect); 55 resulting_opaque_rect);
54 } 56 }
55 57
56 } // namespace 58 } // namespace
57 } // namespace cc 59 } // namespace cc
OLDNEW
« no previous file with comments | « cc/layers/content_layer.cc ('k') | cc/layers/contents_scaling_layer.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698