| 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 #include "ui/views/mus/desktop_window_tree_host_mus.h" | 5 #include "ui/views/mus/desktop_window_tree_host_mus.h" |
| 6 | 6 |
| 7 #include "base/debug/stack_trace.h" | 7 #include "base/debug/stack_trace.h" |
| 8 | 8 |
| 9 #include "base/memory/ptr_util.h" | 9 #include "base/memory/ptr_util.h" |
| 10 #include "ui/aura/client/cursor_client.h" | 10 #include "ui/aura/client/cursor_client.h" |
| 11 #include "ui/aura/client/focus_client.h" | 11 #include "ui/aura/client/focus_client.h" |
| 12 #include "ui/aura/client/transient_window_client.h" | 12 #include "ui/aura/client/transient_window_client.h" |
| 13 #include "ui/aura/env.h" | 13 #include "ui/aura/env.h" |
| 14 #include "ui/aura/mus/capture_synchronizer.h" | 14 #include "ui/aura/mus/capture_synchronizer.h" |
| 15 #include "ui/aura/mus/in_flight_change.h" | 15 #include "ui/aura/mus/in_flight_change.h" |
| 16 #include "ui/aura/mus/window_mus.h" | 16 #include "ui/aura/mus/window_mus.h" |
| 17 #include "ui/aura/mus/window_tree_client.h" | 17 #include "ui/aura/mus/window_tree_client.h" |
| 18 #include "ui/aura/test/mus/change_completion_waiter.h" | 18 #include "ui/aura/test/mus/change_completion_waiter.h" |
| 19 #include "ui/aura/window.h" | 19 #include "ui/aura/window.h" |
| 20 #include "ui/views/mus/mus_client.h" | 20 #include "ui/views/mus/mus_client.h" |
| 21 #include "ui/views/test/views_test_base.h" | 21 #include "ui/views/test/views_test_base.h" |
| 22 #include "ui/views/widget/widget.h" | 22 #include "ui/views/widget/widget.h" |
| 23 #include "ui/views/widget/widget_delegate.h" | 23 #include "ui/views/widget/widget_delegate.h" |
| 24 #include "ui/views/widget/widget_observer.h" | 24 #include "ui/views/widget/widget_observer.h" |
| 25 #include "ui/wm/core/shadow_types.h" |
| 25 | 26 |
| 26 namespace views { | 27 namespace views { |
| 27 | 28 |
| 28 class DesktopWindowTreeHostMusTest : public ViewsTestBase, | 29 class DesktopWindowTreeHostMusTest : public ViewsTestBase, |
| 29 public WidgetObserver { | 30 public WidgetObserver { |
| 30 public: | 31 public: |
| 31 DesktopWindowTreeHostMusTest() | 32 DesktopWindowTreeHostMusTest() |
| 32 : widget_activated_(nullptr), | 33 : widget_activated_(nullptr), |
| 33 widget_deactivated_(nullptr), | 34 widget_deactivated_(nullptr), |
| 34 waiting_for_deactivate_(nullptr) {} | 35 waiting_for_deactivate_(nullptr) {} |
| (...skipping 253 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 288 | 289 |
| 289 aura::client::TransientWindowClient* transient_window_client = | 290 aura::client::TransientWindowClient* transient_window_client = |
| 290 aura::client::GetTransientWindowClient(); | 291 aura::client::GetTransientWindowClient(); |
| 291 // Even though the widget1->GetNativeView() was specified as the parent we | 292 // Even though the widget1->GetNativeView() was specified as the parent we |
| 292 // expect the transient parents to be marked at the host level. | 293 // expect the transient parents to be marked at the host level. |
| 293 EXPECT_EQ(widget1->GetNativeView()->GetHost()->window(), | 294 EXPECT_EQ(widget1->GetNativeView()->GetHost()->window(), |
| 294 transient_window_client->GetTransientParent( | 295 transient_window_client->GetTransientParent( |
| 295 widget2->GetNativeView()->GetHost()->window())); | 296 widget2->GetNativeView()->GetHost()->window())); |
| 296 } | 297 } |
| 297 | 298 |
| 299 TEST_F(DesktopWindowTreeHostMusTest, ShadowDefaults) { |
| 300 Widget widget; |
| 301 Widget::InitParams params(Widget::InitParams::TYPE_WINDOW); |
| 302 params.ownership = Widget::InitParams::WIDGET_OWNS_NATIVE_WIDGET; |
| 303 widget.Init(params); |
| 304 // |DesktopNativeWidgetAura::content_window_| should have no shadow; the wm |
| 305 // should provide it if it so desires. |
| 306 EXPECT_EQ(wm::ShadowElevation::NONE, |
| 307 widget.GetNativeView()->GetProperty(wm::kShadowElevationKey)); |
| 308 // The wm honors the shadow property from the WindowTreeHost's window. |
| 309 EXPECT_EQ(wm::ShadowElevation::DEFAULT, |
| 310 widget.GetNativeView()->GetHost()->window()->GetProperty( |
| 311 wm::kShadowElevationKey)); |
| 312 } |
| 313 |
| 314 TEST_F(DesktopWindowTreeHostMusTest, NoShadow) { |
| 315 Widget widget; |
| 316 Widget::InitParams params(Widget::InitParams::TYPE_WINDOW); |
| 317 params.ownership = Widget::InitParams::WIDGET_OWNS_NATIVE_WIDGET; |
| 318 params.shadow_type = Widget::InitParams::SHADOW_TYPE_NONE; |
| 319 widget.Init(params); |
| 320 EXPECT_EQ(wm::ShadowElevation::NONE, |
| 321 widget.GetNativeView()->GetProperty(wm::kShadowElevationKey)); |
| 322 EXPECT_EQ(wm::ShadowElevation::NONE, |
| 323 widget.GetNativeView()->GetHost()->window()->GetProperty( |
| 324 wm::kShadowElevationKey)); |
| 325 } |
| 326 |
| 298 } // namespace views | 327 } // namespace views |
| OLD | NEW |