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

Side by Side Diff: components/mus/view_tree_unittest.cc

Issue 1328953003: Mandoline: Support transforms and clipping of OOPIFs and events (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase works! Created 5 years, 3 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
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 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 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 <string> 5 #include <string>
6 #include <vector> 6 #include <vector>
7 7
8 #include "base/message_loop/message_loop.h" 8 #include "base/message_loop/message_loop.h"
9 #include "components/mus/client_connection.h" 9 #include "components/mus/client_connection.h"
10 #include "components/mus/connection_manager.h" 10 #include "components/mus/connection_manager.h"
(...skipping 339 matching lines...) Expand 10 before | Expand all | Expand 10 after
350 EXPECT_EQ(ERROR_CODE_NONE, connection1->CreateView(child1)); 350 EXPECT_EQ(ERROR_CODE_NONE, connection1->CreateView(child1));
351 EXPECT_TRUE(connection1->AddView(embed_view_id, child1)); 351 EXPECT_TRUE(connection1->AddView(embed_view_id, child1));
352 ServerView* v1 = connection1->GetView(child1); 352 ServerView* v1 = connection1->GetView(child1);
353 v1->SetVisible(true); 353 v1->SetVisible(true);
354 v1->SetBounds(gfx::Rect(20, 20, 20, 20)); 354 v1->SetBounds(gfx::Rect(20, 20, 20, 20));
355 355
356 TestViewTreeClient* connection1_client = last_view_tree_client(); 356 TestViewTreeClient* connection1_client = last_view_tree_client();
357 connection1_client->tracker()->changes()->clear(); 357 connection1_client->tracker()->changes()->clear();
358 wm_client()->tracker()->changes()->clear(); 358 wm_client()->tracker()->changes()->clear();
359 359
360 display_manager_delegate()->OnEvent(CreatePointerDownEvent(21, 22)); 360 display_manager_delegate()->OnEvent(ViewId(), CreatePointerDownEvent(21, 22));
361 // Focus should go to child1. This result in notifying both the window 361 // Focus should go to child1. This result in notifying both the window
362 // manager and client connection being notified. 362 // manager and client connection being notified.
363 EXPECT_EQ(v1, connection1->GetHost()->GetFocusedView()); 363 EXPECT_EQ(v1, connection1->GetHost()->GetFocusedView());
364 ASSERT_GE(wm_client()->tracker()->changes()->size(), 1u); 364 ASSERT_GE(wm_client()->tracker()->changes()->size(), 1u);
365 EXPECT_EQ("Focused id=2,1", 365 EXPECT_EQ("Focused id=2,1",
366 ChangesToDescription1(*wm_client()->tracker()->changes())[0]); 366 ChangesToDescription1(*wm_client()->tracker()->changes())[0]);
367 ASSERT_GE(connection1_client->tracker()->changes()->size(), 1u); 367 ASSERT_GE(connection1_client->tracker()->changes()->size(), 1u);
368 EXPECT_EQ( 368 EXPECT_EQ(
369 "Focused id=2,1", 369 "Focused id=2,1",
370 ChangesToDescription1(*connection1_client->tracker()->changes())[0]); 370 ChangesToDescription1(*connection1_client->tracker()->changes())[0]);
371 371
372 display_manager_delegate()->OnEvent(CreatePointerUpEvent(21, 22)); 372 display_manager_delegate()->OnEvent(ViewId(), CreatePointerUpEvent(21, 22));
373 wm_client()->tracker()->changes()->clear(); 373 wm_client()->tracker()->changes()->clear();
374 connection1_client->tracker()->changes()->clear(); 374 connection1_client->tracker()->changes()->clear();
375 375
376 // Press outside of the embedded view. Focus should go to the root. Notice 376 // Press outside of the embedded view. Focus should go to the root. Notice
377 // the client1 doesn't see who has focus as the focused view (root) isn't 377 // the client1 doesn't see who has focus as the focused view (root) isn't
378 // visible to it. 378 // visible to it.
379 display_manager_delegate()->OnEvent(CreatePointerDownEvent(61, 22)); 379 display_manager_delegate()->OnEvent(ViewId(), CreatePointerDownEvent(61, 22));
380 EXPECT_EQ(host_connection()->view_tree_host()->root_view(), 380 EXPECT_EQ(host_connection()->view_tree_host()->root_view(),
381 host_connection()->view_tree_host()->GetFocusedView()); 381 host_connection()->view_tree_host()->GetFocusedView());
382 ASSERT_GE(wm_client()->tracker()->changes()->size(), 1u); 382 ASSERT_GE(wm_client()->tracker()->changes()->size(), 1u);
383 EXPECT_EQ("Focused id=0,2", 383 EXPECT_EQ("Focused id=0,2",
384 ChangesToDescription1(*wm_client()->tracker()->changes())[0]); 384 ChangesToDescription1(*wm_client()->tracker()->changes())[0]);
385 ASSERT_GE(connection1_client->tracker()->changes()->size(), 1u); 385 ASSERT_GE(connection1_client->tracker()->changes()->size(), 1u);
386 EXPECT_EQ( 386 EXPECT_EQ(
387 "Focused id=null", 387 "Focused id=null",
388 ChangesToDescription1(*connection1_client->tracker()->changes())[0]); 388 ChangesToDescription1(*connection1_client->tracker()->changes())[0]);
389 389
390 display_manager_delegate()->OnEvent(CreatePointerUpEvent(21, 22)); 390 display_manager_delegate()->OnEvent(ViewId(), CreatePointerUpEvent(21, 22));
391 wm_client()->tracker()->changes()->clear(); 391 wm_client()->tracker()->changes()->clear();
392 connection1_client->tracker()->changes()->clear(); 392 connection1_client->tracker()->changes()->clear();
393 393
394 // Press in the same location. Should not get a focus change event (only input 394 // Press in the same location. Should not get a focus change event (only input
395 // event). 395 // event).
396 display_manager_delegate()->OnEvent(CreatePointerDownEvent(61, 22)); 396 display_manager_delegate()->OnEvent(ViewId(), CreatePointerDownEvent(61, 22));
397 EXPECT_EQ(host_connection()->view_tree_host()->root_view(), 397 EXPECT_EQ(host_connection()->view_tree_host()->root_view(),
398 host_connection()->view_tree_host()->GetFocusedView()); 398 host_connection()->view_tree_host()->GetFocusedView());
399 ASSERT_EQ(wm_client()->tracker()->changes()->size(), 1u); 399 ASSERT_EQ(wm_client()->tracker()->changes()->size(), 1u);
400 EXPECT_EQ("InputEvent view=0,2 event_action=4", 400 EXPECT_EQ("InputEvent view=0,2 event_action=4",
401 ChangesToDescription1(*wm_client()->tracker()->changes())[0]); 401 ChangesToDescription1(*wm_client()->tracker()->changes())[0]);
402 EXPECT_TRUE(connection1_client->tracker()->changes()->empty()); 402 EXPECT_TRUE(connection1_client->tracker()->changes()->empty());
403 } 403 }
404 404
405 TEST_F(ViewTreeTest, BasicInputEventTarget) { 405 TEST_F(ViewTreeTest, BasicInputEventTarget) {
406 const ViewId embed_view_id(wm_connection()->id(), 1); 406 const ViewId embed_view_id(wm_connection()->id(), 1);
(...skipping 20 matching lines...) Expand all
427 ServerView* v1 = connection1->GetView(child1); 427 ServerView* v1 = connection1->GetView(child1);
428 v1->SetVisible(true); 428 v1->SetVisible(true);
429 v1->SetBounds(gfx::Rect(20, 20, 20, 20)); 429 v1->SetBounds(gfx::Rect(20, 20, 20, 20));
430 430
431 TestViewTreeClient* embed_connection = last_view_tree_client(); 431 TestViewTreeClient* embed_connection = last_view_tree_client();
432 embed_connection->tracker()->changes()->clear(); 432 embed_connection->tracker()->changes()->clear();
433 wm_client()->tracker()->changes()->clear(); 433 wm_client()->tracker()->changes()->clear();
434 434
435 // Send an event to |v1|. |embed_connection| should get the event, not 435 // Send an event to |v1|. |embed_connection| should get the event, not
436 // |wm_client|, since |v1| lives inside an embedded view. 436 // |wm_client|, since |v1| lives inside an embedded view.
437 display_manager_delegate()->OnEvent(CreatePointerDownEvent(21, 22)); 437 display_manager_delegate()->OnEvent(ViewId(), CreatePointerDownEvent(21, 22));
438 ASSERT_EQ(1u, wm_client()->tracker()->changes()->size()); 438 ASSERT_EQ(1u, wm_client()->tracker()->changes()->size());
439 EXPECT_EQ("Focused id=2,1", 439 EXPECT_EQ("Focused id=2,1",
440 ChangesToDescription1(*wm_client()->tracker()->changes())[0]); 440 ChangesToDescription1(*wm_client()->tracker()->changes())[0]);
441 ASSERT_EQ(2u, embed_connection->tracker()->changes()->size()); 441 ASSERT_EQ(2u, embed_connection->tracker()->changes()->size());
442 EXPECT_EQ("Focused id=2,1", 442 EXPECT_EQ("Focused id=2,1",
443 ChangesToDescription1(*embed_connection->tracker()->changes())[0]); 443 ChangesToDescription1(*embed_connection->tracker()->changes())[0]);
444 EXPECT_EQ("InputEvent view=2,1 event_action=4", 444 EXPECT_EQ("InputEvent view=2,1 event_action=4",
445 ChangesToDescription1(*embed_connection->tracker()->changes())[1]); 445 ChangesToDescription1(*embed_connection->tracker()->changes())[1]);
446 } 446 }
447 447
448 } // namespace view_manager 448 } // namespace view_manager
OLDNEW
« components/mus/display_manager.cc ('K') | « components/mus/view_tree_host_impl.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698