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 "ui/views/view.h" | 5 #include "ui/views/view.h" |
6 | 6 |
7 #include <stddef.h> | 7 #include <stddef.h> |
8 | 8 |
9 #include <map> | 9 #include <map> |
10 #include <memory> | 10 #include <memory> |
(...skipping 4189 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4200 | 4200 |
4201 private: | 4201 private: |
4202 bool painted_; | 4202 bool painted_; |
4203 | 4203 |
4204 DISALLOW_COPY_AND_ASSIGN(PaintTrackingView); | 4204 DISALLOW_COPY_AND_ASSIGN(PaintTrackingView); |
4205 }; | 4205 }; |
4206 | 4206 |
4207 // Makes sure child views with layers aren't painted when paint starts at an | 4207 // Makes sure child views with layers aren't painted when paint starts at an |
4208 // ancestor. | 4208 // ancestor. |
4209 TEST_F(ViewLayerTest, DontPaintChildrenWithLayers) { | 4209 TEST_F(ViewLayerTest, DontPaintChildrenWithLayers) { |
4210 // TODO(sad): DrawWaiterForTest does not work with mus. crbug.com/618136 | |
4211 if (IsMus()) | |
4212 return; | |
4213 PaintTrackingView* content_view = new PaintTrackingView; | 4210 PaintTrackingView* content_view = new PaintTrackingView; |
4214 widget()->SetContentsView(content_view); | 4211 widget()->SetContentsView(content_view); |
4215 content_view->SetPaintToLayer(); | 4212 content_view->SetPaintToLayer(); |
4216 GetRootLayer()->GetCompositor()->ScheduleDraw(); | 4213 GetRootLayer()->GetCompositor()->ScheduleDraw(); |
4217 ui::DrawWaiterForTest::WaitForCompositingEnded( | 4214 ui::DrawWaiterForTest::WaitForCompositingEnded( |
4218 GetRootLayer()->GetCompositor()); | 4215 GetRootLayer()->GetCompositor()); |
4219 GetRootLayer()->SchedulePaint(gfx::Rect(0, 0, 10, 10)); | 4216 GetRootLayer()->SchedulePaint(gfx::Rect(0, 0, 10, 10)); |
4220 content_view->set_painted(false); | 4217 content_view->set_painted(false); |
4221 // content_view no longer has a dirty rect. Paint from the root and make sure | 4218 // content_view no longer has a dirty rect. Paint from the root and make sure |
4222 // PaintTrackingView isn't painted. | 4219 // PaintTrackingView isn't painted. |
(...skipping 797 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5020 std::unique_ptr<View> view = NewView(); | 5017 std::unique_ptr<View> view = NewView(); |
5021 std::unique_ptr<View> child_view = NewView(); | 5018 std::unique_ptr<View> child_view = NewView(); |
5022 std::unique_ptr<View> child_view2 = NewView(); | 5019 std::unique_ptr<View> child_view2 = NewView(); |
5023 view->AddChildView(child_view.get()); | 5020 view->AddChildView(child_view.get()); |
5024 view->AddChildView(child_view2.get()); | 5021 view->AddChildView(child_view2.get()); |
5025 view->ReorderChildView(child_view2.get(), 0); | 5022 view->ReorderChildView(child_view2.get(), 0); |
5026 EXPECT_EQ(child_view2.get(), view_reordered()); | 5023 EXPECT_EQ(child_view2.get(), view_reordered()); |
5027 } | 5024 } |
5028 | 5025 |
5029 } // namespace views | 5026 } // namespace views |
OLD | NEW |