| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 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 "base/basictypes.h" | 5 #include "base/basictypes.h" |
| 6 #include "base/bind.h" | 6 #include "base/bind.h" |
| 7 #include "base/compiler_specific.h" | 7 #include "base/compiler_specific.h" |
| 8 #include "base/files/file_path.h" | 8 #include "base/files/file_path.h" |
| 9 #include "base/files/file_util.h" | 9 #include "base/files/file_util.h" |
| 10 #include "base/json/json_reader.h" | 10 #include "base/json/json_reader.h" |
| (...skipping 200 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 211 // LayerDelegate that paints colors to the layer. | 211 // LayerDelegate that paints colors to the layer. |
| 212 class TestLayerDelegate : public LayerDelegate { | 212 class TestLayerDelegate : public LayerDelegate { |
| 213 public: | 213 public: |
| 214 explicit TestLayerDelegate() { reset(); } | 214 explicit TestLayerDelegate() { reset(); } |
| 215 ~TestLayerDelegate() override {} | 215 ~TestLayerDelegate() override {} |
| 216 | 216 |
| 217 void AddColor(SkColor color) { | 217 void AddColor(SkColor color) { |
| 218 colors_.push_back(color); | 218 colors_.push_back(color); |
| 219 } | 219 } |
| 220 | 220 |
| 221 const gfx::Size& paint_size() const { return paint_size_; } | |
| 222 int color_index() const { return color_index_; } | 221 int color_index() const { return color_index_; } |
| 223 | 222 |
| 224 std::string ToScaleString() const { | |
| 225 return base::StringPrintf("%.1f %.1f", scale_x_, scale_y_); | |
| 226 } | |
| 227 | |
| 228 float device_scale_factor() const { | 223 float device_scale_factor() const { |
| 229 return device_scale_factor_; | 224 return device_scale_factor_; |
| 230 } | 225 } |
| 231 | 226 |
| 232 // Overridden from LayerDelegate: | 227 // Overridden from LayerDelegate: |
| 233 void OnPaintLayer(gfx::Canvas* canvas) override { | 228 void OnPaintLayer(gfx::Canvas* canvas) override { |
| 234 SkISize size = canvas->sk_canvas()->getBaseLayerSize(); | |
| 235 paint_size_ = gfx::Size(size.width(), size.height()); | |
| 236 canvas->DrawColor(colors_[color_index_]); | 229 canvas->DrawColor(colors_[color_index_]); |
| 237 color_index_ = (color_index_ + 1) % static_cast<int>(colors_.size()); | 230 color_index_ = (color_index_ + 1) % static_cast<int>(colors_.size()); |
| 238 const SkMatrix& matrix = canvas->sk_canvas()->getTotalMatrix(); | |
| 239 scale_x_ = matrix.getScaleX(); | |
| 240 scale_y_ = matrix.getScaleY(); | |
| 241 } | 231 } |
| 242 | 232 |
| 243 void OnDelegatedFrameDamage(const gfx::Rect& damage_rect_in_dip) override {} | 233 void OnDelegatedFrameDamage(const gfx::Rect& damage_rect_in_dip) override {} |
| 244 | 234 |
| 245 void OnDeviceScaleFactorChanged(float device_scale_factor) override { | 235 void OnDeviceScaleFactorChanged(float device_scale_factor) override { |
| 246 device_scale_factor_ = device_scale_factor; | 236 device_scale_factor_ = device_scale_factor; |
| 247 } | 237 } |
| 248 | 238 |
| 249 base::Closure PrepareForLayerBoundsChange() override { | 239 base::Closure PrepareForLayerBoundsChange() override { |
| 250 return base::Closure(); | 240 return base::Closure(); |
| 251 } | 241 } |
| 252 | 242 |
| 253 void reset() { | 243 void reset() { |
| 254 color_index_ = 0; | 244 color_index_ = 0; |
| 255 paint_size_.SetSize(0, 0); | |
| 256 scale_x_ = scale_y_ = 0.0f; | |
| 257 device_scale_factor_ = 0.0f; | 245 device_scale_factor_ = 0.0f; |
| 258 } | 246 } |
| 259 | 247 |
| 260 private: | 248 private: |
| 261 std::vector<SkColor> colors_; | 249 std::vector<SkColor> colors_; |
| 262 int color_index_; | 250 int color_index_; |
| 263 gfx::Size paint_size_; | |
| 264 float scale_x_; | |
| 265 float scale_y_; | |
| 266 float device_scale_factor_; | 251 float device_scale_factor_; |
| 267 | 252 |
| 268 DISALLOW_COPY_AND_ASSIGN(TestLayerDelegate); | 253 DISALLOW_COPY_AND_ASSIGN(TestLayerDelegate); |
| 269 }; | 254 }; |
| 270 | 255 |
| 271 // LayerDelegate that verifies that a layer was asked to update its canvas. | 256 // LayerDelegate that verifies that a layer was asked to update its canvas. |
| 272 class DrawTreeLayerDelegate : public LayerDelegate { | 257 class DrawTreeLayerDelegate : public LayerDelegate { |
| 273 public: | 258 public: |
| 274 DrawTreeLayerDelegate() : painted_(false) {} | 259 DrawTreeLayerDelegate() : painted_(false) {} |
| 275 ~DrawTreeLayerDelegate() override {} | 260 ~DrawTreeLayerDelegate() override {} |
| (...skipping 226 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 502 gfx::Point point1_in_l1_coords(25, 25); | 487 gfx::Point point1_in_l1_coords(25, 25); |
| 503 EXPECT_EQ(point1_in_l1_coords, point1_in_l3_coords); | 488 EXPECT_EQ(point1_in_l1_coords, point1_in_l3_coords); |
| 504 | 489 |
| 505 gfx::Point point2_in_l1_coords(5, 5); | 490 gfx::Point point2_in_l1_coords(5, 5); |
| 506 Layer::ConvertPointToLayer(l1.get(), l3.get(), &point2_in_l1_coords); | 491 Layer::ConvertPointToLayer(l1.get(), l3.get(), &point2_in_l1_coords); |
| 507 gfx::Point point2_in_l3_coords(-15, -15); | 492 gfx::Point point2_in_l3_coords(-15, -15); |
| 508 EXPECT_EQ(point2_in_l3_coords, point2_in_l1_coords); | 493 EXPECT_EQ(point2_in_l3_coords, point2_in_l1_coords); |
| 509 } | 494 } |
| 510 | 495 |
| 511 TEST_F(LayerWithRealCompositorTest, Delegate) { | 496 TEST_F(LayerWithRealCompositorTest, Delegate) { |
| 512 scoped_ptr<Layer> l1(CreateColorLayer(SK_ColorBLACK, | 497 // This test makes sure that whenever paint happens at a layer, its layer |
| 513 gfx::Rect(20, 20, 400, 400))); | 498 // delegate gets the paint, which in this test update its color and |
| 499 // |color_index|. |
| 500 scoped_ptr<Layer> l1( |
| 501 CreateColorLayer(SK_ColorBLACK, gfx::Rect(20, 20, 400, 400))); |
| 514 GetCompositor()->SetRootLayer(l1.get()); | 502 GetCompositor()->SetRootLayer(l1.get()); |
| 515 WaitForDraw(); | 503 WaitForDraw(); |
| 516 | 504 |
| 517 TestLayerDelegate delegate; | 505 TestLayerDelegate delegate; |
| 518 l1->set_delegate(&delegate); | 506 l1->set_delegate(&delegate); |
| 519 delegate.AddColor(SK_ColorWHITE); | 507 delegate.AddColor(SK_ColorWHITE); |
| 520 delegate.AddColor(SK_ColorYELLOW); | 508 delegate.AddColor(SK_ColorYELLOW); |
| 521 delegate.AddColor(SK_ColorGREEN); | 509 delegate.AddColor(SK_ColorGREEN); |
| 522 | 510 |
| 523 l1->SchedulePaint(gfx::Rect(0, 0, 400, 400)); | 511 l1->SchedulePaint(gfx::Rect(0, 0, 400, 400)); |
| 524 WaitForDraw(); | 512 WaitForDraw(); |
| 525 | 513 // Test that paint happened at layer delegate. |
| 526 EXPECT_EQ(delegate.color_index(), 1); | 514 EXPECT_EQ(1, delegate.color_index()); |
| 527 EXPECT_EQ(delegate.paint_size(), l1->bounds().size()); | |
| 528 | 515 |
| 529 l1->SchedulePaint(gfx::Rect(10, 10, 200, 200)); | 516 l1->SchedulePaint(gfx::Rect(10, 10, 200, 200)); |
| 530 WaitForDraw(); | 517 WaitForDraw(); |
| 531 EXPECT_EQ(delegate.color_index(), 2); | 518 // Test that paint happened at layer delegate. |
| 532 EXPECT_EQ(delegate.paint_size(), gfx::Size(200, 200)); | 519 EXPECT_EQ(2, delegate.color_index()); |
| 533 | 520 |
| 534 l1->SchedulePaint(gfx::Rect(5, 5, 50, 50)); | 521 l1->SchedulePaint(gfx::Rect(5, 5, 50, 50)); |
| 535 WaitForDraw(); | 522 WaitForDraw(); |
| 536 EXPECT_EQ(delegate.color_index(), 0); | 523 // Test that paint happened at layer delegate. |
| 537 EXPECT_EQ(delegate.paint_size(), gfx::Size(50, 50)); | 524 EXPECT_EQ(0, delegate.color_index()); |
| 538 } | 525 } |
| 539 | 526 |
| 540 TEST_F(LayerWithRealCompositorTest, DrawTree) { | 527 TEST_F(LayerWithRealCompositorTest, DrawTree) { |
| 541 scoped_ptr<Layer> l1(CreateColorLayer(SK_ColorRED, | 528 scoped_ptr<Layer> l1(CreateColorLayer(SK_ColorRED, |
| 542 gfx::Rect(20, 20, 400, 400))); | 529 gfx::Rect(20, 20, 400, 400))); |
| 543 scoped_ptr<Layer> l2(CreateColorLayer(SK_ColorBLUE, | 530 scoped_ptr<Layer> l2(CreateColorLayer(SK_ColorBLUE, |
| 544 gfx::Rect(10, 10, 350, 350))); | 531 gfx::Rect(10, 10, 350, 350))); |
| 545 scoped_ptr<Layer> l3(CreateColorLayer(SK_ColorYELLOW, | 532 scoped_ptr<Layer> l3(CreateColorLayer(SK_ColorYELLOW, |
| 546 gfx::Rect(10, 10, 100, 100))); | 533 gfx::Rect(10, 10, 100, 100))); |
| 547 l1->Add(l2.get()); | 534 l1->Add(l2.get()); |
| (...skipping 753 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1301 EXPECT_EQ("10,20 200x220", root->bounds().ToString()); | 1288 EXPECT_EQ("10,20 200x220", root->bounds().ToString()); |
| 1302 EXPECT_EQ("10,20 140x180", l1->bounds().ToString()); | 1289 EXPECT_EQ("10,20 140x180", l1->bounds().ToString()); |
| 1303 gfx::Size cc_bounds_size = root->cc_layer()->bounds(); | 1290 gfx::Size cc_bounds_size = root->cc_layer()->bounds(); |
| 1304 EXPECT_EQ("200x220", cc_bounds_size.ToString()); | 1291 EXPECT_EQ("200x220", cc_bounds_size.ToString()); |
| 1305 cc_bounds_size = l1->cc_layer()->bounds(); | 1292 cc_bounds_size = l1->cc_layer()->bounds(); |
| 1306 EXPECT_EQ("140x180", cc_bounds_size.ToString()); | 1293 EXPECT_EQ("140x180", cc_bounds_size.ToString()); |
| 1307 // No scale change, so no scale notification. | 1294 // No scale change, so no scale notification. |
| 1308 EXPECT_EQ(0.0f, root_delegate.device_scale_factor()); | 1295 EXPECT_EQ(0.0f, root_delegate.device_scale_factor()); |
| 1309 EXPECT_EQ(0.0f, l1_delegate.device_scale_factor()); | 1296 EXPECT_EQ(0.0f, l1_delegate.device_scale_factor()); |
| 1310 | 1297 |
| 1311 EXPECT_EQ("200x220", root_delegate.paint_size().ToString()); | |
| 1312 EXPECT_EQ("140x180", l1_delegate.paint_size().ToString()); | |
| 1313 | |
| 1314 // Scale up to 2.0. Changing scale doesn't change the bounds in DIP. | 1298 // Scale up to 2.0. Changing scale doesn't change the bounds in DIP. |
| 1315 GetCompositor()->SetScaleAndSize(2.0f, gfx::Size(500, 500)); | 1299 GetCompositor()->SetScaleAndSize(2.0f, gfx::Size(500, 500)); |
| 1316 EXPECT_EQ("10,20 200x220", root->bounds().ToString()); | 1300 EXPECT_EQ("10,20 200x220", root->bounds().ToString()); |
| 1317 EXPECT_EQ("10,20 140x180", l1->bounds().ToString()); | 1301 EXPECT_EQ("10,20 140x180", l1->bounds().ToString()); |
| 1318 // CC layer should still match the UI layer bounds. | 1302 // CC layer should still match the UI layer bounds. |
| 1319 cc_bounds_size = root->cc_layer()->bounds(); | 1303 cc_bounds_size = root->cc_layer()->bounds(); |
| 1320 EXPECT_EQ("200x220", cc_bounds_size.ToString()); | 1304 EXPECT_EQ("200x220", cc_bounds_size.ToString()); |
| 1321 cc_bounds_size = l1->cc_layer()->bounds(); | 1305 cc_bounds_size = l1->cc_layer()->bounds(); |
| 1322 EXPECT_EQ("140x180", cc_bounds_size.ToString()); | 1306 EXPECT_EQ("140x180", cc_bounds_size.ToString()); |
| 1323 // New scale factor must have been notified. | 1307 // New scale factor must have been notified. Make sure painting happens at |
| 1308 // right scale. |
| 1324 EXPECT_EQ(2.0f, root_delegate.device_scale_factor()); | 1309 EXPECT_EQ(2.0f, root_delegate.device_scale_factor()); |
| 1325 EXPECT_EQ(2.0f, l1_delegate.device_scale_factor()); | 1310 EXPECT_EQ(2.0f, l1_delegate.device_scale_factor()); |
| 1326 | 1311 |
| 1327 // Canvas size must have been scaled down up. | |
| 1328 WaitForDraw(); | |
| 1329 EXPECT_EQ("400x440", root_delegate.paint_size().ToString()); | |
| 1330 EXPECT_EQ("2.0 2.0", root_delegate.ToScaleString()); | |
| 1331 EXPECT_EQ("280x360", l1_delegate.paint_size().ToString()); | |
| 1332 EXPECT_EQ("2.0 2.0", l1_delegate.ToScaleString()); | |
| 1333 | |
| 1334 // Scale down back to 1.0f. | 1312 // Scale down back to 1.0f. |
| 1335 GetCompositor()->SetScaleAndSize(1.0f, gfx::Size(500, 500)); | 1313 GetCompositor()->SetScaleAndSize(1.0f, gfx::Size(500, 500)); |
| 1336 EXPECT_EQ("10,20 200x220", root->bounds().ToString()); | 1314 EXPECT_EQ("10,20 200x220", root->bounds().ToString()); |
| 1337 EXPECT_EQ("10,20 140x180", l1->bounds().ToString()); | 1315 EXPECT_EQ("10,20 140x180", l1->bounds().ToString()); |
| 1338 // CC layer should still match the UI layer bounds. | 1316 // CC layer should still match the UI layer bounds. |
| 1339 cc_bounds_size = root->cc_layer()->bounds(); | 1317 cc_bounds_size = root->cc_layer()->bounds(); |
| 1340 EXPECT_EQ("200x220", cc_bounds_size.ToString()); | 1318 EXPECT_EQ("200x220", cc_bounds_size.ToString()); |
| 1341 cc_bounds_size = l1->cc_layer()->bounds(); | 1319 cc_bounds_size = l1->cc_layer()->bounds(); |
| 1342 EXPECT_EQ("140x180", cc_bounds_size.ToString()); | 1320 EXPECT_EQ("140x180", cc_bounds_size.ToString()); |
| 1343 // New scale factor must have been notified. | 1321 // New scale factor must have been notified. Make sure painting happens at |
| 1322 // right scale. |
| 1344 EXPECT_EQ(1.0f, root_delegate.device_scale_factor()); | 1323 EXPECT_EQ(1.0f, root_delegate.device_scale_factor()); |
| 1345 EXPECT_EQ(1.0f, l1_delegate.device_scale_factor()); | 1324 EXPECT_EQ(1.0f, l1_delegate.device_scale_factor()); |
| 1346 | 1325 |
| 1347 // Canvas size must have been scaled down too. | |
| 1348 WaitForDraw(); | |
| 1349 EXPECT_EQ("200x220", root_delegate.paint_size().ToString()); | |
| 1350 EXPECT_EQ("1.0 1.0", root_delegate.ToScaleString()); | |
| 1351 EXPECT_EQ("140x180", l1_delegate.paint_size().ToString()); | |
| 1352 EXPECT_EQ("1.0 1.0", l1_delegate.ToScaleString()); | |
| 1353 | |
| 1354 root_delegate.reset(); | 1326 root_delegate.reset(); |
| 1355 l1_delegate.reset(); | 1327 l1_delegate.reset(); |
| 1356 // Just changing the size shouldn't notify the scale change nor | 1328 // Just changing the size shouldn't notify the scale change nor |
| 1357 // trigger repaint. | 1329 // trigger repaint. |
| 1358 GetCompositor()->SetScaleAndSize(1.0f, gfx::Size(1000, 1000)); | 1330 GetCompositor()->SetScaleAndSize(1.0f, gfx::Size(1000, 1000)); |
| 1359 // No scale change, so no scale notification. | 1331 // No scale change, so no scale notification. |
| 1360 EXPECT_EQ(0.0f, root_delegate.device_scale_factor()); | 1332 EXPECT_EQ(0.0f, root_delegate.device_scale_factor()); |
| 1361 EXPECT_EQ(0.0f, l1_delegate.device_scale_factor()); | 1333 EXPECT_EQ(0.0f, l1_delegate.device_scale_factor()); |
| 1362 WaitForDraw(); | |
| 1363 EXPECT_EQ("0x0", root_delegate.paint_size().ToString()); | |
| 1364 EXPECT_EQ("0.0 0.0", root_delegate.ToScaleString()); | |
| 1365 EXPECT_EQ("0x0", l1_delegate.paint_size().ToString()); | |
| 1366 EXPECT_EQ("0.0 0.0", l1_delegate.ToScaleString()); | |
| 1367 } | 1334 } |
| 1368 | 1335 |
| 1369 TEST_F(LayerWithRealCompositorTest, ScaleReparent) { | 1336 TEST_F(LayerWithRealCompositorTest, ScaleReparent) { |
| 1370 scoped_ptr<Layer> root(CreateColorLayer(SK_ColorWHITE, | 1337 scoped_ptr<Layer> root(CreateColorLayer(SK_ColorWHITE, |
| 1371 gfx::Rect(10, 20, 200, 220))); | 1338 gfx::Rect(10, 20, 200, 220))); |
| 1372 scoped_ptr<Layer> l1(CreateColorLayer(SK_ColorWHITE, | 1339 scoped_ptr<Layer> l1(CreateColorLayer(SK_ColorWHITE, |
| 1373 gfx::Rect(10, 20, 140, 180))); | 1340 gfx::Rect(10, 20, 140, 180))); |
| 1374 TestLayerDelegate l1_delegate; | 1341 TestLayerDelegate l1_delegate; |
| 1375 l1_delegate.AddColor(SK_ColorWHITE); | 1342 l1_delegate.AddColor(SK_ColorWHITE); |
| 1376 l1->set_delegate(&l1_delegate); | 1343 l1->set_delegate(&l1_delegate); |
| 1377 | 1344 |
| 1378 GetCompositor()->SetScaleAndSize(1.0f, gfx::Size(500, 500)); | 1345 GetCompositor()->SetScaleAndSize(1.0f, gfx::Size(500, 500)); |
| 1379 GetCompositor()->SetRootLayer(root.get()); | 1346 GetCompositor()->SetRootLayer(root.get()); |
| 1380 WaitForDraw(); | |
| 1381 | 1347 |
| 1382 root->Add(l1.get()); | 1348 root->Add(l1.get()); |
| 1383 EXPECT_EQ("10,20 140x180", l1->bounds().ToString()); | 1349 EXPECT_EQ("10,20 140x180", l1->bounds().ToString()); |
| 1384 gfx::Size cc_bounds_size = l1->cc_layer()->bounds(); | 1350 gfx::Size cc_bounds_size = l1->cc_layer()->bounds(); |
| 1385 EXPECT_EQ("140x180", cc_bounds_size.ToString()); | 1351 EXPECT_EQ("140x180", cc_bounds_size.ToString()); |
| 1386 EXPECT_EQ(0.0f, l1_delegate.device_scale_factor()); | 1352 EXPECT_EQ(0.0f, l1_delegate.device_scale_factor()); |
| 1387 | 1353 |
| 1388 WaitForDraw(); | |
| 1389 EXPECT_EQ("140x180", l1_delegate.paint_size().ToString()); | |
| 1390 EXPECT_EQ("1.0 1.0", l1_delegate.ToScaleString()); | |
| 1391 | |
| 1392 // Remove l1 from root and change the scale. | 1354 // Remove l1 from root and change the scale. |
| 1393 root->Remove(l1.get()); | 1355 root->Remove(l1.get()); |
| 1394 EXPECT_EQ(NULL, l1->parent()); | 1356 EXPECT_EQ(NULL, l1->parent()); |
| 1395 EXPECT_EQ(NULL, l1->GetCompositor()); | 1357 EXPECT_EQ(NULL, l1->GetCompositor()); |
| 1396 GetCompositor()->SetScaleAndSize(2.0f, gfx::Size(500, 500)); | 1358 GetCompositor()->SetScaleAndSize(2.0f, gfx::Size(500, 500)); |
| 1397 // Sanity check on root and l1. | 1359 // Sanity check on root and l1. |
| 1398 EXPECT_EQ("10,20 200x220", root->bounds().ToString()); | 1360 EXPECT_EQ("10,20 200x220", root->bounds().ToString()); |
| 1399 cc_bounds_size = l1->cc_layer()->bounds(); | 1361 cc_bounds_size = l1->cc_layer()->bounds(); |
| 1400 EXPECT_EQ("140x180", cc_bounds_size.ToString()); | 1362 EXPECT_EQ("140x180", cc_bounds_size.ToString()); |
| 1401 | 1363 |
| 1402 root->Add(l1.get()); | 1364 root->Add(l1.get()); |
| 1403 EXPECT_EQ("10,20 140x180", l1->bounds().ToString()); | 1365 EXPECT_EQ("10,20 140x180", l1->bounds().ToString()); |
| 1404 cc_bounds_size = l1->cc_layer()->bounds(); | 1366 cc_bounds_size = l1->cc_layer()->bounds(); |
| 1405 EXPECT_EQ("140x180", cc_bounds_size.ToString()); | 1367 EXPECT_EQ("140x180", cc_bounds_size.ToString()); |
| 1406 EXPECT_EQ(2.0f, l1_delegate.device_scale_factor()); | 1368 EXPECT_EQ(2.0f, l1_delegate.device_scale_factor()); |
| 1407 WaitForDraw(); | |
| 1408 EXPECT_EQ("280x360", l1_delegate.paint_size().ToString()); | |
| 1409 EXPECT_EQ("2.0 2.0", l1_delegate.ToScaleString()); | |
| 1410 } | 1369 } |
| 1411 | 1370 |
| 1412 // Verifies that when changing bounds on a layer that is invisible, and then | 1371 // Verifies that when changing bounds on a layer that is invisible, and then |
| 1413 // made visible, the right thing happens: | 1372 // made visible, the right thing happens: |
| 1414 // - if just a move, then no painting should happen. | 1373 // - if just a move, then no painting should happen. |
| 1415 // - if a resize, the layer should be repainted. | 1374 // - if a resize, the layer should be repainted. |
| 1416 TEST_F(LayerWithDelegateTest, SetBoundsWhenInvisible) { | 1375 TEST_F(LayerWithDelegateTest, SetBoundsWhenInvisible) { |
| 1417 scoped_ptr<Layer> root(CreateNoTextureLayer(gfx::Rect(0, 0, 1000, 1000))); | 1376 scoped_ptr<Layer> root(CreateNoTextureLayer(gfx::Rect(0, 0, 1000, 1000))); |
| 1418 | 1377 |
| 1419 scoped_ptr<Layer> child(CreateLayer(LAYER_TEXTURED)); | 1378 scoped_ptr<Layer> child(CreateLayer(LAYER_TEXTURED)); |
| (...skipping 346 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1766 MakeFrameData(gfx::Size(10, 10)))); | 1725 MakeFrameData(gfx::Size(10, 10)))); |
| 1767 layer->SetShowDelegatedContent(frame_provider.get(), gfx::Size(10, 10)); | 1726 layer->SetShowDelegatedContent(frame_provider.get(), gfx::Size(10, 10)); |
| 1768 | 1727 |
| 1769 EXPECT_FALSE(delegate.delegated_frame_damage_called()); | 1728 EXPECT_FALSE(delegate.delegated_frame_damage_called()); |
| 1770 layer->OnDelegatedFrameDamage(damage_rect); | 1729 layer->OnDelegatedFrameDamage(damage_rect); |
| 1771 EXPECT_TRUE(delegate.delegated_frame_damage_called()); | 1730 EXPECT_TRUE(delegate.delegated_frame_damage_called()); |
| 1772 EXPECT_EQ(damage_rect, delegate.delegated_frame_damage_rect()); | 1731 EXPECT_EQ(damage_rect, delegate.delegated_frame_damage_rect()); |
| 1773 } | 1732 } |
| 1774 | 1733 |
| 1775 } // namespace ui | 1734 } // namespace ui |
| OLD | NEW |