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

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

Issue 2714763002: Change FocusSynchronizer to maintain active focus client and window. (Closed)
Patch Set: test Created 3 years, 8 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') | no next file » | 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/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/focus_synchronizer.h"
15 #include "ui/aura/mus/in_flight_change.h" 16 #include "ui/aura/mus/in_flight_change.h"
16 #include "ui/aura/mus/window_mus.h" 17 #include "ui/aura/mus/window_mus.h"
17 #include "ui/aura/mus/window_tree_client.h" 18 #include "ui/aura/mus/window_tree_client.h"
18 #include "ui/aura/test/mus/change_completion_waiter.h" 19 #include "ui/aura/test/mus/change_completion_waiter.h"
19 #include "ui/aura/window.h" 20 #include "ui/aura/window.h"
20 #include "ui/views/mus/mus_client.h" 21 #include "ui/views/mus/mus_client.h"
21 #include "ui/views/test/views_test_base.h" 22 #include "ui/views/test/views_test_base.h"
22 #include "ui/views/widget/widget.h" 23 #include "ui/views/widget/widget.h"
23 #include "ui/views/widget/widget_delegate.h" 24 #include "ui/views/widget/widget_delegate.h"
24 #include "ui/views/widget/widget_observer.h" 25 #include "ui/views/widget/widget_observer.h"
(...skipping 175 matching lines...) Expand 10 before | Expand all | Expand 10 after
200 widget1->Show(); 201 widget1->Show();
201 widget1->Activate(); 202 widget1->Activate();
202 EXPECT_TRUE(widget1->IsActive()); 203 EXPECT_TRUE(widget1->IsActive());
203 // The Widget's NativeWindow (|DesktopNativeWidgetAura::content_window_|) 204 // The Widget's NativeWindow (|DesktopNativeWidgetAura::content_window_|)
204 // should be active. 205 // should be active.
205 EXPECT_TRUE(widget1->GetNativeWindow()->HasFocus()); 206 EXPECT_TRUE(widget1->GetNativeWindow()->HasFocus());
206 // Env's active FocusClient should match the active window. 207 // Env's active FocusClient should match the active window.
207 aura::client::FocusClient* widget_focus_client = 208 aura::client::FocusClient* widget_focus_client =
208 aura::client::GetFocusClient(widget1->GetNativeWindow()); 209 aura::client::GetFocusClient(widget1->GetNativeWindow());
209 ASSERT_TRUE(widget_focus_client); 210 ASSERT_TRUE(widget_focus_client);
210 EXPECT_EQ(widget_focus_client, 211 EXPECT_EQ(widget_focus_client, MusClient::Get()
211 aura::Env::GetInstance()->active_focus_client()); 212 ->window_tree_client()
213 ->focus_synchronizer()
214 ->active_focus_client());
212 } 215 }
213 216
214 TEST_F(DesktopWindowTreeHostMusTest, CursorClientDuringTearDown) { 217 TEST_F(DesktopWindowTreeHostMusTest, CursorClientDuringTearDown) {
215 std::unique_ptr<Widget> widget(CreateWidget()); 218 std::unique_ptr<Widget> widget(CreateWidget());
216 widget->Show(); 219 widget->Show();
217 220
218 std::unique_ptr<aura::Window> window(new aura::Window(nullptr)); 221 std::unique_ptr<aura::Window> window(new aura::Window(nullptr));
219 window->Init(ui::LAYER_SOLID_COLOR); 222 window->Init(ui::LAYER_SOLID_COLOR);
220 ExpectsNullCursorClientDuringTearDown observer(window.get()); 223 ExpectsNullCursorClientDuringTearDown observer(window.get());
221 224
(...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after
318 params.shadow_type = Widget::InitParams::SHADOW_TYPE_NONE; 321 params.shadow_type = Widget::InitParams::SHADOW_TYPE_NONE;
319 widget.Init(params); 322 widget.Init(params);
320 EXPECT_EQ(wm::ShadowElevation::NONE, 323 EXPECT_EQ(wm::ShadowElevation::NONE,
321 widget.GetNativeView()->GetProperty(wm::kShadowElevationKey)); 324 widget.GetNativeView()->GetProperty(wm::kShadowElevationKey));
322 EXPECT_EQ(wm::ShadowElevation::NONE, 325 EXPECT_EQ(wm::ShadowElevation::NONE,
323 widget.GetNativeView()->GetHost()->window()->GetProperty( 326 widget.GetNativeView()->GetHost()->window()->GetProperty(
324 wm::kShadowElevationKey)); 327 wm::kShadowElevationKey));
325 } 328 }
326 329
327 } // namespace views 330 } // namespace views
OLDNEW
« no previous file with comments | « ui/views/mus/desktop_window_tree_host_mus.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698