| 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 <algorithm> | 5 #include <algorithm> |
| 6 #include <memory> | 6 #include <memory> |
| 7 #include <set> | 7 #include <set> |
| 8 | 8 |
| 9 #include "base/bind.h" | 9 #include "base/bind.h" |
| 10 #include "base/macros.h" | 10 #include "base/macros.h" |
| (...skipping 2959 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2970 Widget* w22 = CreateChildPlatformWidget(w2->GetNativeView()); | 2970 Widget* w22 = CreateChildPlatformWidget(w2->GetNativeView()); |
| 2971 | 2971 |
| 2972 std::set<Widget*> expected; | 2972 std::set<Widget*> expected; |
| 2973 expected.insert(toplevel.get()); | 2973 expected.insert(toplevel.get()); |
| 2974 expected.insert(w1); | 2974 expected.insert(w1); |
| 2975 expected.insert(w11); | 2975 expected.insert(w11); |
| 2976 expected.insert(w2); | 2976 expected.insert(w2); |
| 2977 expected.insert(w21); | 2977 expected.insert(w21); |
| 2978 expected.insert(w22); | 2978 expected.insert(w22); |
| 2979 | 2979 |
| 2980 std::set<Widget*> widgets; | 2980 std::set<Widget*> child_widgets; |
| 2981 Widget::GetAllChildWidgets(toplevel->GetNativeView(), &widgets); | 2981 Widget::GetAllChildWidgets(toplevel->GetNativeView(), &child_widgets); |
| 2982 | 2982 |
| 2983 EXPECT_EQ(expected.size(), widgets.size()); | 2983 EXPECT_EQ(expected.size(), child_widgets.size()); |
| 2984 EXPECT_TRUE(std::equal(expected.begin(), expected.end(), widgets.begin())); | 2984 EXPECT_TRUE( |
| 2985 std::equal(expected.begin(), expected.end(), child_widgets.begin())); |
| 2986 |
| 2987 // Check GetAllOwnedWidgets(). On Aura, this includes "transient" children. |
| 2988 // Otherwise (on all platforms), it should be the same as GetAllChildWidgets() |
| 2989 // except the root Widget is not included. |
| 2990 EXPECT_EQ(1u, expected.erase(toplevel.get())); |
| 2991 |
| 2992 std::set<Widget*> owned_widgets; |
| 2993 Widget::GetAllOwnedWidgets(toplevel->GetNativeView(), &owned_widgets); |
| 2994 |
| 2995 EXPECT_EQ(expected.size(), owned_widgets.size()); |
| 2996 EXPECT_TRUE( |
| 2997 std::equal(expected.begin(), expected.end(), owned_widgets.begin())); |
| 2985 } | 2998 } |
| 2986 | 2999 |
| 2987 // Used by DestroyChildWidgetsInOrder. On destruction adds the supplied name to | 3000 // Used by DestroyChildWidgetsInOrder. On destruction adds the supplied name to |
| 2988 // a vector. | 3001 // a vector. |
| 2989 class DestroyedTrackingView : public View { | 3002 class DestroyedTrackingView : public View { |
| 2990 public: | 3003 public: |
| 2991 DestroyedTrackingView(const std::string& name, | 3004 DestroyedTrackingView(const std::string& name, |
| 2992 std::vector<std::string>* add_to) | 3005 std::vector<std::string>* add_to) |
| 2993 : name_(name), | 3006 : name_(name), |
| 2994 add_to_(add_to) { | 3007 add_to_(add_to) { |
| (...skipping 864 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3859 } | 3872 } |
| 3860 | 3873 |
| 3861 TEST_F(CompositingWidgetTest, Transparency_DesktopWidgetTranslucent) { | 3874 TEST_F(CompositingWidgetTest, Transparency_DesktopWidgetTranslucent) { |
| 3862 CheckAllWidgetsForOpacity(Widget::InitParams::TRANSLUCENT_WINDOW); | 3875 CheckAllWidgetsForOpacity(Widget::InitParams::TRANSLUCENT_WINDOW); |
| 3863 } | 3876 } |
| 3864 | 3877 |
| 3865 #endif // !defined(OS_CHROMEOS) | 3878 #endif // !defined(OS_CHROMEOS) |
| 3866 | 3879 |
| 3867 } // namespace test | 3880 } // namespace test |
| 3868 } // namespace views | 3881 } // namespace views |
| OLD | NEW |