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

Side by Side Diff: ui/compositor/layer_unittest.cc

Issue 2126873005: [ash-md] Doesn't recreate a rounded rect mask for overview windows (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: [ash-md] Doesn't recreate a rounded rect mask for overview windows (rebased) Created 4 years, 5 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
« no previous file with comments | « ui/compositor/layer.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 "ui/compositor/layer.h" 5 #include "ui/compositor/layer.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 8
9 #include <memory> 9 #include <memory>
10 #include <utility> 10 #include <utility>
(...skipping 615 matching lines...) Expand 10 before | Expand all | Expand 10 after
626 DrawTreeLayerDelegate d3(l3->bounds()); 626 DrawTreeLayerDelegate d3(l3->bounds());
627 l3->set_delegate(&d3); 627 l3->set_delegate(&d3);
628 628
629 l2->SchedulePaint(gfx::Rect(5, 5, 5, 5)); 629 l2->SchedulePaint(gfx::Rect(5, 5, 5, 5));
630 WaitForDraw(); 630 WaitForDraw();
631 EXPECT_FALSE(d1.painted()); 631 EXPECT_FALSE(d1.painted());
632 EXPECT_TRUE(d2.painted()); 632 EXPECT_TRUE(d2.painted());
633 EXPECT_FALSE(d3.painted()); 633 EXPECT_FALSE(d3.painted());
634 } 634 }
635 635
636 // Tests that scheduling paint on a layer with a mask updates the mask.
637 TEST_F(LayerWithRealCompositorTest, SchedulePaintUpdatesMask) {
638 std::unique_ptr<Layer> layer(
639 CreateColorLayer(SK_ColorRED, gfx::Rect(20, 20, 400, 400)));
640 std::unique_ptr<Layer> mask_layer(CreateLayer(ui::LAYER_TEXTURED));
641 mask_layer->SetBounds(gfx::Rect(layer->GetTargetBounds().size()));
642 layer->SetMaskLayer(mask_layer.get());
643
644 GetCompositor()->SetRootLayer(layer.get());
645 WaitForDraw();
646
647 DrawTreeLayerDelegate d1(layer->bounds());
648 layer->set_delegate(&d1);
649 DrawTreeLayerDelegate d2(mask_layer->bounds());
650 mask_layer->set_delegate(&d2);
651
652 layer->SchedulePaint(gfx::Rect(5, 5, 5, 5));
653 WaitForDraw();
654 EXPECT_TRUE(d1.painted());
655 EXPECT_TRUE(d2.painted());
656 }
657
636 // Tests no-texture Layers. 658 // Tests no-texture Layers.
637 // Create this hierarchy: 659 // Create this hierarchy:
638 // L1 - red 660 // L1 - red
639 // +-- L2 - NO TEXTURE 661 // +-- L2 - NO TEXTURE
640 // | +-- L3 - yellow 662 // | +-- L3 - yellow
641 // +-- L4 - magenta 663 // +-- L4 - magenta
642 // 664 //
643 TEST_F(LayerWithRealCompositorTest, HierarchyNoTexture) { 665 TEST_F(LayerWithRealCompositorTest, HierarchyNoTexture) {
644 std::unique_ptr<Layer> l1( 666 std::unique_ptr<Layer> l1(
645 CreateColorLayer(SK_ColorRED, gfx::Rect(20, 20, 400, 400))); 667 CreateColorLayer(SK_ColorRED, gfx::Rect(20, 20, 400, 400)));
(...skipping 1258 matching lines...) Expand 10 before | Expand all | Expand 10 after
1904 root->SetOpacity(0.5f); 1926 root->SetOpacity(0.5f);
1905 WaitForSwap(); 1927 WaitForSwap();
1906 EXPECT_EQ(1u, animation_observer.animation_step_count()); 1928 EXPECT_EQ(1u, animation_observer.animation_step_count());
1907 1929
1908 EXPECT_FALSE(animation_observer.shutdown()); 1930 EXPECT_FALSE(animation_observer.shutdown());
1909 ResetCompositor(); 1931 ResetCompositor();
1910 EXPECT_TRUE(animation_observer.shutdown()); 1932 EXPECT_TRUE(animation_observer.shutdown());
1911 } 1933 }
1912 1934
1913 } // namespace ui 1935 } // namespace ui
OLDNEW
« no previous file with comments | « ui/compositor/layer.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698