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

Unified Diff: cc/picture_layer_tiling_set_unittest.cc

Issue 11417111: cc: Add PictureLayerTilingSet to manage PictureLayerTiling (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix win_rel Created 8 years, 1 month 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « cc/picture_layer_tiling_set.cc ('k') | cc/picture_layer_tiling_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: cc/picture_layer_tiling_set_unittest.cc
diff --git a/cc/picture_layer_tiling_set_unittest.cc b/cc/picture_layer_tiling_set_unittest.cc
new file mode 100644
index 0000000000000000000000000000000000000000..8b0aa72c5dd75dac89d0d30e672c9b8e939d8aab
--- /dev/null
+++ b/cc/picture_layer_tiling_set_unittest.cc
@@ -0,0 +1,44 @@
+// Copyright 2012 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "cc/picture_layer_tiling_set.h"
+
+#include "cc/test/fake_picture_layer_tiling_client.h"
+#include "testing/gtest/include/gtest/gtest.h"
+#include "ui/gfx/size_conversions.h"
+
+namespace cc {
+
+TEST(PictureLayerTilingSetTest, NoResources) {
+ FakePictureLayerTilingClient client;
+ PictureLayerTilingSet set(&client);
+ gfx::Size default_tile_size(256, 256);
+
+ gfx::Size layer_bounds(1000, 800);
+ set.SetLayerBounds(layer_bounds);
+
+ set.AddTiling(1.0, default_tile_size);
+ set.AddTiling(1.5, default_tile_size);
+ set.AddTiling(2.0, default_tile_size);
+
+ float contents_scale = 2.0;
+ gfx::Size content_bounds(
+ gfx::ToCeiledSize(gfx::ScaleSize(layer_bounds, contents_scale)));
+ gfx::Rect content_rect(gfx::Point(), content_bounds);
+
+ Region remaining(content_rect);
+ PictureLayerTilingSet::Iterator iter(&set, contents_scale, content_rect);
+ for (; iter; ++iter) {
+ gfx::Rect geometry_rect = iter.geometry_rect();
+ EXPECT_TRUE(content_rect.Contains(geometry_rect));
+ ASSERT_TRUE(remaining.Contains(geometry_rect));
+ remaining.Subtract(geometry_rect);
+
+ // No tiles have resources, so no iter represents a real tile.
+ EXPECT_FALSE(*iter);
+ }
+ EXPECT_TRUE(remaining.IsEmpty());
+}
+
+} // namespace cc
« no previous file with comments | « cc/picture_layer_tiling_set.cc ('k') | cc/picture_layer_tiling_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698