Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(242)

Side by Side Diff: ui/views/mus/desktop_window_tree_host_mus_unittest.cc

Issue 2674683002: Revert: Change CaptureSynchronizer and PointerWatcherEventRouter to support multiple CaptureClients (Closed)
Patch Set: Created 3 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « ui/views/mus/desktop_window_tree_host_mus.cc ('k') | ui/views/mus/mus_client.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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/transient_window_client.h" 11 #include "ui/aura/client/transient_window_client.h"
12 #include "ui/aura/mus/capture_synchronizer.h"
13 #include "ui/aura/mus/in_flight_change.h" 12 #include "ui/aura/mus/in_flight_change.h"
14 #include "ui/aura/mus/window_mus.h"
15 #include "ui/aura/mus/window_tree_client.h"
16 #include "ui/aura/test/mus/change_completion_waiter.h" 13 #include "ui/aura/test/mus/change_completion_waiter.h"
17 #include "ui/aura/window.h" 14 #include "ui/aura/window.h"
18 #include "ui/views/mus/mus_client.h" 15 #include "ui/views/mus/mus_client.h"
19 #include "ui/views/test/views_test_base.h" 16 #include "ui/views/test/views_test_base.h"
20 #include "ui/views/widget/widget.h" 17 #include "ui/views/widget/widget.h"
21 #include "ui/views/widget/widget_delegate.h" 18 #include "ui/views/widget/widget_delegate.h"
22 #include "ui/views/widget/widget_observer.h" 19 #include "ui/views/widget/widget_observer.h"
23 20
24 namespace views { 21 namespace views {
25 22
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after
120 widget->Show(); 117 widget->Show();
121 EXPECT_TRUE(widget->IsVisible()); 118 EXPECT_TRUE(widget->IsVisible());
122 EXPECT_TRUE(widget->GetNativeView()->IsVisible()); 119 EXPECT_TRUE(widget->GetNativeView()->IsVisible());
123 EXPECT_TRUE(widget->GetNativeView()->parent()->IsVisible()); 120 EXPECT_TRUE(widget->GetNativeView()->parent()->IsVisible());
124 widget->Hide(); 121 widget->Hide();
125 EXPECT_FALSE(widget->IsVisible()); 122 EXPECT_FALSE(widget->IsVisible());
126 EXPECT_FALSE(widget->GetNativeView()->IsVisible()); 123 EXPECT_FALSE(widget->GetNativeView()->IsVisible());
127 EXPECT_FALSE(widget->GetNativeView()->parent()->IsVisible()); 124 EXPECT_FALSE(widget->GetNativeView()->parent()->IsVisible());
128 } 125 }
129 126
130 TEST_F(DesktopWindowTreeHostMusTest, Capture) {
131 std::unique_ptr<Widget> widget1(CreateWidget());
132 widget1->Show();
133 EXPECT_FALSE(widget1->HasCapture());
134
135 std::unique_ptr<Widget> widget2(CreateWidget());
136 widget2->Show();
137 EXPECT_FALSE(widget2->HasCapture());
138
139 widget1->SetCapture(widget1->GetRootView());
140 EXPECT_TRUE(widget1->HasCapture());
141 EXPECT_FALSE(widget2->HasCapture());
142 EXPECT_EQ(widget1->GetNativeWindow(), MusClient::Get()
143 ->window_tree_client()
144 ->capture_synchronizer()
145 ->capture_window()
146 ->GetWindow());
147
148 widget2->SetCapture(widget2->GetRootView());
149 EXPECT_TRUE(widget2->HasCapture());
150 EXPECT_EQ(widget2->GetNativeWindow(), MusClient::Get()
151 ->window_tree_client()
152 ->capture_synchronizer()
153 ->capture_window()
154 ->GetWindow());
155
156 widget1->ReleaseCapture();
157 EXPECT_TRUE(widget2->HasCapture());
158 EXPECT_FALSE(widget1->HasCapture());
159 EXPECT_EQ(widget2->GetNativeWindow(), MusClient::Get()
160 ->window_tree_client()
161 ->capture_synchronizer()
162 ->capture_window()
163 ->GetWindow());
164
165 widget2->ReleaseCapture();
166 EXPECT_FALSE(widget2->HasCapture());
167 EXPECT_FALSE(widget1->HasCapture());
168 EXPECT_EQ(nullptr, MusClient::Get()
169 ->window_tree_client()
170 ->capture_synchronizer()
171 ->capture_window());
172 }
173
174 TEST_F(DesktopWindowTreeHostMusTest, Deactivate) { 127 TEST_F(DesktopWindowTreeHostMusTest, Deactivate) {
175 std::unique_ptr<Widget> widget1(CreateWidget()); 128 std::unique_ptr<Widget> widget1(CreateWidget());
176 widget1->Show(); 129 widget1->Show();
177 130
178 std::unique_ptr<Widget> widget2(CreateWidget()); 131 std::unique_ptr<Widget> widget2(CreateWidget());
179 widget2->Show(); 132 widget2->Show();
180 133
181 widget1->Activate(); 134 widget1->Activate();
182 RunPendingMessages(); 135 RunPendingMessages();
183 EXPECT_TRUE(widget1->IsActive()); 136 EXPECT_TRUE(widget1->IsActive());
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after
256 aura::client::TransientWindowClient* transient_window_client = 209 aura::client::TransientWindowClient* transient_window_client =
257 aura::client::GetTransientWindowClient(); 210 aura::client::GetTransientWindowClient();
258 // Even though the widget1->GetNativeView() was specified as the parent we 211 // Even though the widget1->GetNativeView() was specified as the parent we
259 // expect the transient parents to be marked at the host level. 212 // expect the transient parents to be marked at the host level.
260 EXPECT_EQ(widget1->GetNativeView()->GetHost()->window(), 213 EXPECT_EQ(widget1->GetNativeView()->GetHost()->window(),
261 transient_window_client->GetTransientParent( 214 transient_window_client->GetTransientParent(
262 widget2->GetNativeView()->GetHost()->window())); 215 widget2->GetNativeView()->GetHost()->window()));
263 } 216 }
264 217
265 } // namespace views 218 } // namespace views
OLDNEW
« no previous file with comments | « ui/views/mus/desktop_window_tree_host_mus.cc ('k') | ui/views/mus/mus_client.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698