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

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: Added TODO 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
« no previous file with comments | « components/mus/view_tree_host_impl.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 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 341 matching lines...) Expand 10 before | Expand all | Expand 10 after
352 EXPECT_EQ(ERROR_CODE_NONE, connection1->CreateView(child1)); 352 EXPECT_EQ(ERROR_CODE_NONE, connection1->CreateView(child1));
353 EXPECT_TRUE(connection1->AddView(embed_view_id, child1)); 353 EXPECT_TRUE(connection1->AddView(embed_view_id, child1));
354 ServerView* v1 = connection1->GetView(child1); 354 ServerView* v1 = connection1->GetView(child1);
355 v1->SetVisible(true); 355 v1->SetVisible(true);
356 v1->SetBounds(gfx::Rect(20, 20, 20, 20)); 356 v1->SetBounds(gfx::Rect(20, 20, 20, 20));
357 357
358 TestViewTreeClient* connection1_client = last_view_tree_client(); 358 TestViewTreeClient* connection1_client = last_view_tree_client();
359 connection1_client->tracker()->changes()->clear(); 359 connection1_client->tracker()->changes()->clear();
360 wm_client()->tracker()->changes()->clear(); 360 wm_client()->tracker()->changes()->clear();
361 361
362 display_manager_delegate()->OnEvent(CreatePointerDownEvent(21, 22)); 362 display_manager_delegate()->OnEvent(ViewId(), CreatePointerDownEvent(21, 22));
363 // Focus should go to child1. This result in notifying both the window 363 // Focus should go to child1. This result in notifying both the window
364 // manager and client connection being notified. 364 // manager and client connection being notified.
365 EXPECT_EQ(v1, connection1->GetHost()->GetFocusedView()); 365 EXPECT_EQ(v1, connection1->GetHost()->GetFocusedView());
366 ASSERT_GE(wm_client()->tracker()->changes()->size(), 1u); 366 ASSERT_GE(wm_client()->tracker()->changes()->size(), 1u);
367 EXPECT_EQ("Focused id=2,1", 367 EXPECT_EQ("Focused id=2,1",
368 ChangesToDescription1(*wm_client()->tracker()->changes())[0]); 368 ChangesToDescription1(*wm_client()->tracker()->changes())[0]);
369 ASSERT_GE(connection1_client->tracker()->changes()->size(), 1u); 369 ASSERT_GE(connection1_client->tracker()->changes()->size(), 1u);
370 EXPECT_EQ( 370 EXPECT_EQ(
371 "Focused id=2,1", 371 "Focused id=2,1",
372 ChangesToDescription1(*connection1_client->tracker()->changes())[0]); 372 ChangesToDescription1(*connection1_client->tracker()->changes())[0]);
373 373
374 display_manager_delegate()->OnEvent(CreatePointerUpEvent(21, 22)); 374 display_manager_delegate()->OnEvent(ViewId(), CreatePointerUpEvent(21, 22));
375 wm_client()->tracker()->changes()->clear(); 375 wm_client()->tracker()->changes()->clear();
376 connection1_client->tracker()->changes()->clear(); 376 connection1_client->tracker()->changes()->clear();
377 377
378 // Press outside of the embedded view. Focus should go to the root. Notice 378 // Press outside of the embedded view. Focus should go to the root. Notice
379 // the client1 doesn't see who has focus as the focused view (root) isn't 379 // the client1 doesn't see who has focus as the focused view (root) isn't
380 // visible to it. 380 // visible to it.
381 display_manager_delegate()->OnEvent(CreatePointerDownEvent(61, 22)); 381 display_manager_delegate()->OnEvent(ViewId(), CreatePointerDownEvent(61, 22));
382 EXPECT_EQ(host_connection()->view_tree_host()->root_view(), 382 EXPECT_EQ(host_connection()->view_tree_host()->root_view(),
383 host_connection()->view_tree_host()->GetFocusedView()); 383 host_connection()->view_tree_host()->GetFocusedView());
384 ASSERT_GE(wm_client()->tracker()->changes()->size(), 1u); 384 ASSERT_GE(wm_client()->tracker()->changes()->size(), 1u);
385 EXPECT_EQ("Focused id=0,2", 385 EXPECT_EQ("Focused id=0,2",
386 ChangesToDescription1(*wm_client()->tracker()->changes())[0]); 386 ChangesToDescription1(*wm_client()->tracker()->changes())[0]);
387 ASSERT_GE(connection1_client->tracker()->changes()->size(), 1u); 387 ASSERT_GE(connection1_client->tracker()->changes()->size(), 1u);
388 EXPECT_EQ( 388 EXPECT_EQ(
389 "Focused id=null", 389 "Focused id=null",
390 ChangesToDescription1(*connection1_client->tracker()->changes())[0]); 390 ChangesToDescription1(*connection1_client->tracker()->changes())[0]);
391 391
392 display_manager_delegate()->OnEvent(CreatePointerUpEvent(21, 22)); 392 display_manager_delegate()->OnEvent(ViewId(), CreatePointerUpEvent(21, 22));
393 wm_client()->tracker()->changes()->clear(); 393 wm_client()->tracker()->changes()->clear();
394 connection1_client->tracker()->changes()->clear(); 394 connection1_client->tracker()->changes()->clear();
395 395
396 // Press in the same location. Should not get a focus change event (only input 396 // Press in the same location. Should not get a focus change event (only input
397 // event). 397 // event).
398 display_manager_delegate()->OnEvent(CreatePointerDownEvent(61, 22)); 398 display_manager_delegate()->OnEvent(ViewId(), CreatePointerDownEvent(61, 22));
399 EXPECT_EQ(host_connection()->view_tree_host()->root_view(), 399 EXPECT_EQ(host_connection()->view_tree_host()->root_view(),
400 host_connection()->view_tree_host()->GetFocusedView()); 400 host_connection()->view_tree_host()->GetFocusedView());
401 ASSERT_EQ(wm_client()->tracker()->changes()->size(), 1u); 401 ASSERT_EQ(wm_client()->tracker()->changes()->size(), 1u);
402 EXPECT_EQ("InputEvent view=0,2 event_action=4", 402 EXPECT_EQ("InputEvent view=0,2 event_action=4",
403 ChangesToDescription1(*wm_client()->tracker()->changes())[0]); 403 ChangesToDescription1(*wm_client()->tracker()->changes())[0]);
404 EXPECT_TRUE(connection1_client->tracker()->changes()->empty()); 404 EXPECT_TRUE(connection1_client->tracker()->changes()->empty());
405 } 405 }
406 406
407 TEST_F(ViewTreeTest, BasicInputEventTarget) { 407 TEST_F(ViewTreeTest, BasicInputEventTarget) {
408 const ViewId embed_view_id(wm_connection()->id(), 1); 408 const ViewId embed_view_id(wm_connection()->id(), 1);
(...skipping 20 matching lines...) Expand all
429 ServerView* v1 = connection1->GetView(child1); 429 ServerView* v1 = connection1->GetView(child1);
430 v1->SetVisible(true); 430 v1->SetVisible(true);
431 v1->SetBounds(gfx::Rect(20, 20, 20, 20)); 431 v1->SetBounds(gfx::Rect(20, 20, 20, 20));
432 432
433 TestViewTreeClient* embed_connection = last_view_tree_client(); 433 TestViewTreeClient* embed_connection = last_view_tree_client();
434 embed_connection->tracker()->changes()->clear(); 434 embed_connection->tracker()->changes()->clear();
435 wm_client()->tracker()->changes()->clear(); 435 wm_client()->tracker()->changes()->clear();
436 436
437 // Send an event to |v1|. |embed_connection| should get the event, not 437 // Send an event to |v1|. |embed_connection| should get the event, not
438 // |wm_client|, since |v1| lives inside an embedded view. 438 // |wm_client|, since |v1| lives inside an embedded view.
439 display_manager_delegate()->OnEvent(CreatePointerDownEvent(21, 22)); 439 display_manager_delegate()->OnEvent(ViewId(), CreatePointerDownEvent(21, 22));
440 ASSERT_EQ(1u, wm_client()->tracker()->changes()->size()); 440 ASSERT_EQ(1u, wm_client()->tracker()->changes()->size());
441 EXPECT_EQ("Focused id=2,1", 441 EXPECT_EQ("Focused id=2,1",
442 ChangesToDescription1(*wm_client()->tracker()->changes())[0]); 442 ChangesToDescription1(*wm_client()->tracker()->changes())[0]);
443 ASSERT_EQ(2u, embed_connection->tracker()->changes()->size()); 443 ASSERT_EQ(2u, embed_connection->tracker()->changes()->size());
444 EXPECT_EQ("Focused id=2,1", 444 EXPECT_EQ("Focused id=2,1",
445 ChangesToDescription1(*embed_connection->tracker()->changes())[0]); 445 ChangesToDescription1(*embed_connection->tracker()->changes())[0]);
446 EXPECT_EQ("InputEvent view=2,1 event_action=4", 446 EXPECT_EQ("InputEvent view=2,1 event_action=4",
447 ChangesToDescription1(*embed_connection->tracker()->changes())[1]); 447 ChangesToDescription1(*embed_connection->tracker()->changes())[1]);
448 } 448 }
449 449
450 } // namespace mus 450 } // namespace mus
OLDNEW
« no previous file with comments | « 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