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 4027 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4038 | 4038 |
4039 private: | 4039 private: |
4040 bool painted_; | 4040 bool painted_; |
4041 | 4041 |
4042 DISALLOW_COPY_AND_ASSIGN(PaintTrackingView); | 4042 DISALLOW_COPY_AND_ASSIGN(PaintTrackingView); |
4043 }; | 4043 }; |
4044 | 4044 |
4045 // Makes sure child views with layers aren't painted when paint starts at an | 4045 // Makes sure child views with layers aren't painted when paint starts at an |
4046 // ancestor. | 4046 // ancestor. |
4047 TEST_F(ViewLayerTest, DontPaintChildrenWithLayers) { | 4047 TEST_F(ViewLayerTest, DontPaintChildrenWithLayers) { |
| 4048 // TODO(sad): DrawWaiterForTest does not work with mus. crbug.com/618136 |
| 4049 if (IsMus()) |
| 4050 return; |
4048 PaintTrackingView* content_view = new PaintTrackingView; | 4051 PaintTrackingView* content_view = new PaintTrackingView; |
4049 widget()->SetContentsView(content_view); | 4052 widget()->SetContentsView(content_view); |
4050 content_view->SetPaintToLayer(true); | 4053 content_view->SetPaintToLayer(true); |
4051 GetRootLayer()->GetCompositor()->ScheduleDraw(); | 4054 GetRootLayer()->GetCompositor()->ScheduleDraw(); |
4052 ui::DrawWaiterForTest::WaitForCompositingEnded( | 4055 ui::DrawWaiterForTest::WaitForCompositingEnded( |
4053 GetRootLayer()->GetCompositor()); | 4056 GetRootLayer()->GetCompositor()); |
4054 GetRootLayer()->SchedulePaint(gfx::Rect(0, 0, 10, 10)); | 4057 GetRootLayer()->SchedulePaint(gfx::Rect(0, 0, 10, 10)); |
4055 content_view->set_painted(false); | 4058 content_view->set_painted(false); |
4056 // content_view no longer has a dirty rect. Paint from the root and make sure | 4059 // content_view no longer has a dirty rect. Paint from the root and make sure |
4057 // PaintTrackingView isn't painted. | 4060 // PaintTrackingView isn't painted. |
(...skipping 510 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4568 widget.Init(params); | 4571 widget.Init(params); |
4569 | 4572 |
4570 AddViewWithChildLayer(widget.GetRootView()); | 4573 AddViewWithChildLayer(widget.GetRootView()); |
4571 ViewThatAddsViewInOnNativeThemeChanged* v = | 4574 ViewThatAddsViewInOnNativeThemeChanged* v = |
4572 new ViewThatAddsViewInOnNativeThemeChanged; | 4575 new ViewThatAddsViewInOnNativeThemeChanged; |
4573 widget.GetRootView()->AddChildView(v); | 4576 widget.GetRootView()->AddChildView(v); |
4574 EXPECT_TRUE(v->on_native_theme_changed_called()); | 4577 EXPECT_TRUE(v->on_native_theme_changed_called()); |
4575 } | 4578 } |
4576 | 4579 |
4577 } // namespace views | 4580 } // namespace views |
OLD | NEW |