| 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 "base/run_loop.h" | |
| 11 #include "ui/aura/client/cursor_client.h" | 10 #include "ui/aura/client/cursor_client.h" |
| 11 #include "ui/aura/mus/in_flight_change.h" |
| 12 #include "ui/aura/test/mus/change_completion_waiter.h" |
| 12 #include "ui/aura/window.h" | 13 #include "ui/aura/window.h" |
| 14 #include "ui/views/mus/mus_client.h" |
| 13 #include "ui/views/test/views_test_base.h" | 15 #include "ui/views/test/views_test_base.h" |
| 14 #include "ui/views/widget/widget.h" | 16 #include "ui/views/widget/widget.h" |
| 15 #include "ui/views/widget/widget_delegate.h" | 17 #include "ui/views/widget/widget_delegate.h" |
| 16 #include "ui/views/widget/widget_observer.h" | 18 #include "ui/views/widget/widget_observer.h" |
| 17 | 19 |
| 18 namespace views { | 20 namespace views { |
| 19 | 21 |
| 20 class DesktopWindowTreeHostMusTest : public ViewsTestBase, | 22 class DesktopWindowTreeHostMusTest : public ViewsTestBase, |
| 21 public WidgetObserver { | 23 public WidgetObserver { |
| 22 public: | 24 public: |
| (...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 140 widget->Show(); | 142 widget->Show(); |
| 141 | 143 |
| 142 std::unique_ptr<aura::Window> window(new aura::Window(nullptr)); | 144 std::unique_ptr<aura::Window> window(new aura::Window(nullptr)); |
| 143 window->Init(ui::LAYER_SOLID_COLOR); | 145 window->Init(ui::LAYER_SOLID_COLOR); |
| 144 ExpectsNullCursorClientDuringTearDown observer(window.get()); | 146 ExpectsNullCursorClientDuringTearDown observer(window.get()); |
| 145 | 147 |
| 146 widget->GetNativeWindow()->AddChild(window.release()); | 148 widget->GetNativeWindow()->AddChild(window.release()); |
| 147 widget.reset(); | 149 widget.reset(); |
| 148 } | 150 } |
| 149 | 151 |
| 152 TEST_F(DesktopWindowTreeHostMusTest, StackAtTop) { |
| 153 std::unique_ptr<Widget> widget1(CreateWidget(nullptr)); |
| 154 widget1->Show(); |
| 155 |
| 156 std::unique_ptr<Widget> widget2(CreateWidget(nullptr)); |
| 157 widget2->Show(); |
| 158 |
| 159 aura::test::ChangeCompletionWaiter waiter( |
| 160 MusClient::Get()->window_tree_client(), |
| 161 aura::ChangeType::REORDER, true); |
| 162 widget1->StackAtTop(); |
| 163 waiter.Wait(); |
| 164 |
| 165 // Other than the signal that our StackAtTop() succeeded, we don't have any |
| 166 // pieces of public data that we can check. If we actually stopped waiting, |
| 167 // count that as success. |
| 168 } |
| 169 |
| 170 TEST_F(DesktopWindowTreeHostMusTest, StackAtTopAlreadyOnTop) { |
| 171 std::unique_ptr<Widget> widget1(CreateWidget(nullptr)); |
| 172 widget1->Show(); |
| 173 |
| 174 std::unique_ptr<Widget> widget2(CreateWidget(nullptr)); |
| 175 widget2->Show(); |
| 176 |
| 177 aura::test::ChangeCompletionWaiter waiter( |
| 178 MusClient::Get()->window_tree_client(), |
| 179 aura::ChangeType::REORDER, true); |
| 180 widget2->StackAtTop(); |
| 181 waiter.Wait(); |
| 182 } |
| 183 |
| 150 } // namespace views | 184 } // namespace views |
| OLD | NEW |