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
,
51 mojo::ViewManagerServicePtr view_manager_service
,
52 mojo::Id focused_view_id
) override
{
53 // TODO(sky): add test coverage of |focused_view_id|.
54 tracker_
.OnEmbed(connection_id
, root
.Pass());
56 void OnEmbedForDescendant(
58 mojo::URLRequestPtr request
,
59 const OnEmbedForDescendantCallback
& callback
) override
{}
60 void OnEmbeddedAppDisconnected(uint32_t view
) override
{
61 tracker_
.OnEmbeddedAppDisconnected(view
);
63 void OnViewBoundsChanged(uint32_t view
,
64 mojo::RectPtr old_bounds
,
65 mojo::RectPtr new_bounds
) override
{
66 tracker_
.OnViewBoundsChanged(view
, old_bounds
.Pass(), new_bounds
.Pass());
68 void OnViewViewportMetricsChanged(
69 mojo::ViewportMetricsPtr old_metrics
,
70 mojo::ViewportMetricsPtr new_metrics
) override
{
71 tracker_
.OnViewViewportMetricsChanged(old_metrics
.Pass(),
74 void OnViewHierarchyChanged(uint32_t view
,
77 Array
<ViewDataPtr
> views
) override
{
78 tracker_
.OnViewHierarchyChanged(view
, new_parent
, old_parent
, views
.Pass());
80 void OnViewReordered(uint32_t view_id
,
81 uint32_t relative_view_id
,
82 mojo::OrderDirection direction
) override
{
83 tracker_
.OnViewReordered(view_id
, relative_view_id
, direction
);
85 void OnViewDeleted(uint32_t view
) override
{ tracker_
.OnViewDeleted(view
); }
86 void OnViewVisibilityChanged(uint32_t view
, bool visible
) override
{
87 tracker_
.OnViewVisibilityChanged(view
, visible
);
89 void OnViewDrawnStateChanged(uint32_t view
, bool drawn
) override
{
90 tracker_
.OnViewDrawnStateChanged(view
, drawn
);
92 void OnViewSharedPropertyChanged(uint32_t view
,
94 Array
<uint8_t> new_data
) override
{
95 tracker_
.OnViewSharedPropertyChanged(view
, name
, new_data
.Pass());
97 void OnViewInputEvent(uint32_t view
,
99 const mojo::Callback
<void()>& callback
) override
{
100 tracker_
.OnViewInputEvent(view
, event
.Pass());
102 void OnViewFocused(uint32_t focused_view_id
) override
{
103 tracker_
.OnViewFocused(focused_view_id
);
106 TestChangeTracker tracker_
;
108 DISALLOW_COPY_AND_ASSIGN(TestViewManagerClient
);
111 // -----------------------------------------------------------------------------
113 // ClientConnection implementation that vends TestViewManagerClient.
114 class TestClientConnection
: public ClientConnection
{
116 explicit TestClientConnection(scoped_ptr
<ViewManagerServiceImpl
> service_impl
)
117 : ClientConnection(service_impl
.Pass(), &client_
) {}
118 ~TestClientConnection() override
{}
120 TestViewManagerClient
* client() { return &client_
; }
123 TestViewManagerClient client_
;
125 DISALLOW_COPY_AND_ASSIGN(TestClientConnection
);
128 // -----------------------------------------------------------------------------
130 // Empty implementation of ConnectionManagerDelegate.
131 class TestConnectionManagerDelegate
: public ConnectionManagerDelegate
{
133 TestConnectionManagerDelegate() : last_connection_(nullptr) {}
134 ~TestConnectionManagerDelegate() override
{}
136 TestViewManagerClient
* last_client() {
137 return last_connection_
? last_connection_
->client() : nullptr;
140 TestClientConnection
* last_connection() { return last_connection_
; }
143 // ConnectionManagerDelegate:
144 void OnLostConnectionToWindowManager() override
{}
146 ClientConnection
* CreateClientConnectionForEmbedAtView(
147 ConnectionManager
* connection_manager
,
148 mojo::InterfaceRequest
<mojo::ViewManagerService
> service_request
,
149 mojo::ConnectionSpecificId creator_id
,
150 mojo::URLRequestPtr request
,
151 const ViewId
& root_id
) override
{
152 scoped_ptr
<ViewManagerServiceImpl
> service(
153 new ViewManagerServiceImpl(connection_manager
, creator_id
, 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 ViewId
& root_id
,
162 mojo::ViewManagerClientPtr client
) override
{
167 TestClientConnection
* last_connection_
;
169 DISALLOW_COPY_AND_ASSIGN(TestConnectionManagerDelegate
);
172 // -----------------------------------------------------------------------------
174 // Empty implementation of DisplayManager.
175 class TestDisplayManager
: public DisplayManager
{
177 TestDisplayManager() {}
178 ~TestDisplayManager() override
{}
181 void Init(ConnectionManager
* connection_manager
,
182 EventDispatcher
* event_dispatcher
) override
{}
183 void SchedulePaint(const ServerView
* view
, const gfx::Rect
& bounds
) override
{
185 void SetViewportSize(const gfx::Size
& size
) override
{}
186 const mojo::ViewportMetrics
& GetViewportMetrics() override
{
187 return display_metrices_
;
191 mojo::ViewportMetrics display_metrices_
;
193 DISALLOW_COPY_AND_ASSIGN(TestDisplayManager
);
196 mojo::EventPtr
CreatePointerDownEvent(int x
, int y
) {
197 mojo::EventPtr
event(mojo::Event::New());
198 event
->action
= mojo::EVENT_TYPE_POINTER_DOWN
;
199 event
->pointer_data
= mojo::PointerData::New();
200 event
->pointer_data
->pointer_id
= 1u;
201 event
->pointer_data
->x
= x
;
202 event
->pointer_data
->y
= y
;
206 mojo::EventPtr
CreatePointerUpEvent(int x
, int y
) {
207 mojo::EventPtr
event(mojo::Event::New());
208 event
->action
= mojo::EVENT_TYPE_POINTER_UP
;
209 event
->pointer_data
= mojo::PointerData::New();
210 event
->pointer_data
->pointer_id
= 1u;
211 event
->pointer_data
->x
= x
;
212 event
->pointer_data
->y
= y
;
218 // -----------------------------------------------------------------------------
220 class ViewManagerServiceTest
: public testing::Test
{
222 ViewManagerServiceTest() : wm_client_(nullptr) {}
223 ~ViewManagerServiceTest() override
{}
225 // ViewManagerServiceImpl for the window manager.
226 ViewManagerServiceImpl
* wm_connection() {
227 return connection_manager_
->GetConnection(1);
230 TestViewManagerClient
* last_view_manager_client() {
231 return delegate_
.last_client();
234 TestClientConnection
* last_client_connection() {
235 return delegate_
.last_connection();
238 ConnectionManager
* connection_manager() { return connection_manager_
.get(); }
240 TestViewManagerClient
* wm_client() { return wm_client_
; }
244 void SetUp() override
{
245 connection_manager_
.reset(new ConnectionManager(
246 &delegate_
, scoped_ptr
<DisplayManager
>(new TestDisplayManager
)));
247 scoped_ptr
<ViewManagerServiceImpl
> service(new ViewManagerServiceImpl(
248 connection_manager_
.get(), kInvalidConnectionId
, RootViewId(0)));
249 scoped_ptr
<TestClientConnection
> client_connection(
250 new TestClientConnection(service
.Pass()));
251 wm_client_
= client_connection
->client();
252 ASSERT_TRUE(wm_client_
!= nullptr);
253 connection_manager_
->SetWindowManagerClientConnection(
254 client_connection
.Pass());
255 ASSERT_TRUE(wm_connection() != nullptr);
256 ASSERT_TRUE(wm_connection()->root() != nullptr);
260 // TestViewManagerClient that is used for the WM connection.
261 TestViewManagerClient
* wm_client_
;
263 TestConnectionManagerDelegate delegate_
;
264 scoped_ptr
<ConnectionManager
> connection_manager_
;
265 base::MessageLoop message_loop_
;
267 DISALLOW_COPY_AND_ASSIGN(ViewManagerServiceTest
);
272 const ServerView
* GetFirstCloned(const ServerView
* view
) {
273 for (const ServerView
* child
: view
->GetChildren()) {
274 if (child
->id() == ClonedViewId())
280 // Provides common setup for animation tests. Creates the following views:
281 // 0,1 (the root, provided by view manager)
282 // 1,1 the second connection is embedded here (view owned by wm_connection()).
283 // 2,1 bounds=1,2 11x22
284 // 2,2 bounds=2,3 6x7
285 // 2,3 bounds=3,4 6x7
286 // CloneAndAnimate() is invoked for 2,2.
287 void SetUpAnimate1(ViewManagerServiceTest
* test
, ViewId
* embed_view_id
) {
288 *embed_view_id
= ViewId(test
->wm_connection()->id(), 1);
289 EXPECT_EQ(ERROR_CODE_NONE
, test
->wm_connection()->CreateView(*embed_view_id
));
290 EXPECT_TRUE(test
->wm_connection()->SetViewVisibility(*embed_view_id
, true));
291 EXPECT_TRUE(test
->wm_connection()->AddView(*(test
->wm_connection()->root()),
293 mojo::URLRequestPtr
request(mojo::URLRequest::New());
294 test
->wm_connection()->EmbedAllowingReembed(*embed_view_id
, request
.Pass(),
295 mojo::Callback
<void(bool)>());
296 ViewManagerServiceImpl
* connection1
=
297 test
->connection_manager()->GetConnectionWithRoot(*embed_view_id
);
298 ASSERT_TRUE(connection1
!= nullptr);
299 ASSERT_NE(connection1
, test
->wm_connection());
301 const ViewId
child1(connection1
->id(), 1);
302 EXPECT_EQ(ERROR_CODE_NONE
, connection1
->CreateView(child1
));
303 const ViewId
child2(connection1
->id(), 2);
304 EXPECT_EQ(ERROR_CODE_NONE
, connection1
->CreateView(child2
));
305 const ViewId
child3(connection1
->id(), 3);
306 EXPECT_EQ(ERROR_CODE_NONE
, connection1
->CreateView(child3
));
308 ServerView
* v1
= connection1
->GetView(child1
);
309 v1
->SetVisible(true);
310 v1
->SetBounds(gfx::Rect(1, 2, 11, 22));
311 ServerView
* v2
= connection1
->GetView(child2
);
312 v2
->SetVisible(true);
313 v2
->SetBounds(gfx::Rect(2, 3, 6, 7));
314 ServerView
* v3
= connection1
->GetView(child3
);
315 v3
->SetVisible(true);
316 v3
->SetBounds(gfx::Rect(3, 4, 6, 7));
318 EXPECT_TRUE(connection1
->AddView(*embed_view_id
, child1
));
319 EXPECT_TRUE(connection1
->AddView(child1
, child2
));
320 EXPECT_TRUE(connection1
->AddView(child2
, child3
));
322 TestViewManagerClient
* connection1_client
= test
->last_view_manager_client();
323 connection1_client
->tracker()->changes()->clear();
324 test
->wm_client()->tracker()->changes()->clear();
325 EXPECT_TRUE(test
->connection_manager()->CloneAndAnimate(child2
));
326 EXPECT_TRUE(connection1_client
->tracker()->changes()->empty());
327 EXPECT_TRUE(test
->wm_client()->tracker()->changes()->empty());
329 // We cloned v2. The cloned view ends up as a sibling of it.
330 const ServerView
* cloned_view
= GetFirstCloned(connection1
->GetView(child1
));
331 ASSERT_TRUE(cloned_view
);
332 // |cloned_view| should have one and only one cloned child (corresponds to
334 ASSERT_EQ(1u, cloned_view
->GetChildren().size());
335 EXPECT_TRUE(cloned_view
->GetChildren()[0]->id() == ClonedViewId());
337 // Cloned views should match the bounds of the view they were cloned from.
338 EXPECT_EQ(v2
->bounds(), cloned_view
->bounds());
339 EXPECT_EQ(v3
->bounds(), cloned_view
->GetChildren()[0]->bounds());
341 // Cloned views are owned by the ConnectionManager and shouldn't be returned
342 // from ViewManagerServiceImpl::GetView.
343 EXPECT_TRUE(connection1
->GetView(ClonedViewId()) == nullptr);
344 EXPECT_TRUE(test
->wm_connection()->GetView(ClonedViewId()) == nullptr);
349 // Verifies ViewManagerService::GetViewTree() doesn't return cloned views.
350 TEST_F(ViewManagerServiceTest
, ConnectionsCantSeeClonedViews
) {
351 ViewId embed_view_id
;
352 EXPECT_NO_FATAL_FAILURE(SetUpAnimate1(this, &embed_view_id
));
354 ViewManagerServiceImpl
* connection1
=
355 connection_manager()->GetConnectionWithRoot(embed_view_id
);
357 const ViewId
child1(connection1
->id(), 1);
358 const ViewId
child2(connection1
->id(), 2);
359 const ViewId
child3(connection1
->id(), 3);
361 // Verify the root doesn't see any cloned views.
362 std::vector
<const ServerView
*> views(
363 wm_connection()->GetViewTree(*wm_connection()->root()));
364 ASSERT_EQ(5u, views
.size());
365 ASSERT_TRUE(views
[0]->id() == *wm_connection()->root());
366 ASSERT_TRUE(views
[1]->id() == embed_view_id
);
367 ASSERT_TRUE(views
[2]->id() == child1
);
368 ASSERT_TRUE(views
[3]->id() == child2
);
369 ASSERT_TRUE(views
[4]->id() == child3
);
371 // Verify connection1 doesn't see any cloned views.
372 std::vector
<const ServerView
*> v1_views(
373 connection1
->GetViewTree(embed_view_id
));
374 ASSERT_EQ(4u, v1_views
.size());
375 ASSERT_TRUE(v1_views
[0]->id() == embed_view_id
);
376 ASSERT_TRUE(v1_views
[1]->id() == child1
);
377 ASSERT_TRUE(v1_views
[2]->id() == child2
);
378 ASSERT_TRUE(v1_views
[3]->id() == child3
);
381 TEST_F(ViewManagerServiceTest
, ClonedViewsPromotedOnConnectionClose
) {
382 ViewId embed_view_id
;
383 EXPECT_NO_FATAL_FAILURE(SetUpAnimate1(this, &embed_view_id
));
385 // Destroy connection1, which should force the cloned view to become a child
386 // of where it was embedded (the embedded view still exists).
387 connection_manager()->OnConnectionError(last_client_connection());
389 ServerView
* embed_view
= wm_connection()->GetView(embed_view_id
);
390 ASSERT_TRUE(embed_view
!= nullptr);
391 const ServerView
* cloned_view
= GetFirstCloned(embed_view
);
392 ASSERT_TRUE(cloned_view
);
393 ASSERT_EQ(1u, cloned_view
->GetChildren().size());
394 EXPECT_TRUE(cloned_view
->GetChildren()[0]->id() == ClonedViewId());
396 // Because the cloned view changed parents its bounds should have changed.
397 EXPECT_EQ(gfx::Rect(3, 5, 6, 7), cloned_view
->bounds());
398 // The bounds of the cloned child should not have changed though.
399 EXPECT_EQ(gfx::Rect(3, 4, 6, 7), cloned_view
->GetChildren()[0]->bounds());
402 TEST_F(ViewManagerServiceTest
, ClonedViewsPromotedOnHide
) {
403 ViewId embed_view_id
;
404 EXPECT_NO_FATAL_FAILURE(SetUpAnimate1(this, &embed_view_id
));
406 ViewManagerServiceImpl
* connection1
=
407 connection_manager()->GetConnectionWithRoot(embed_view_id
);
409 // Hide the parent of the cloned view, which should force the cloned view to
410 // become a sibling of the parent.
411 const ServerView
* view_to_hide
=
412 connection1
->GetView(ViewId(connection1
->id(), 1));
413 ASSERT_TRUE(connection1
->SetViewVisibility(view_to_hide
->id(), false));
415 const ServerView
* cloned_view
= GetFirstCloned(view_to_hide
->parent());
416 ASSERT_TRUE(cloned_view
);
417 ASSERT_EQ(1u, cloned_view
->GetChildren().size());
418 EXPECT_TRUE(cloned_view
->GetChildren()[0]->id() == ClonedViewId());
419 EXPECT_EQ(2u, cloned_view
->parent()->GetChildren().size());
420 EXPECT_TRUE(cloned_view
->parent()->GetChildren()[1] == cloned_view
);
423 // Clone and animate on a tree with more depth. Basically that of
424 // SetUpAnimate1() but cloning 2,1.
425 TEST_F(ViewManagerServiceTest
, CloneAndAnimateLargerDepth
) {
426 const ViewId
embed_view_id(wm_connection()->id(), 1);
427 EXPECT_EQ(ERROR_CODE_NONE
, wm_connection()->CreateView(embed_view_id
));
428 EXPECT_TRUE(wm_connection()->SetViewVisibility(embed_view_id
, true));
430 wm_connection()->AddView(*(wm_connection()->root()), embed_view_id
));
431 mojo::URLRequestPtr
request(mojo::URLRequest::New());
432 wm_connection()->EmbedAllowingReembed(embed_view_id
, request
.Pass(),
433 mojo::Callback
<void(bool)>());
434 ViewManagerServiceImpl
* connection1
=
435 connection_manager()->GetConnectionWithRoot(embed_view_id
);
436 ASSERT_TRUE(connection1
!= nullptr);
437 ASSERT_NE(connection1
, wm_connection());
439 const ViewId
child1(connection1
->id(), 1);
440 EXPECT_EQ(ERROR_CODE_NONE
, connection1
->CreateView(child1
));
441 const ViewId
child2(connection1
->id(), 2);
442 EXPECT_EQ(ERROR_CODE_NONE
, connection1
->CreateView(child2
));
443 const ViewId
child3(connection1
->id(), 3);
444 EXPECT_EQ(ERROR_CODE_NONE
, connection1
->CreateView(child3
));
446 ServerView
* v1
= connection1
->GetView(child1
);
447 v1
->SetVisible(true);
448 connection1
->GetView(child2
)->SetVisible(true);
449 connection1
->GetView(child3
)->SetVisible(true);
451 EXPECT_TRUE(connection1
->AddView(embed_view_id
, child1
));
452 EXPECT_TRUE(connection1
->AddView(child1
, child2
));
453 EXPECT_TRUE(connection1
->AddView(child2
, child3
));
455 TestViewManagerClient
* connection1_client
= last_view_manager_client();
456 connection1_client
->tracker()->changes()->clear();
457 wm_client()->tracker()->changes()->clear();
458 EXPECT_TRUE(connection_manager()->CloneAndAnimate(child1
));
459 EXPECT_TRUE(connection1_client
->tracker()->changes()->empty());
460 EXPECT_TRUE(wm_client()->tracker()->changes()->empty());
462 // We cloned v1. The cloned view ends up as a sibling of it.
463 const ServerView
* cloned_view
= GetFirstCloned(v1
->parent());
464 ASSERT_TRUE(cloned_view
);
465 // |cloned_view| should have a child and its child should have a child.
466 ASSERT_EQ(1u, cloned_view
->GetChildren().size());
467 const ServerView
* cloned_view_child
= cloned_view
->GetChildren()[0];
468 EXPECT_EQ(1u, cloned_view_child
->GetChildren().size());
469 EXPECT_TRUE(cloned_view_child
->id() == ClonedViewId());
472 // Verifies focus correctly changes on pointer events.
473 TEST_F(ViewManagerServiceTest
, FocusOnPointer
) {
474 const ViewId
embed_view_id(wm_connection()->id(), 1);
475 EXPECT_EQ(ERROR_CODE_NONE
, wm_connection()->CreateView(embed_view_id
));
476 EXPECT_TRUE(wm_connection()->SetViewVisibility(embed_view_id
, true));
478 wm_connection()->AddView(*(wm_connection()->root()), embed_view_id
));
479 connection_manager()->root()->SetBounds(gfx::Rect(0, 0, 100, 100));
480 mojo::URLRequestPtr
request(mojo::URLRequest::New());
481 wm_connection()->EmbedAllowingReembed(embed_view_id
, request
.Pass(),
482 mojo::Callback
<void(bool)>());
483 ViewManagerServiceImpl
* connection1
=
484 connection_manager()->GetConnectionWithRoot(embed_view_id
);
485 ASSERT_TRUE(connection1
!= nullptr);
486 ASSERT_NE(connection1
, wm_connection());
489 ->GetView(embed_view_id
)
490 ->SetBounds(gfx::Rect(0, 0, 50, 50));
492 const ViewId
child1(connection1
->id(), 1);
493 EXPECT_EQ(ERROR_CODE_NONE
, connection1
->CreateView(child1
));
494 EXPECT_TRUE(connection1
->AddView(embed_view_id
, child1
));
495 ServerView
* v1
= connection1
->GetView(child1
);
496 v1
->SetVisible(true);
497 v1
->SetBounds(gfx::Rect(20, 20, 20, 20));
499 TestViewManagerClient
* connection1_client
= last_view_manager_client();
500 connection1_client
->tracker()->changes()->clear();
501 wm_client()->tracker()->changes()->clear();
503 connection_manager()->ProcessEvent(CreatePointerDownEvent(21, 22));
504 // Focus should go to child1. This results in notifying both the window
505 // manager and client connection being notified.
506 EXPECT_EQ(v1
, connection_manager()->GetFocusedView());
507 ASSERT_GE(wm_client()->tracker()->changes()->size(), 1u);
508 EXPECT_EQ("Focused id=2,1",
509 ChangesToDescription1(*wm_client()->tracker()->changes())[0]);
510 ASSERT_GE(connection1_client
->tracker()->changes()->size(), 1u);
513 ChangesToDescription1(*connection1_client
->tracker()->changes())[0]);
515 connection_manager()->ProcessEvent(CreatePointerUpEvent(21, 22));
516 wm_client()->tracker()->changes()->clear();
517 connection1_client
->tracker()->changes()->clear();
519 // Press outside of the embedded view. Focus should go to the root. Notice
520 // the client1 doesn't see who has focus as the focused view (root) isn't
522 connection_manager()->ProcessEvent(CreatePointerDownEvent(61, 22));
523 EXPECT_EQ(connection_manager()->root(),
524 connection_manager()->GetFocusedView());
525 ASSERT_GE(wm_client()->tracker()->changes()->size(), 1u);
526 EXPECT_EQ("Focused id=0,2",
527 ChangesToDescription1(*wm_client()->tracker()->changes())[0]);
528 ASSERT_GE(connection1_client
->tracker()->changes()->size(), 1u);
531 ChangesToDescription1(*connection1_client
->tracker()->changes())[0]);
533 connection_manager()->ProcessEvent(CreatePointerUpEvent(21, 22));
534 wm_client()->tracker()->changes()->clear();
535 connection1_client
->tracker()->changes()->clear();
537 // Press in the same location. Should not get a focus change event (only input
539 connection_manager()->ProcessEvent(CreatePointerDownEvent(61, 22));
540 EXPECT_EQ(connection_manager()->root(),
541 connection_manager()->GetFocusedView());
542 ASSERT_EQ(wm_client()->tracker()->changes()->size(), 1u);
543 EXPECT_EQ("InputEvent view=0,2 event_action=4",
544 ChangesToDescription1(*wm_client()->tracker()->changes())[0]);
545 EXPECT_TRUE(connection1_client
->tracker()->changes()->empty());
549 } // namespace view_manager