1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
8 #include "base/message_loop/message_loop.h"
9 #include "components/view_manager/client_connection.h"
10 #include "components/view_manager/connection_manager.h"
11 #include "components/view_manager/connection_manager_delegate.h"
12 #include "components/view_manager/display_manager.h"
13 #include "components/view_manager/ids.h"
14 #include "components/view_manager/public/cpp/types.h"
15 #include "components/view_manager/public/cpp/util.h"
16 #include "components/view_manager/public/interfaces/view_manager.mojom.h"
17 #include "components/view_manager/server_view.h"
18 #include "components/view_manager/test_change_tracker.h"
19 #include "components/view_manager/view_manager_service_impl.h"
20 #include "mojo/application/public/interfaces/service_provider.mojom.h"
21 #include "mojo/converters/geometry/geometry_type_converters.h"
22 #include "testing/gtest/include/gtest/gtest.h"
23 #include "ui/gfx/geometry/rect.h"
26 using mojo::ERROR_CODE_NONE
;
27 using mojo::InterfaceRequest
;
28 using mojo::ServiceProvider
;
29 using mojo::ServiceProviderPtr
;
31 using mojo::ViewDataPtr
;
33 namespace view_manager
{
36 // -----------------------------------------------------------------------------
38 // ViewManagerClient implementation that logs all calls to a TestChangeTracker.
39 // TODO(sky): refactor so both this and ViewManagerServiceAppTest share code.
40 class TestViewManagerClient
: public mojo::ViewManagerClient
{
42 TestViewManagerClient() {}
43 ~TestViewManagerClient() override
{}
45 TestChangeTracker
* tracker() { return &tracker_
; }
49 void OnEmbed(uint16_t connection_id
,
50 const String
& embedder_url
,
52 mojo::ViewManagerServicePtr view_manager_service
,
53 InterfaceRequest
<ServiceProvider
> services
,
54 ServiceProviderPtr exposed_services
,
55 mojo::Id focused_view_id
) override
{
56 // TODO(sky): add test coverage of |focused_view_id|.
57 tracker_
.OnEmbed(connection_id
, embedder_url
, root
.Pass());
59 void OnEmbeddedAppDisconnected(uint32_t view
) override
{
60 tracker_
.OnEmbeddedAppDisconnected(view
);
62 void OnViewBoundsChanged(uint32_t view
,
63 mojo::RectPtr old_bounds
,
64 mojo::RectPtr new_bounds
) override
{
65 tracker_
.OnViewBoundsChanged(view
, old_bounds
.Pass(), new_bounds
.Pass());
67 void OnViewViewportMetricsChanged(
68 mojo::ViewportMetricsPtr old_metrics
,
69 mojo::ViewportMetricsPtr new_metrics
) override
{
70 tracker_
.OnViewViewportMetricsChanged(old_metrics
.Pass(),
73 void OnViewHierarchyChanged(uint32_t view
,
76 Array
<ViewDataPtr
> views
) override
{
77 tracker_
.OnViewHierarchyChanged(view
, new_parent
, old_parent
, views
.Pass());
79 void OnViewReordered(uint32_t view_id
,
80 uint32_t relative_view_id
,
81 mojo::OrderDirection direction
) override
{
82 tracker_
.OnViewReordered(view_id
, relative_view_id
, direction
);
84 void OnViewDeleted(uint32_t view
) override
{ tracker_
.OnViewDeleted(view
); }
85 void OnViewVisibilityChanged(uint32_t view
, bool visible
) override
{
86 tracker_
.OnViewVisibilityChanged(view
, visible
);
88 void OnViewDrawnStateChanged(uint32_t view
, bool drawn
) override
{
89 tracker_
.OnViewDrawnStateChanged(view
, drawn
);
91 void OnViewSharedPropertyChanged(uint32_t view
,
93 Array
<uint8_t> new_data
) override
{
94 tracker_
.OnViewSharedPropertyChanged(view
, name
, new_data
.Pass());
96 void OnViewInputEvent(uint32_t view
,
98 const mojo::Callback
<void()>& callback
) override
{
99 tracker_
.OnViewInputEvent(view
, event
.Pass());
101 void OnViewFocused(uint32_t focused_view_id
) override
{
102 tracker_
.OnViewFocused(focused_view_id
);
105 TestChangeTracker tracker_
;
107 DISALLOW_COPY_AND_ASSIGN(TestViewManagerClient
);
110 // -----------------------------------------------------------------------------
112 // ClientConnection implementation that vends TestViewManagerClient.
113 class TestClientConnection
: public ClientConnection
{
115 explicit TestClientConnection(scoped_ptr
<ViewManagerServiceImpl
> service_impl
)
116 : ClientConnection(service_impl
.Pass(), &client_
) {}
117 ~TestClientConnection() override
{}
119 TestViewManagerClient
* client() { return &client_
; }
122 TestViewManagerClient client_
;
124 DISALLOW_COPY_AND_ASSIGN(TestClientConnection
);
127 // -----------------------------------------------------------------------------
129 // Empty implementation of ConnectionManagerDelegate.
130 class TestConnectionManagerDelegate
: public ConnectionManagerDelegate
{
132 TestConnectionManagerDelegate() : last_connection_(nullptr) {}
133 ~TestConnectionManagerDelegate() override
{}
135 TestViewManagerClient
* last_client() {
136 return last_connection_
? last_connection_
->client() : nullptr;
139 TestClientConnection
* last_connection() { return last_connection_
; }
142 // ConnectionManagerDelegate:
143 void OnLostConnectionToWindowManager() override
{}
145 ClientConnection
* CreateClientConnectionForEmbedAtView(
146 ConnectionManager
* connection_manager
,
147 mojo::InterfaceRequest
<mojo::ViewManagerService
> service_request
,
148 mojo::ConnectionSpecificId creator_id
,
149 const std::string
& creator_url
,
150 const std::string
& url
,
151 const ViewId
& root_id
) override
{
152 scoped_ptr
<ViewManagerServiceImpl
> service(new ViewManagerServiceImpl(
153 connection_manager
, creator_id
, creator_url
, url
, root_id
));
154 last_connection_
= new TestClientConnection(service
.Pass());
155 return last_connection_
;
157 ClientConnection
* CreateClientConnectionForEmbedAtView(
158 ConnectionManager
* connection_manager
,
159 mojo::InterfaceRequest
<mojo::ViewManagerService
> service_request
,
160 mojo::ConnectionSpecificId creator_id
,
161 const std::string
& creator_url
,
162 const ViewId
& root_id
,
163 mojo::ViewManagerClientPtr client
) override
{
168 TestClientConnection
* last_connection_
;
170 DISALLOW_COPY_AND_ASSIGN(TestConnectionManagerDelegate
);
173 // -----------------------------------------------------------------------------
175 // Empty implementation of DisplayManager.
176 class TestDisplayManager
: public DisplayManager
{
178 TestDisplayManager() {}
179 ~TestDisplayManager() override
{}
182 void Init(ConnectionManager
* connection_manager
,
183 mojo::NativeViewportEventDispatcherPtr event_dispatcher
) override
{}
184 void SchedulePaint(const ServerView
* view
, const gfx::Rect
& bounds
) override
{
186 void SetViewportSize(const gfx::Size
& size
) override
{}
187 const mojo::ViewportMetrics
& GetViewportMetrics() override
{
188 return display_metrices_
;
192 mojo::ViewportMetrics display_metrices_
;
194 DISALLOW_COPY_AND_ASSIGN(TestDisplayManager
);
197 mojo::EventPtr
CreatePointerDownEvent(int x
, int y
) {
198 mojo::EventPtr
event(mojo::Event::New());
199 event
->action
= mojo::EVENT_TYPE_POINTER_DOWN
;
200 event
->pointer_data
= mojo::PointerData::New();
201 event
->pointer_data
->pointer_id
= 1u;
202 event
->pointer_data
->x
= x
;
203 event
->pointer_data
->y
= y
;
207 mojo::EventPtr
CreatePointerUpEvent(int x
, int y
) {
208 mojo::EventPtr
event(mojo::Event::New());
209 event
->action
= mojo::EVENT_TYPE_POINTER_UP
;
210 event
->pointer_data
= mojo::PointerData::New();
211 event
->pointer_data
->pointer_id
= 1u;
212 event
->pointer_data
->x
= x
;
213 event
->pointer_data
->y
= y
;
219 // -----------------------------------------------------------------------------
221 class ViewManagerServiceTest
: public testing::Test
{
223 ViewManagerServiceTest() : wm_client_(nullptr) {}
224 ~ViewManagerServiceTest() override
{}
226 // ViewManagerServiceImpl for the window manager.
227 ViewManagerServiceImpl
* wm_connection() {
228 return connection_manager_
->GetConnection(1);
231 TestViewManagerClient
* last_view_manager_client() {
232 return delegate_
.last_client();
235 TestClientConnection
* last_client_connection() {
236 return delegate_
.last_connection();
239 ConnectionManager
* connection_manager() { return connection_manager_
.get(); }
241 TestViewManagerClient
* wm_client() { return wm_client_
; }
245 void SetUp() override
{
246 connection_manager_
.reset(new ConnectionManager(
247 &delegate_
, scoped_ptr
<DisplayManager
>(new TestDisplayManager
)));
248 scoped_ptr
<ViewManagerServiceImpl
> service(new ViewManagerServiceImpl(
249 connection_manager_
.get(), kInvalidConnectionId
, std::string(),
250 std::string("mojo:window_manager"), RootViewId()));
251 scoped_ptr
<TestClientConnection
> client_connection(
252 new TestClientConnection(service
.Pass()));
253 wm_client_
= client_connection
->client();
254 ASSERT_TRUE(wm_client_
!= nullptr);
255 connection_manager_
->SetWindowManagerClientConnection(
256 client_connection
.Pass());
257 ASSERT_TRUE(wm_connection() != nullptr);
258 ASSERT_TRUE(wm_connection()->root() != nullptr);
262 // TestViewManagerClient that is used for the WM connection.
263 TestViewManagerClient
* wm_client_
;
265 TestConnectionManagerDelegate delegate_
;
266 scoped_ptr
<ConnectionManager
> connection_manager_
;
267 base::MessageLoop message_loop_
;
269 DISALLOW_COPY_AND_ASSIGN(ViewManagerServiceTest
);
274 const ServerView
* GetFirstCloned(const ServerView
* view
) {
275 for (const ServerView
* child
: view
->GetChildren()) {
276 if (child
->id() == ClonedViewId())
282 // Provides common setup for animation tests. Creates the following views:
283 // 0,1 (the root, provided by view manager)
284 // 1,1 the second connection is embedded here (view owned by wm_connection()).
285 // 2,1 bounds=1,2 11x22
286 // 2,2 bounds=2,3 6x7
287 // 2,3 bounds=3,4 6x7
288 // CloneAndAnimate() is invoked for 2,2.
289 void SetUpAnimate1(ViewManagerServiceTest
* test
, ViewId
* embed_view_id
) {
290 *embed_view_id
= ViewId(test
->wm_connection()->id(), 1);
291 EXPECT_EQ(ERROR_CODE_NONE
, test
->wm_connection()->CreateView(*embed_view_id
));
292 EXPECT_TRUE(test
->wm_connection()->SetViewVisibility(*embed_view_id
, true));
293 EXPECT_TRUE(test
->wm_connection()->AddView(*(test
->wm_connection()->root()),
295 test
->wm_connection()->EmbedUrl(std::string(), *embed_view_id
, nullptr,
297 ViewManagerServiceImpl
* connection1
=
298 test
->connection_manager()->GetConnectionWithRoot(*embed_view_id
);
299 ASSERT_TRUE(connection1
!= nullptr);
300 ASSERT_NE(connection1
, test
->wm_connection());
302 const ViewId
child1(connection1
->id(), 1);
303 EXPECT_EQ(ERROR_CODE_NONE
, connection1
->CreateView(child1
));
304 const ViewId
child2(connection1
->id(), 2);
305 EXPECT_EQ(ERROR_CODE_NONE
, connection1
->CreateView(child2
));
306 const ViewId
child3(connection1
->id(), 3);
307 EXPECT_EQ(ERROR_CODE_NONE
, connection1
->CreateView(child3
));
309 ServerView
* v1
= connection1
->GetView(child1
);
310 v1
->SetVisible(true);
311 v1
->SetBounds(gfx::Rect(1, 2, 11, 22));
312 ServerView
* v2
= connection1
->GetView(child2
);
313 v2
->SetVisible(true);
314 v2
->SetBounds(gfx::Rect(2, 3, 6, 7));
315 ServerView
* v3
= connection1
->GetView(child3
);
316 v3
->SetVisible(true);
317 v3
->SetBounds(gfx::Rect(3, 4, 6, 7));
319 EXPECT_TRUE(connection1
->AddView(*embed_view_id
, child1
));
320 EXPECT_TRUE(connection1
->AddView(child1
, child2
));
321 EXPECT_TRUE(connection1
->AddView(child2
, child3
));
323 TestViewManagerClient
* connection1_client
= test
->last_view_manager_client();
324 connection1_client
->tracker()->changes()->clear();
325 test
->wm_client()->tracker()->changes()->clear();
326 EXPECT_TRUE(test
->connection_manager()->CloneAndAnimate(child2
));
327 EXPECT_TRUE(connection1_client
->tracker()->changes()->empty());
328 EXPECT_TRUE(test
->wm_client()->tracker()->changes()->empty());
330 // We cloned v2. The cloned view ends up as a sibling of it.
331 const ServerView
* cloned_view
= GetFirstCloned(connection1
->GetView(child1
));
332 ASSERT_TRUE(cloned_view
);
333 // |cloned_view| should have one and only one cloned child (corresponds to
335 ASSERT_EQ(1u, cloned_view
->GetChildren().size());
336 EXPECT_TRUE(cloned_view
->GetChildren()[0]->id() == ClonedViewId());
338 // Cloned views should match the bounds of the view they were cloned from.
339 EXPECT_EQ(v2
->bounds(), cloned_view
->bounds());
340 EXPECT_EQ(v3
->bounds(), cloned_view
->GetChildren()[0]->bounds());
342 // Cloned views are owned by the ConnectionManager and shouldn't be returned
343 // from ViewManagerServiceImpl::GetView.
344 EXPECT_TRUE(connection1
->GetView(ClonedViewId()) == nullptr);
345 EXPECT_TRUE(test
->wm_connection()->GetView(ClonedViewId()) == nullptr);
350 // Verifies ViewManagerService::GetViewTree() doesn't return cloned views.
351 TEST_F(ViewManagerServiceTest
, ConnectionsCantSeeClonedViews
) {
352 ViewId embed_view_id
;
353 EXPECT_NO_FATAL_FAILURE(SetUpAnimate1(this, &embed_view_id
));
355 ViewManagerServiceImpl
* connection1
=
356 connection_manager()->GetConnectionWithRoot(embed_view_id
);
358 const ViewId
child1(connection1
->id(), 1);
359 const ViewId
child2(connection1
->id(), 2);
360 const ViewId
child3(connection1
->id(), 3);
362 // Verify the root doesn't see any cloned views.
363 std::vector
<const ServerView
*> views(
364 wm_connection()->GetViewTree(*wm_connection()->root()));
365 ASSERT_EQ(5u, views
.size());
366 ASSERT_TRUE(views
[0]->id() == *wm_connection()->root());
367 ASSERT_TRUE(views
[1]->id() == embed_view_id
);
368 ASSERT_TRUE(views
[2]->id() == child1
);
369 ASSERT_TRUE(views
[3]->id() == child2
);
370 ASSERT_TRUE(views
[4]->id() == child3
);
372 // Verify connection1 doesn't see any cloned views.
373 std::vector
<const ServerView
*> v1_views(
374 connection1
->GetViewTree(embed_view_id
));
375 ASSERT_EQ(4u, v1_views
.size());
376 ASSERT_TRUE(v1_views
[0]->id() == embed_view_id
);
377 ASSERT_TRUE(v1_views
[1]->id() == child1
);
378 ASSERT_TRUE(v1_views
[2]->id() == child2
);
379 ASSERT_TRUE(v1_views
[3]->id() == child3
);
382 TEST_F(ViewManagerServiceTest
, ClonedViewsPromotedOnConnectionClose
) {
383 ViewId embed_view_id
;
384 EXPECT_NO_FATAL_FAILURE(SetUpAnimate1(this, &embed_view_id
));
386 // Destroy connection1, which should force the cloned view to become a child
387 // of where it was embedded (the embedded view still exists).
388 connection_manager()->OnConnectionError(last_client_connection());
390 ServerView
* embed_view
= wm_connection()->GetView(embed_view_id
);
391 ASSERT_TRUE(embed_view
!= nullptr);
392 const ServerView
* cloned_view
= GetFirstCloned(embed_view
);
393 ASSERT_TRUE(cloned_view
);
394 ASSERT_EQ(1u, cloned_view
->GetChildren().size());
395 EXPECT_TRUE(cloned_view
->GetChildren()[0]->id() == ClonedViewId());
397 // Because the cloned view changed parents its bounds should have changed.
398 EXPECT_EQ(gfx::Rect(3, 5, 6, 7), cloned_view
->bounds());
399 // The bounds of the cloned child should not have changed though.
400 EXPECT_EQ(gfx::Rect(3, 4, 6, 7), cloned_view
->GetChildren()[0]->bounds());
403 TEST_F(ViewManagerServiceTest
, ClonedViewsPromotedOnHide
) {
404 ViewId embed_view_id
;
405 EXPECT_NO_FATAL_FAILURE(SetUpAnimate1(this, &embed_view_id
));
407 ViewManagerServiceImpl
* connection1
=
408 connection_manager()->GetConnectionWithRoot(embed_view_id
);
410 // Hide the parent of the cloned view, which should force the cloned view to
411 // become a sibling of the parent.
412 const ServerView
* view_to_hide
=
413 connection1
->GetView(ViewId(connection1
->id(), 1));
414 ASSERT_TRUE(connection1
->SetViewVisibility(view_to_hide
->id(), false));
416 const ServerView
* cloned_view
= GetFirstCloned(view_to_hide
->parent());
417 ASSERT_TRUE(cloned_view
);
418 ASSERT_EQ(1u, cloned_view
->GetChildren().size());
419 EXPECT_TRUE(cloned_view
->GetChildren()[0]->id() == ClonedViewId());
420 EXPECT_EQ(2u, cloned_view
->parent()->GetChildren().size());
421 EXPECT_TRUE(cloned_view
->parent()->GetChildren()[1] == cloned_view
);
424 // Clone and animate on a tree with more depth. Basically that of
425 // SetUpAnimate1() but cloning 2,1.
426 TEST_F(ViewManagerServiceTest
, CloneAndAnimateLargerDepth
) {
427 const ViewId
embed_view_id(wm_connection()->id(), 1);
428 EXPECT_EQ(ERROR_CODE_NONE
, wm_connection()->CreateView(embed_view_id
));
429 EXPECT_TRUE(wm_connection()->SetViewVisibility(embed_view_id
, true));
431 wm_connection()->AddView(*(wm_connection()->root()), embed_view_id
));
432 wm_connection()->EmbedUrl(std::string(), embed_view_id
, nullptr, nullptr);
433 ViewManagerServiceImpl
* connection1
=
434 connection_manager()->GetConnectionWithRoot(embed_view_id
);
435 ASSERT_TRUE(connection1
!= nullptr);
436 ASSERT_NE(connection1
, wm_connection());
438 const ViewId
child1(connection1
->id(), 1);
439 EXPECT_EQ(ERROR_CODE_NONE
, connection1
->CreateView(child1
));
440 const ViewId
child2(connection1
->id(), 2);
441 EXPECT_EQ(ERROR_CODE_NONE
, connection1
->CreateView(child2
));
442 const ViewId
child3(connection1
->id(), 3);
443 EXPECT_EQ(ERROR_CODE_NONE
, connection1
->CreateView(child3
));
445 ServerView
* v1
= connection1
->GetView(child1
);
446 v1
->SetVisible(true);
447 connection1
->GetView(child2
)->SetVisible(true);
448 connection1
->GetView(child3
)->SetVisible(true);
450 EXPECT_TRUE(connection1
->AddView(embed_view_id
, child1
));
451 EXPECT_TRUE(connection1
->AddView(child1
, child2
));
452 EXPECT_TRUE(connection1
->AddView(child2
, child3
));
454 TestViewManagerClient
* connection1_client
= last_view_manager_client();
455 connection1_client
->tracker()->changes()->clear();
456 wm_client()->tracker()->changes()->clear();
457 EXPECT_TRUE(connection_manager()->CloneAndAnimate(child1
));
458 EXPECT_TRUE(connection1_client
->tracker()->changes()->empty());
459 EXPECT_TRUE(wm_client()->tracker()->changes()->empty());
461 // We cloned v1. The cloned view ends up as a sibling of it.
462 const ServerView
* cloned_view
= GetFirstCloned(v1
->parent());
463 ASSERT_TRUE(cloned_view
);
464 // |cloned_view| should have a child and its child should have a child.
465 ASSERT_EQ(1u, cloned_view
->GetChildren().size());
466 const ServerView
* cloned_view_child
= cloned_view
->GetChildren()[0];
467 EXPECT_EQ(1u, cloned_view_child
->GetChildren().size());
468 EXPECT_TRUE(cloned_view_child
->id() == ClonedViewId());
471 // Verifies focus correctly changes on pointer events.
472 TEST_F(ViewManagerServiceTest
, FocusOnPointer
) {
473 const ViewId
embed_view_id(wm_connection()->id(), 1);
474 EXPECT_EQ(ERROR_CODE_NONE
, wm_connection()->CreateView(embed_view_id
));
475 EXPECT_TRUE(wm_connection()->SetViewVisibility(embed_view_id
, true));
477 wm_connection()->AddView(*(wm_connection()->root()), embed_view_id
));
478 connection_manager()->root()->SetBounds(gfx::Rect(0, 0, 100, 100));
479 wm_connection()->EmbedUrl(std::string(), embed_view_id
, nullptr, nullptr);
480 ViewManagerServiceImpl
* connection1
=
481 connection_manager()->GetConnectionWithRoot(embed_view_id
);
482 ASSERT_TRUE(connection1
!= nullptr);
483 ASSERT_NE(connection1
, wm_connection());
486 ->GetView(embed_view_id
)
487 ->SetBounds(gfx::Rect(0, 0, 50, 50));
489 const ViewId
child1(connection1
->id(), 1);
490 EXPECT_EQ(ERROR_CODE_NONE
, connection1
->CreateView(child1
));
491 EXPECT_TRUE(connection1
->AddView(embed_view_id
, child1
));
492 ServerView
* v1
= connection1
->GetView(child1
);
493 v1
->SetVisible(true);
494 v1
->SetBounds(gfx::Rect(20, 20, 20, 20));
496 TestViewManagerClient
* connection1_client
= last_view_manager_client();
497 connection1_client
->tracker()->changes()->clear();
498 wm_client()->tracker()->changes()->clear();
500 connection_manager()->ProcessEvent(CreatePointerDownEvent(21, 22));
501 // Focus should go to child1. This results in notifying both the window
502 // manager and client connection being notified.
503 EXPECT_EQ(v1
, connection_manager()->GetFocusedView());
504 ASSERT_GE(wm_client()->tracker()->changes()->size(), 1u);
505 EXPECT_EQ("Focused id=2,1",
506 ChangesToDescription1(*wm_client()->tracker()->changes())[0]);
507 ASSERT_GE(connection1_client
->tracker()->changes()->size(), 1u);
510 ChangesToDescription1(*connection1_client
->tracker()->changes())[0]);
512 connection_manager()->ProcessEvent(CreatePointerUpEvent(21, 22));
513 wm_client()->tracker()->changes()->clear();
514 connection1_client
->tracker()->changes()->clear();
516 // Press outside of the embedded view. Focus should go to the root. Notice
517 // the client1 doesn't see who has focus as the focused view (root) isn't
519 connection_manager()->ProcessEvent(CreatePointerDownEvent(61, 22));
520 EXPECT_EQ(connection_manager()->root(),
521 connection_manager()->GetFocusedView());
522 ASSERT_GE(wm_client()->tracker()->changes()->size(), 1u);
523 EXPECT_EQ("Focused id=0,1",
524 ChangesToDescription1(*wm_client()->tracker()->changes())[0]);
525 ASSERT_GE(connection1_client
->tracker()->changes()->size(), 1u);
528 ChangesToDescription1(*connection1_client
->tracker()->changes())[0]);
530 connection_manager()->ProcessEvent(CreatePointerUpEvent(21, 22));
531 wm_client()->tracker()->changes()->clear();
532 connection1_client
->tracker()->changes()->clear();
534 // Press in the same location. Should not get a focus change event (only input
536 connection_manager()->ProcessEvent(CreatePointerDownEvent(61, 22));
537 EXPECT_EQ(connection_manager()->root(),
538 connection_manager()->GetFocusedView());
539 ASSERT_EQ(wm_client()->tracker()->changes()->size(), 1u);
540 EXPECT_EQ("InputEvent view=0,1 event_action=4",
541 ChangesToDescription1(*wm_client()->tracker()->changes())[0]);
542 EXPECT_TRUE(connection1_client
->tracker()->changes()->empty());
546 } // namespace view_manager