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

Side by Side Diff: cc/tiled_layer_impl_unittest.cc

Issue 11474050: cc: Unify namespaces for all test files (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase Created 8 years 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
« no previous file with comments | « cc/tile_priority_unittest.cc ('k') | cc/tiled_layer_unittest.cc » ('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/tiled_layer_impl.h" 5 #include "cc/tiled_layer_impl.h"
6 6
7 #include "cc/append_quads_data.h" 7 #include "cc/append_quads_data.h"
8 #include "cc/layer_tiling_data.h" 8 #include "cc/layer_tiling_data.h"
9 #include "cc/single_thread_proxy.h" 9 #include "cc/single_thread_proxy.h"
10 #include "cc/test/fake_impl_proxy.h" 10 #include "cc/test/fake_impl_proxy.h"
11 #include "cc/test/fake_layer_tree_host_impl.h" 11 #include "cc/test/fake_layer_tree_host_impl.h"
12 #include "cc/test/layer_test_common.h" 12 #include "cc/test/layer_test_common.h"
13 #include "cc/test/mock_quad_culler.h" 13 #include "cc/test/mock_quad_culler.h"
14 #include "cc/tile_draw_quad.h" 14 #include "cc/tile_draw_quad.h"
15 #include "testing/gmock/include/gmock/gmock.h" 15 #include "testing/gmock/include/gmock/gmock.h"
16 #include "testing/gtest/include/gtest/gtest.h" 16 #include "testing/gtest/include/gtest/gtest.h"
17 17
18 using namespace LayerTestCommon;
19
20 namespace cc { 18 namespace cc {
21
22 namespace { 19 namespace {
23 20
24 class TiledLayerImplTest : public testing::Test 21 class TiledLayerImplTest : public testing::Test
25 { 22 {
26 public: 23 public:
27 TiledLayerImplTest() 24 TiledLayerImplTest()
28 : m_hostImpl(&m_proxy) 25 : m_hostImpl(&m_proxy)
29 { 26 {
30 } 27 }
31 28
(...skipping 140 matching lines...) Expand 10 before | Expand all | Expand 10 after
172 169
173 class TiledLayerImplBorderTest : public TiledLayerImplTest 170 class TiledLayerImplBorderTest : public TiledLayerImplTest
174 { 171 {
175 public: 172 public:
176 void coverageVisibleRectOnTileBoundaries(LayerTilingData::BorderTexelOption borders) 173 void coverageVisibleRectOnTileBoundaries(LayerTilingData::BorderTexelOption borders)
177 { 174 {
178 gfx::Size layerSize(1000, 1000); 175 gfx::Size layerSize(1000, 1000);
179 QuadList quads; 176 QuadList quads;
180 SharedQuadStateList sharedStates; 177 SharedQuadStateList sharedStates;
181 getQuads(quads, sharedStates, gfx::Size(100, 100), layerSize, borders, g fx::Rect(gfx::Point(), layerSize)); 178 getQuads(quads, sharedStates, gfx::Size(100, 100), layerSize, borders, g fx::Rect(gfx::Point(), layerSize));
182 verifyQuadsExactlyCoverRect(quads, gfx::Rect(gfx::Point(), layerSize)); 179 LayerTestCommon::verifyQuadsExactlyCoverRect(quads, gfx::Rect(gfx::Point (), layerSize));
183 } 180 }
184 181
185 void coverageVisibleRectIntersectsTiles(LayerTilingData::BorderTexelOption b orders) 182 void coverageVisibleRectIntersectsTiles(LayerTilingData::BorderTexelOption b orders)
186 { 183 {
187 // This rect intersects the middle 3x3 of the 5x5 tiles. 184 // This rect intersects the middle 3x3 of the 5x5 tiles.
188 gfx::Point topLeft(65, 73); 185 gfx::Point topLeft(65, 73);
189 gfx::Point bottomRight(182, 198); 186 gfx::Point bottomRight(182, 198);
190 gfx::Rect visibleContentRect = gfx::BoundingRect(topLeft, bottomRight); 187 gfx::Rect visibleContentRect = gfx::BoundingRect(topLeft, bottomRight);
191 188
192 gfx::Size layerSize(250, 250); 189 gfx::Size layerSize(250, 250);
193 QuadList quads; 190 QuadList quads;
194 SharedQuadStateList sharedStates; 191 SharedQuadStateList sharedStates;
195 getQuads(quads, sharedStates, gfx::Size(50, 50), gfx::Size(250, 250), La yerTilingData::NoBorderTexels, visibleContentRect); 192 getQuads(quads, sharedStates, gfx::Size(50, 50), gfx::Size(250, 250), La yerTilingData::NoBorderTexels, visibleContentRect);
196 verifyQuadsExactlyCoverRect(quads, visibleContentRect); 193 LayerTestCommon::verifyQuadsExactlyCoverRect(quads, visibleContentRect);
197 } 194 }
198 195
199 void coverageVisibleRectIntersectsBounds(LayerTilingData::BorderTexelOption borders) 196 void coverageVisibleRectIntersectsBounds(LayerTilingData::BorderTexelOption borders)
200 { 197 {
201 gfx::Size layerSize(220, 210); 198 gfx::Size layerSize(220, 210);
202 gfx::Rect visibleContentRect(gfx::Point(), layerSize); 199 gfx::Rect visibleContentRect(gfx::Point(), layerSize);
203 QuadList quads; 200 QuadList quads;
204 SharedQuadStateList sharedStates; 201 SharedQuadStateList sharedStates;
205 getQuads(quads, sharedStates, gfx::Size(100, 100), layerSize, LayerTilin gData::NoBorderTexels, visibleContentRect); 202 getQuads(quads, sharedStates, gfx::Size(100, 100), layerSize, LayerTilin gData::NoBorderTexels, visibleContentRect);
206 verifyQuadsExactlyCoverRect(quads, visibleContentRect); 203 LayerTestCommon::verifyQuadsExactlyCoverRect(quads, visibleContentRect);
207 } 204 }
208 }; 205 };
209 WITH_AND_WITHOUT_BORDER_TEST(coverageVisibleRectOnTileBoundaries); 206 WITH_AND_WITHOUT_BORDER_TEST(coverageVisibleRectOnTileBoundaries);
210 207
211 WITH_AND_WITHOUT_BORDER_TEST(coverageVisibleRectIntersectsTiles); 208 WITH_AND_WITHOUT_BORDER_TEST(coverageVisibleRectIntersectsTiles);
212 209
213 WITH_AND_WITHOUT_BORDER_TEST(coverageVisibleRectIntersectsBounds); 210 WITH_AND_WITHOUT_BORDER_TEST(coverageVisibleRectIntersectsBounds);
214 211
215 TEST_F(TiledLayerImplTest, textureInfoForLayerNoBorders) 212 TEST_F(TiledLayerImplTest, textureInfoForLayerNoBorders)
216 { 213 {
217 gfx::Size tileSize(50, 50); 214 gfx::Size tileSize(50, 50);
218 gfx::Size layerSize(250, 250); 215 gfx::Size layerSize(250, 250);
219 QuadList quads; 216 QuadList quads;
220 SharedQuadStateList sharedStates; 217 SharedQuadStateList sharedStates;
221 getQuads(quads, sharedStates, tileSize, layerSize, LayerTilingData::NoBorder Texels, gfx::Rect(gfx::Point(), layerSize)); 218 getQuads(quads, sharedStates, tileSize, layerSize, LayerTilingData::NoBorder Texels, gfx::Rect(gfx::Point(), layerSize));
222 219
223 for (size_t i = 0; i < quads.size(); ++i) { 220 for (size_t i = 0; i < quads.size(); ++i) {
224 const TileDrawQuad* quad = TileDrawQuad::MaterialCast(quads[i]); 221 const TileDrawQuad* quad = TileDrawQuad::MaterialCast(quads[i]);
225 222
226 EXPECT_NE(0u, quad->resource_id) << quadString << i; 223 EXPECT_NE(0u, quad->resource_id) << LayerTestCommon::quadString << i;
227 EXPECT_EQ(gfx::RectF(gfx::PointF(), tileSize), quad->tex_coord_rect) << quadString << i; 224 EXPECT_EQ(gfx::RectF(gfx::PointF(), tileSize), quad->tex_coord_rect) << LayerTestCommon::quadString << i;
228 EXPECT_EQ(tileSize, quad->texture_size) << quadString << i; 225 EXPECT_EQ(tileSize, quad->texture_size) << LayerTestCommon::quadString < < i;
229 EXPECT_EQ(gfx::Rect(0, 0, 1, 1), quad->opaque_rect) << quadString << i; 226 EXPECT_EQ(gfx::Rect(0, 0, 1, 1), quad->opaque_rect) << LayerTestCommon:: quadString << i;
230 } 227 }
231 } 228 }
232 229
233 } // namespace 230 } // namespace
234 } // namespace cc 231 } // namespace cc
OLDNEW
« no previous file with comments | « cc/tile_priority_unittest.cc ('k') | cc/tiled_layer_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698