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

Side by Side Diff: third_party/WebKit/Source/platform/graphics/compositing/PaintArtifactCompositorTest.cpp

Issue 2615773003: Replace LayerImpl::sorting_context_id with transform reference. (Closed)
Patch Set: Update tests. Created 3 years, 11 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
OLDNEW
1 // Copyright 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 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 "platform/graphics/compositing/PaintArtifactCompositor.h" 5 #include "platform/graphics/compositing/PaintArtifactCompositor.h"
6 6
7 #include "base/test/test_simple_task_runner.h" 7 #include "base/test/test_simple_task_runner.h"
8 #include "base/threading/thread_task_runner_handle.h" 8 #include "base/threading/thread_task_runner_handle.h"
9 #include "cc/layers/layer.h" 9 #include "cc/layers/layer.h"
10 #include "cc/test/fake_compositor_frame_sink.h" 10 #include "cc/test/fake_compositor_frame_sink.h"
(...skipping 337 matching lines...) Expand 10 before | Expand all | Expand 10 after
348 EXPECT_EQ(whiteLayer->sorting_context_id(), whiteSortingContextId); 348 EXPECT_EQ(whiteLayer->sorting_context_id(), whiteSortingContextId);
349 EXPECT_EQ(0, whiteSortingContextId); 349 EXPECT_EQ(0, whiteSortingContextId);
350 350
351 // The light gray layer is 3D sorted. 351 // The light gray layer is 3D sorted.
352 const cc::Layer* lightGrayLayer = contentLayerAt(1); 352 const cc::Layer* lightGrayLayer = contentLayerAt(1);
353 EXPECT_THAT( 353 EXPECT_THAT(
354 lightGrayLayer->GetPicture(), 354 lightGrayLayer->GetPicture(),
355 Pointee(drawsRectangle(FloatRect(0, 0, 300, 200), Color::lightGray))); 355 Pointee(drawsRectangle(FloatRect(0, 0, 300, 200), Color::lightGray)));
356 int lightGraySortingContextId = 356 int lightGraySortingContextId =
357 transformNode(lightGrayLayer).sorting_context_id; 357 transformNode(lightGrayLayer).sorting_context_id;
358 EXPECT_EQ(lightGrayLayer->sorting_context_id(), lightGraySortingContextId);
359 EXPECT_NE(0, lightGraySortingContextId); 358 EXPECT_NE(0, lightGraySortingContextId);
360 359
361 // The dark gray layer is 3D sorted with the light gray layer, but has a 360 // The dark gray layer is 3D sorted with the light gray layer, but has a
362 // separate transform node. 361 // separate transform node.
363 const cc::Layer* darkGrayLayer = contentLayerAt(2); 362 const cc::Layer* darkGrayLayer = contentLayerAt(2);
364 EXPECT_THAT( 363 EXPECT_THAT(
365 darkGrayLayer->GetPicture(), 364 darkGrayLayer->GetPicture(),
366 Pointee(drawsRectangle(FloatRect(0, 0, 300, 200), Color::darkGray))); 365 Pointee(drawsRectangle(FloatRect(0, 0, 300, 200), Color::darkGray)));
367 int darkGraySortingContextId = 366 int darkGraySortingContextId =
368 transformNode(darkGrayLayer).sorting_context_id; 367 transformNode(darkGrayLayer).sorting_context_id;
369 EXPECT_EQ(darkGrayLayer->sorting_context_id(), darkGraySortingContextId);
370 EXPECT_EQ(lightGraySortingContextId, darkGraySortingContextId); 368 EXPECT_EQ(lightGraySortingContextId, darkGraySortingContextId);
371 EXPECT_NE(lightGrayLayer->transform_tree_index(), 369 EXPECT_NE(lightGrayLayer->transform_tree_index(),
372 darkGrayLayer->transform_tree_index()); 370 darkGrayLayer->transform_tree_index());
373 371
374 // The black layer is 3D sorted, but in a separate context from the previous 372 // The black layer is 3D sorted, but in a separate context from the previous
375 // layers. 373 // layers.
376 const cc::Layer* blackLayer = contentLayerAt(3); 374 const cc::Layer* blackLayer = contentLayerAt(3);
377 EXPECT_THAT(blackLayer->GetPicture(), 375 EXPECT_THAT(blackLayer->GetPicture(),
378 Pointee(drawsRectangle(FloatRect(0, 0, 300, 200), Color::black))); 376 Pointee(drawsRectangle(FloatRect(0, 0, 300, 200), Color::black)));
379 int blackSortingContextId = transformNode(blackLayer).sorting_context_id; 377 int blackSortingContextId = transformNode(blackLayer).sorting_context_id;
380 EXPECT_EQ(blackLayer->sorting_context_id(), blackSortingContextId);
381 EXPECT_NE(0, blackSortingContextId); 378 EXPECT_NE(0, blackSortingContextId);
382 EXPECT_NE(lightGraySortingContextId, blackSortingContextId); 379 EXPECT_NE(lightGraySortingContextId, blackSortingContextId);
383 } 380 }
384 381
385 TEST_F(PaintArtifactCompositorTestWithPropertyTrees, OneClip) { 382 TEST_F(PaintArtifactCompositorTestWithPropertyTrees, OneClip) {
386 RefPtr<ClipPaintPropertyNode> clip = ClipPaintPropertyNode::create( 383 RefPtr<ClipPaintPropertyNode> clip = ClipPaintPropertyNode::create(
387 ClipPaintPropertyNode::root(), TransformPaintPropertyNode::root(), 384 ClipPaintPropertyNode::root(), TransformPaintPropertyNode::root(),
388 FloatRoundedRect(100, 100, 300, 200)); 385 FloatRoundedRect(100, 100, 300, 200));
389 386
390 TestPaintArtifact artifact; 387 TestPaintArtifact artifact;
(...skipping 1160 matching lines...) Expand 10 before | Expand all | Expand 10 after
1551 chunk3.properties.propertyTreeState = chunk1.properties.propertyTreeState; 1548 chunk3.properties.propertyTreeState = chunk1.properties.propertyTreeState;
1552 chunk3.bounds = FloatRect(0, 0, 50, 60); 1549 chunk3.bounds = FloatRect(0, 0, 50, 60);
1553 chunk3.knownToBeOpaque = true; 1550 chunk3.knownToBeOpaque = true;
1554 pendingLayer.add(chunk3, nullptr); 1551 pendingLayer.add(chunk3, nullptr);
1555 1552
1556 // Chunk 3 covers the entire layer, so now it's opaque. 1553 // Chunk 3 covers the entire layer, so now it's opaque.
1557 EXPECT_TRUE(pendingLayer.knownToBeOpaque); 1554 EXPECT_TRUE(pendingLayer.knownToBeOpaque);
1558 } 1555 }
1559 1556
1560 } // namespace blink 1557 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698