OLD | NEW |
1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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 | 5 |
6 #include "base/callback.h" | 6 #include "base/callback.h" |
7 #include "base/macros.h" | 7 #include "base/macros.h" |
8 #include "services/ui/public/cpp/property_type_converters.h" | 8 #include "services/ui/public/cpp/property_type_converters.h" |
9 #include "services/ui/public/cpp/tests/window_tree_client_private.h" | 9 #include "services/ui/public/cpp/tests/window_tree_client_private.h" |
10 #include "services/ui/public/cpp/window.h" | 10 #include "services/ui/public/cpp/window.h" |
11 #include "services/ui/public/cpp/window_observer.h" | 11 #include "services/ui/public/cpp/window_observer.h" |
12 #include "services/ui/public/cpp/window_property.h" | 12 #include "services/ui/public/cpp/window_property.h" |
13 #include "services/ui/public/cpp/window_tree_client.h" | 13 #include "services/ui/public/cpp/window_tree_client.h" |
14 #include "services/ui/public/interfaces/window_manager.mojom.h" | 14 #include "services/ui/public/interfaces/window_manager.mojom.h" |
15 #include "services/ui/public/interfaces/window_tree.mojom.h" | 15 #include "services/ui/public/interfaces/window_tree.mojom.h" |
16 #include "testing/gtest/include/gtest/gtest.h" | 16 #include "testing/gtest/include/gtest/gtest.h" |
17 #include "third_party/skia/include/core/SkBitmap.h" | 17 #include "third_party/skia/include/core/SkBitmap.h" |
18 #include "third_party/skia/include/core/SkColor.h" | 18 #include "third_party/skia/include/core/SkColor.h" |
| 19 #include "ui/aura/mus/property_converter.h" |
19 #include "ui/aura/window.h" | 20 #include "ui/aura/window.h" |
20 #include "ui/events/event.h" | 21 #include "ui/events/event.h" |
21 #include "ui/events/test/test_event_handler.h" | 22 #include "ui/events/test/test_event_handler.h" |
22 #include "ui/gfx/geometry/rect.h" | 23 #include "ui/gfx/geometry/rect.h" |
23 #include "ui/gfx/image/image_skia.h" | 24 #include "ui/gfx/image/image_skia.h" |
24 #include "ui/gfx/path.h" | 25 #include "ui/gfx/path.h" |
25 #include "ui/gfx/skia_util.h" | 26 #include "ui/gfx/skia_util.h" |
26 #include "ui/views/controls/native/native_view_host.h" | 27 #include "ui/views/controls/native/native_view_host.h" |
27 #include "ui/views/mus/native_widget_mus.h" | 28 #include "ui/views/mus/native_widget_mus.h" |
28 #include "ui/views/mus/window_manager_connection.h" | 29 #include "ui/views/mus/window_manager_connection.h" |
(...skipping 586 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
615 window->AddObserver(&observer); | 616 window->AddObserver(&observer); |
616 | 617 |
617 std::unique_ptr<Widget> widget(new Widget()); | 618 std::unique_ptr<Widget> widget(new Widget()); |
618 observer.set_widget(widget.get()); | 619 observer.set_widget(widget.get()); |
619 Widget::InitParams params = CreateParams(Widget::InitParams::TYPE_WINDOW); | 620 Widget::InitParams params = CreateParams(Widget::InitParams::TYPE_WINDOW); |
620 params.ownership = Widget::InitParams::WIDGET_OWNS_NATIVE_WIDGET; | 621 params.ownership = Widget::InitParams::WIDGET_OWNS_NATIVE_WIDGET; |
621 params.bounds = initial_bounds(); | 622 params.bounds = initial_bounds(); |
622 params.native_widget = new NativeWidgetMus( | 623 params.native_widget = new NativeWidgetMus( |
623 widget.get(), window, ui::mojom::CompositorFrameSinkType::DEFAULT); | 624 widget.get(), window, ui::mojom::CompositorFrameSinkType::DEFAULT); |
624 widget->Init(params); | 625 widget->Init(params); |
625 window->SetSharedProperty<int32_t>( | 626 window->SetSharedProperty<aura::PropertyConverter::PrimitiveType>( |
626 ui::mojom::WindowManager::kShowState_Property, | 627 ui::mojom::WindowManager::kShowState_Property, |
627 static_cast<uint32_t>(ui::mojom::ShowState::MAXIMIZED)); | 628 static_cast<aura::PropertyConverter::PrimitiveType>( |
| 629 ui::mojom::ShowState::MAXIMIZED)); |
628 EXPECT_TRUE(widget->IsMaximized()); | 630 EXPECT_TRUE(widget->IsMaximized()); |
629 } | 631 } |
630 | 632 |
631 // This test is to ensure that when initializing a widget with InitParams.parent | 633 // This test is to ensure that when initializing a widget with InitParams.parent |
632 // set to another widget's aura::Window, the ui::Window of the former widget is | 634 // set to another widget's aura::Window, the ui::Window of the former widget is |
633 // added as a child to the ui::Window of the latter widget. | 635 // added as a child to the ui::Window of the latter widget. |
634 TEST_F(NativeWidgetMusTest, InitNativeWidgetParentsUIWindow) { | 636 TEST_F(NativeWidgetMusTest, InitNativeWidgetParentsUIWindow) { |
635 ASSERT_TRUE(WindowManagerConnection::Exists()); | 637 ASSERT_TRUE(WindowManagerConnection::Exists()); |
636 | 638 |
637 ui::Window* parent_window = WindowManagerConnection::Get()->NewTopLevelWindow( | 639 ui::Window* parent_window = WindowManagerConnection::Get()->NewTopLevelWindow( |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
672 not_child_params.name = "Not Child Widget"; | 674 not_child_params.name = "Not Child Widget"; |
673 not_child_params.native_widget = | 675 not_child_params.native_widget = |
674 new NativeWidgetMus(not_child_widget.get(), not_child_window, | 676 new NativeWidgetMus(not_child_widget.get(), not_child_window, |
675 ui::mojom::CompositorFrameSinkType::DEFAULT); | 677 ui::mojom::CompositorFrameSinkType::DEFAULT); |
676 not_child_widget->Init(not_child_params); | 678 not_child_widget->Init(not_child_params); |
677 | 679 |
678 EXPECT_NE(not_child_window->parent(), parent_window); | 680 EXPECT_NE(not_child_window->parent(), parent_window); |
679 } | 681 } |
680 | 682 |
681 } // namespace views | 683 } // namespace views |
OLD | NEW |