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 4640 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4651 widget->Init(params); | 4651 widget->Init(params); |
4652 widget->SetBounds(gfx::Rect(0, 0, 100, 100)); | 4652 widget->SetBounds(gfx::Rect(0, 0, 100, 100)); |
4653 widget->GetContentsView()->AddChildView(&view); | 4653 widget->GetContentsView()->AddChildView(&view); |
4654 widget->Show(); | 4654 widget->Show(); |
4655 | 4655 |
4656 EXPECT_TRUE(view.layer()); | 4656 EXPECT_TRUE(view.layer()); |
4657 EXPECT_TRUE(view.GetWidget()); | 4657 EXPECT_TRUE(view.GetWidget()); |
4658 EXPECT_FALSE(view.was_hidden()); | 4658 EXPECT_FALSE(view.was_hidden()); |
4659 | 4659 |
4660 widget->Close(); | 4660 widget->Close(); |
4661 if (IsAuraMusClient()) { | 4661 EXPECT_FALSE(view.layer()); |
4662 // Mus on Ozone doesn't send the visibility change during Close(). | 4662 // Ensure the layer went away via VisibilityChanged(). |
4663 // See http://crbug.com/674003. | 4663 EXPECT_TRUE(view.was_hidden()); |
4664 EXPECT_TRUE(view.layer()); | |
4665 EXPECT_FALSE(view.was_hidden()); | |
4666 } else { | |
4667 EXPECT_FALSE(view.layer()); | |
4668 // Ensure the layer went away via VisibilityChanged(). | |
4669 EXPECT_TRUE(view.was_hidden()); | |
4670 } | |
4671 | 4664 |
4672 // Not removed from Widget until Close() completes. | 4665 // Not removed from Widget until Close() completes. |
4673 EXPECT_TRUE(view.GetWidget()); | 4666 EXPECT_TRUE(view.GetWidget()); |
4674 base::RunLoop().RunUntilIdle(); // Let the Close() complete. | 4667 base::RunLoop().RunUntilIdle(); // Let the Close() complete. |
4675 EXPECT_FALSE(view.GetWidget()); | 4668 EXPECT_FALSE(view.GetWidget()); |
4676 } | 4669 } |
4677 | 4670 |
4678 //////////////////////////////////////////////////////////////////////////////// | 4671 //////////////////////////////////////////////////////////////////////////////// |
4679 // Observer tests. | 4672 // Observer tests. |
4680 //////////////////////////////////////////////////////////////////////////////// | 4673 //////////////////////////////////////////////////////////////////////////////// |
(...skipping 146 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4827 std::unique_ptr<View> view = NewView(); | 4820 std::unique_ptr<View> view = NewView(); |
4828 std::unique_ptr<View> child_view = NewView(); | 4821 std::unique_ptr<View> child_view = NewView(); |
4829 std::unique_ptr<View> child_view2 = NewView(); | 4822 std::unique_ptr<View> child_view2 = NewView(); |
4830 view->AddChildView(child_view.get()); | 4823 view->AddChildView(child_view.get()); |
4831 view->AddChildView(child_view2.get()); | 4824 view->AddChildView(child_view2.get()); |
4832 view->ReorderChildView(child_view2.get(), 0); | 4825 view->ReorderChildView(child_view2.get(), 0); |
4833 EXPECT_EQ(child_view2.get(), view_reordered()); | 4826 EXPECT_EQ(child_view2.get(), view_reordered()); |
4834 } | 4827 } |
4835 | 4828 |
4836 } // namespace views | 4829 } // namespace views |
OLD | NEW |