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

Side by Side Diff: cc/resources/picture_pile_impl_unittest.cc

Issue 13863015: Add flag for drawing layers to screen with Ganesh (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Address review comments Created 7 years, 7 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 | Annotate | Revision Log
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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 "base/memory/scoped_ptr.h" 5 #include "base/memory/scoped_ptr.h"
6 #include "cc/test/fake_picture_pile_impl.h" 6 #include "cc/test/fake_picture_pile_impl.h"
7 #include "skia/ext/lazy_pixel_ref.h" 7 #include "skia/ext/lazy_pixel_ref.h"
8 #include "testing/gtest/include/gtest/gtest.h" 8 #include "testing/gtest/include/gtest/gtest.h"
9 #include "third_party/skia/include/core/SkPixelRef.h" 9 #include "third_party/skia/include/core/SkPixelRef.h"
10 #include "third_party/skia/include/core/SkShader.h" 10 #include "third_party/skia/include/core/SkShader.h"
(...skipping 166 matching lines...) Expand 10 before | Expand all | Expand 10 after
177 pile->AnalyzeInRect(gfx::Rect(0, 35, 10, 10), 0.1f, &analysis); 177 pile->AnalyzeInRect(gfx::Rect(0, 35, 10, 10), 0.1f, &analysis);
178 EXPECT_TRUE(analysis.is_solid_color); 178 EXPECT_TRUE(analysis.is_solid_color);
179 EXPECT_EQ(analysis.solid_color, solid_color); 179 EXPECT_EQ(analysis.solid_color, solid_color);
180 180
181 analysis.is_solid_color = false; 181 analysis.is_solid_color = false;
182 pile->AnalyzeInRect(gfx::Rect(35, 35, 10, 10), 0.1f, &analysis); 182 pile->AnalyzeInRect(gfx::Rect(35, 35, 10, 10), 0.1f, &analysis);
183 EXPECT_TRUE(analysis.is_solid_color); 183 EXPECT_TRUE(analysis.is_solid_color);
184 EXPECT_EQ(analysis.solid_color, solid_color); 184 EXPECT_EQ(analysis.solid_color, solid_color);
185 } 185 }
186 186
187 TEST(PicturePileImplTest, AnalyzeIsSolidEmpty) {
188 gfx::Size tile_size(100, 100);
189 gfx::Size layer_bounds(400, 400);
190
191 scoped_refptr<FakePicturePileImpl> pile =
192 FakePicturePileImpl::CreateFilledPile(tile_size, layer_bounds);
193 PicturePileImpl::Analysis analysis;
danakj 2013/05/17 23:36:31 nit: EXPECT_FALSE(anaysis.is_solid_color) before t
enne (OOO) 2013/05/17 23:52:50 Done.
194 pile->AnalyzeInRect(gfx::Rect(0, 0, 400, 400), 1.f, &analysis);
195
196 EXPECT_TRUE(analysis.is_solid_color);
197 EXPECT_EQ(analysis.solid_color, SkColorSetARGB(0, 0, 0, 0));
198 }
199
187 TEST(PicturePileImplTest, PixelRefIteratorEmpty) { 200 TEST(PicturePileImplTest, PixelRefIteratorEmpty) {
188 gfx::Size tile_size(128, 128); 201 gfx::Size tile_size(128, 128);
189 gfx::Size layer_bounds(256, 256); 202 gfx::Size layer_bounds(256, 256);
190 203
191 // Create a filled pile with no recording. 204 // Create a filled pile with no recording.
192 scoped_refptr<FakePicturePileImpl> pile = 205 scoped_refptr<FakePicturePileImpl> pile =
193 FakePicturePileImpl::CreateFilledPile(tile_size, layer_bounds); 206 FakePicturePileImpl::CreateFilledPile(tile_size, layer_bounds);
194 207
195 // Tile sized iterators. 208 // Tile sized iterators.
196 { 209 {
(...skipping 654 matching lines...) Expand 10 before | Expand all | Expand 10 after
851 PicturePileImpl::PixelRefIterator iterator( 864 PicturePileImpl::PixelRefIterator iterator(
852 gfx::Rect(0, 128, 128, 128), 865 gfx::Rect(0, 128, 128, 128),
853 1.0, 866 1.0,
854 pile); 867 pile);
855 EXPECT_FALSE(iterator); 868 EXPECT_FALSE(iterator);
856 } 869 }
857 } 870 }
858 871
859 } // namespace 872 } // namespace
860 } // namespace cc 873 } // namespace cc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698