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

Unified Diff: cc/trees/layer_tree_host_impl_unittest.cc

Issue 22870016: Update the nine patch layer to use UI resources (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: updated dchecks in ui_resource_bitmap Created 7 years, 3 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 side-by-side diff with in-line comments
Download patch
Index: cc/trees/layer_tree_host_impl_unittest.cc
diff --git a/cc/trees/layer_tree_host_impl_unittest.cc b/cc/trees/layer_tree_host_impl_unittest.cc
index 544bb232e2b5750fac8c0dcda83b79f3629808e3..2c9f89e9233379703a5a9fb76ec8814b5df8e63b 100644
--- a/cc/trees/layer_tree_host_impl_unittest.cc
+++ b/cc/trees/layer_tree_host_impl_unittest.cc
@@ -3068,12 +3068,13 @@ TEST_F(LayerTreeHostImplViewportCoveredTest, ViewportCoveredOverhangBitmap) {
host_impl_->SetViewportSize(DipSizeToPixelSize(viewport_size_));
SetupActiveTreeLayers();
+ SkBitmap skbitmap;
+ skbitmap.setConfig(SkBitmap::kARGB_8888_Config, 2, 2);
+ skbitmap.allocPixels();
+ skbitmap.setImmutable();
+
// Specify an overhang bitmap to use.
- scoped_refptr<UIResourceBitmap> ui_resource_bitmap(UIResourceBitmap::Create(
- new uint8_t[4],
- UIResourceBitmap::RGBA8,
- UIResourceBitmap::REPEAT,
- gfx::Size(1, 1)));
+ UIResourceBitmap ui_resource_bitmap(skbitmap, UIResourceBitmap::REPEAT);
UIResourceId ui_resource_id = 12345;
host_impl_->CreateUIResource(ui_resource_id, ui_resource_bitmap);
host_impl_->SetOverhangUIResource(ui_resource_id, gfx::Size(32, 32));
@@ -6551,12 +6552,13 @@ TEST_F(LayerTreeHostImplTest, UIResourceManagement) {
EXPECT_EQ(0u, context3d->NumTextures());
+ SkBitmap skbitmap;
+ skbitmap.setConfig(SkBitmap::kARGB_8888_Config, 1, 1);
+ skbitmap.allocPixels();
+ skbitmap.setImmutable();
+
UIResourceId ui_resource_id = 1;
- scoped_refptr<UIResourceBitmap> bitmap = UIResourceBitmap::Create(
- new uint8_t[1],
- UIResourceBitmap::RGBA8,
- UIResourceBitmap::CLAMP_TO_EDGE,
- gfx::Size(1, 1));
+ UIResourceBitmap bitmap(skbitmap);
host_impl_->CreateUIResource(ui_resource_id, bitmap);
EXPECT_EQ(1u, context3d->NumTextures());
ResourceProvider::ResourceId id1 =

Powered by Google App Engine
This is Rietveld 408576698