OLD | NEW |
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 <stdint.h> | 5 #include <stdint.h> |
6 | 6 |
7 #include <string> | 7 #include <string> |
8 #include <vector> | 8 #include <vector> |
9 | 9 |
10 #include "base/macros.h" | 10 #include "base/macros.h" |
(...skipping 17 matching lines...) Expand all Loading... |
28 #include "mojo/converters/geometry/geometry_type_converters.h" | 28 #include "mojo/converters/geometry/geometry_type_converters.h" |
29 #include "mojo/services/network/public/interfaces/url_loader.mojom.h" | 29 #include "mojo/services/network/public/interfaces/url_loader.mojom.h" |
30 #include "testing/gtest/include/gtest/gtest.h" | 30 #include "testing/gtest/include/gtest/gtest.h" |
31 #include "ui/events/event.h" | 31 #include "ui/events/event.h" |
32 #include "ui/events/event_utils.h" | 32 #include "ui/events/event_utils.h" |
33 #include "ui/gfx/geometry/rect.h" | 33 #include "ui/gfx/geometry/rect.h" |
34 | 34 |
35 using mojo::Array; | 35 using mojo::Array; |
36 using mojo::InterfaceRequest; | 36 using mojo::InterfaceRequest; |
37 using mojo::String; | 37 using mojo::String; |
38 using mus::mojom::ERROR_CODE_NONE; | |
39 using mus::mojom::Event; | 38 using mus::mojom::Event; |
40 using mus::mojom::EventPtr; | 39 using mus::mojom::EventPtr; |
41 using mus::mojom::LocationData; | 40 using mus::mojom::LocationData; |
42 using mus::mojom::PointerData; | 41 using mus::mojom::PointerData; |
43 using mus::mojom::WindowDataPtr; | 42 using mus::mojom::WindowDataPtr; |
44 | 43 |
45 namespace mus { | 44 namespace mus { |
46 | 45 |
47 namespace ws { | 46 namespace ws { |
48 namespace { | 47 namespace { |
(...skipping 166 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
215 ConnectionManager* manager) | 214 ConnectionManager* manager) |
216 : WindowTreeHostConnection(std::move(host_impl), manager) {} | 215 : WindowTreeHostConnection(std::move(host_impl), manager) {} |
217 ~TestWindowTreeHostConnection() override {} | 216 ~TestWindowTreeHostConnection() override {} |
218 | 217 |
219 private: | 218 private: |
220 // WindowTreeHostDelegate: | 219 // WindowTreeHostDelegate: |
221 void OnDisplayInitialized() override { | 220 void OnDisplayInitialized() override { |
222 connection_manager()->AddHost(this); | 221 connection_manager()->AddHost(this); |
223 set_window_tree(connection_manager()->EmbedAtWindow( | 222 set_window_tree(connection_manager()->EmbedAtWindow( |
224 window_tree_host()->root_window()->id(), | 223 window_tree_host()->root_window()->id(), |
225 mus::mojom::WindowTree::ACCESS_POLICY_EMBED_ROOT, | 224 mus::mojom::WindowTree::kAccessPolicyEmbedRoot, |
226 mus::mojom::WindowTreeClientPtr())); | 225 mus::mojom::WindowTreeClientPtr())); |
227 } | 226 } |
228 DISALLOW_COPY_AND_ASSIGN(TestWindowTreeHostConnection); | 227 DISALLOW_COPY_AND_ASSIGN(TestWindowTreeHostConnection); |
229 }; | 228 }; |
230 | 229 |
231 // ----------------------------------------------------------------------------- | 230 // ----------------------------------------------------------------------------- |
232 // Empty implementation of DisplayManager. | 231 // Empty implementation of DisplayManager. |
233 class TestDisplayManager : public DisplayManager { | 232 class TestDisplayManager : public DisplayManager { |
234 public: | 233 public: |
235 explicit TestDisplayManager(int32_t* cursor_id_storage) | 234 explicit TestDisplayManager(int32_t* cursor_id_storage) |
(...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
333 return delegate_.last_client(); | 332 return delegate_.last_client(); |
334 } | 333 } |
335 | 334 |
336 TestClientConnection* last_client_connection() { | 335 TestClientConnection* last_client_connection() { |
337 return delegate_.last_connection(); | 336 return delegate_.last_connection(); |
338 } | 337 } |
339 | 338 |
340 ConnectionManager* connection_manager() { return connection_manager_.get(); } | 339 ConnectionManager* connection_manager() { return connection_manager_.get(); } |
341 | 340 |
342 TestWindowTreeClient* wm_client() { return wm_client_; } | 341 TestWindowTreeClient* wm_client() { return wm_client_; } |
343 int32_t cursor_id() { return cursor_id_; } | 342 mus::mojom::Cursor cursor_id() { |
| 343 return static_cast<mus::mojom::Cursor>(cursor_id_); |
| 344 } |
344 | 345 |
345 TestWindowTreeHostConnection* host_connection() { return host_connection_; } | 346 TestWindowTreeHostConnection* host_connection() { return host_connection_; } |
346 | 347 |
347 void DispatchEventWithoutAck(const ui::Event& event) { | 348 void DispatchEventWithoutAck(const ui::Event& event) { |
348 host_connection()->window_tree_host()->OnEvent(event); | 349 host_connection()->window_tree_host()->OnEvent(event); |
349 } | 350 } |
350 | 351 |
351 void AckPreviousEvent() { | 352 void AckPreviousEvent() { |
352 host_connection() | 353 host_connection() |
353 ->window_tree_host() | 354 ->window_tree_host() |
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
408 EXPECT_TRUE( | 409 EXPECT_TRUE( |
409 wm_connection()->AddWindow(*(wm_connection()->root()), embed_window_id)); | 410 wm_connection()->AddWindow(*(wm_connection()->root()), embed_window_id)); |
410 host_connection()->window_tree_host()->root_window()->SetBounds( | 411 host_connection()->window_tree_host()->root_window()->SetBounds( |
411 gfx::Rect(0, 0, 100, 100)); | 412 gfx::Rect(0, 0, 100, 100)); |
412 mojom::WindowTreeClientPtr client; | 413 mojom::WindowTreeClientPtr client; |
413 mojo::InterfaceRequest<mojom::WindowTreeClient> client_request = | 414 mojo::InterfaceRequest<mojom::WindowTreeClient> client_request = |
414 GetProxy(&client); | 415 GetProxy(&client); |
415 wm_client()->Bind(std::move(client_request)); | 416 wm_client()->Bind(std::move(client_request)); |
416 ConnectionSpecificId connection_id = 0; | 417 ConnectionSpecificId connection_id = 0; |
417 wm_connection()->Embed(embed_window_id, std::move(client), | 418 wm_connection()->Embed(embed_window_id, std::move(client), |
418 mojom::WindowTree::ACCESS_POLICY_DEFAULT, | 419 mojom::WindowTree::kAccessPolicyDefault, |
419 &connection_id); | 420 &connection_id); |
420 WindowTreeImpl* connection1 = | 421 WindowTreeImpl* connection1 = |
421 connection_manager()->GetConnectionWithRoot(embed_window_id); | 422 connection_manager()->GetConnectionWithRoot(embed_window_id); |
422 ASSERT_TRUE(connection1 != nullptr); | 423 ASSERT_TRUE(connection1 != nullptr); |
423 ASSERT_NE(connection1, wm_connection()); | 424 ASSERT_NE(connection1, wm_connection()); |
424 | 425 |
425 connection_manager() | 426 connection_manager() |
426 ->GetWindow(embed_window_id) | 427 ->GetWindow(embed_window_id) |
427 ->SetBounds(gfx::Rect(0, 0, 50, 50)); | 428 ->SetBounds(gfx::Rect(0, 0, 50, 50)); |
428 | 429 |
(...skipping 26 matching lines...) Expand all Loading... |
455 EXPECT_TRUE( | 456 EXPECT_TRUE( |
456 wm_connection()->AddWindow(*(wm_connection()->root()), embed_window_id)); | 457 wm_connection()->AddWindow(*(wm_connection()->root()), embed_window_id)); |
457 host_connection()->window_tree_host()->root_window()->SetBounds( | 458 host_connection()->window_tree_host()->root_window()->SetBounds( |
458 gfx::Rect(0, 0, 100, 100)); | 459 gfx::Rect(0, 0, 100, 100)); |
459 mojom::WindowTreeClientPtr client; | 460 mojom::WindowTreeClientPtr client; |
460 mojo::InterfaceRequest<mojom::WindowTreeClient> client_request = | 461 mojo::InterfaceRequest<mojom::WindowTreeClient> client_request = |
461 GetProxy(&client); | 462 GetProxy(&client); |
462 wm_client()->Bind(std::move(client_request)); | 463 wm_client()->Bind(std::move(client_request)); |
463 ConnectionSpecificId connection_id = 0; | 464 ConnectionSpecificId connection_id = 0; |
464 wm_connection()->Embed(embed_window_id, std::move(client), | 465 wm_connection()->Embed(embed_window_id, std::move(client), |
465 mojom::WindowTree::ACCESS_POLICY_DEFAULT, | 466 mojom::WindowTree::kAccessPolicyDefault, |
466 &connection_id); | 467 &connection_id); |
467 WindowTreeImpl* connection1 = | 468 WindowTreeImpl* connection1 = |
468 connection_manager()->GetConnectionWithRoot(embed_window_id); | 469 connection_manager()->GetConnectionWithRoot(embed_window_id); |
469 ASSERT_TRUE(connection1 != nullptr); | 470 ASSERT_TRUE(connection1 != nullptr); |
470 ASSERT_NE(connection1, wm_connection()); | 471 ASSERT_NE(connection1, wm_connection()); |
471 | 472 |
472 connection_manager() | 473 connection_manager() |
473 ->GetWindow(embed_window_id) | 474 ->GetWindow(embed_window_id) |
474 ->SetBounds(gfx::Rect(0, 0, 50, 50)); | 475 ->SetBounds(gfx::Rect(0, 0, 50, 50)); |
475 | 476 |
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
556 TestWindowTreeClient* embed_connection = nullptr; | 557 TestWindowTreeClient* embed_connection = nullptr; |
557 WindowTreeImpl* window_tree_connection = nullptr; | 558 WindowTreeImpl* window_tree_connection = nullptr; |
558 ServerWindow* window = nullptr; | 559 ServerWindow* window = nullptr; |
559 EXPECT_NO_FATAL_FAILURE( | 560 EXPECT_NO_FATAL_FAILURE( |
560 SetupEventTargeting(&embed_connection, &window_tree_connection, &window)); | 561 SetupEventTargeting(&embed_connection, &window_tree_connection, &window)); |
561 | 562 |
562 // Like in BasicInputEventTarget, we send a pointer down event to be | 563 // Like in BasicInputEventTarget, we send a pointer down event to be |
563 // dispatched. This is only to place the mouse cursor over that window though. | 564 // dispatched. This is only to place the mouse cursor over that window though. |
564 DispatchEventAndAckImmediately(CreateMouseMoveEvent(21, 22)); | 565 DispatchEventAndAckImmediately(CreateMouseMoveEvent(21, 22)); |
565 | 566 |
566 window->SetPredefinedCursor(mojom::Cursor::CURSOR_IBEAM); | 567 window->SetPredefinedCursor(mojom::Cursor::IBEAM); |
567 | 568 |
568 // Because the cursor is over the window when SetCursor was called, we should | 569 // Because the cursor is over the window when SetCursor was called, we should |
569 // have immediately changed the cursor. | 570 // have immediately changed the cursor. |
570 EXPECT_EQ(mojom::Cursor::CURSOR_IBEAM, cursor_id()); | 571 EXPECT_EQ(mojom::Cursor::IBEAM, cursor_id()); |
571 } | 572 } |
572 | 573 |
573 TEST_F(WindowTreeTest, CursorChangesWhenEnteringWindowWithDifferentCursor) { | 574 TEST_F(WindowTreeTest, CursorChangesWhenEnteringWindowWithDifferentCursor) { |
574 TestWindowTreeClient* embed_connection = nullptr; | 575 TestWindowTreeClient* embed_connection = nullptr; |
575 WindowTreeImpl* window_tree_connection = nullptr; | 576 WindowTreeImpl* window_tree_connection = nullptr; |
576 ServerWindow* window = nullptr; | 577 ServerWindow* window = nullptr; |
577 EXPECT_NO_FATAL_FAILURE( | 578 EXPECT_NO_FATAL_FAILURE( |
578 SetupEventTargeting(&embed_connection, &window_tree_connection, &window)); | 579 SetupEventTargeting(&embed_connection, &window_tree_connection, &window)); |
579 | 580 |
580 // Let's create a pointer event outside the window and then move the pointer | 581 // Let's create a pointer event outside the window and then move the pointer |
581 // inside. | 582 // inside. |
582 DispatchEventAndAckImmediately(CreateMouseMoveEvent(5, 5)); | 583 DispatchEventAndAckImmediately(CreateMouseMoveEvent(5, 5)); |
583 window->SetPredefinedCursor(mojom::Cursor::CURSOR_IBEAM); | 584 window->SetPredefinedCursor(mojom::Cursor::IBEAM); |
584 EXPECT_EQ(mojom::Cursor::CURSOR_NULL, cursor_id()); | 585 EXPECT_EQ(mojom::Cursor::CURSOR_NULL, cursor_id()); |
585 | 586 |
586 DispatchEventAndAckImmediately(CreateMouseMoveEvent(21, 22)); | 587 DispatchEventAndAckImmediately(CreateMouseMoveEvent(21, 22)); |
587 EXPECT_EQ(mojom::Cursor::CURSOR_IBEAM, cursor_id()); | 588 EXPECT_EQ(mojom::Cursor::IBEAM, cursor_id()); |
588 } | 589 } |
589 | 590 |
590 TEST_F(WindowTreeTest, TouchesDontChangeCursor) { | 591 TEST_F(WindowTreeTest, TouchesDontChangeCursor) { |
591 TestWindowTreeClient* embed_connection = nullptr; | 592 TestWindowTreeClient* embed_connection = nullptr; |
592 WindowTreeImpl* window_tree_connection = nullptr; | 593 WindowTreeImpl* window_tree_connection = nullptr; |
593 ServerWindow* window = nullptr; | 594 ServerWindow* window = nullptr; |
594 EXPECT_NO_FATAL_FAILURE( | 595 EXPECT_NO_FATAL_FAILURE( |
595 SetupEventTargeting(&embed_connection, &window_tree_connection, &window)); | 596 SetupEventTargeting(&embed_connection, &window_tree_connection, &window)); |
596 | 597 |
597 // Let's create a pointer event outside the window and then move the pointer | 598 // Let's create a pointer event outside the window and then move the pointer |
598 // inside. | 599 // inside. |
599 DispatchEventAndAckImmediately(CreateMouseMoveEvent(5, 5)); | 600 DispatchEventAndAckImmediately(CreateMouseMoveEvent(5, 5)); |
600 window->SetPredefinedCursor(mojom::Cursor::CURSOR_IBEAM); | 601 window->SetPredefinedCursor(mojom::Cursor::IBEAM); |
601 EXPECT_EQ(mojom::Cursor::CURSOR_NULL, cursor_id()); | 602 EXPECT_EQ(mojom::Cursor::CURSOR_NULL, cursor_id()); |
602 | 603 |
603 // With a touch event, we shouldn't update the cursor. | 604 // With a touch event, we shouldn't update the cursor. |
604 DispatchEventAndAckImmediately(CreatePointerDownEvent(21, 22)); | 605 DispatchEventAndAckImmediately(CreatePointerDownEvent(21, 22)); |
605 EXPECT_EQ(mojom::Cursor::CURSOR_NULL, cursor_id()); | 606 EXPECT_EQ(mojom::Cursor::CURSOR_NULL, cursor_id()); |
606 } | 607 } |
607 | 608 |
608 TEST_F(WindowTreeTest, DragOutsideWindow) { | 609 TEST_F(WindowTreeTest, DragOutsideWindow) { |
609 TestWindowTreeClient* embed_connection = nullptr; | 610 TestWindowTreeClient* embed_connection = nullptr; |
610 WindowTreeImpl* window_tree_connection = nullptr; | 611 WindowTreeImpl* window_tree_connection = nullptr; |
611 ServerWindow* window = nullptr; | 612 ServerWindow* window = nullptr; |
612 EXPECT_NO_FATAL_FAILURE( | 613 EXPECT_NO_FATAL_FAILURE( |
613 SetupEventTargeting(&embed_connection, &window_tree_connection, &window)); | 614 SetupEventTargeting(&embed_connection, &window_tree_connection, &window)); |
614 | 615 |
615 // Start with the cursor outside the window. Setting the cursor shouldn't | 616 // Start with the cursor outside the window. Setting the cursor shouldn't |
616 // change the cursor. | 617 // change the cursor. |
617 DispatchEventAndAckImmediately(CreateMouseMoveEvent(5, 5)); | 618 DispatchEventAndAckImmediately(CreateMouseMoveEvent(5, 5)); |
618 window->SetPredefinedCursor(mojom::Cursor::CURSOR_IBEAM); | 619 window->SetPredefinedCursor(mojom::Cursor::IBEAM); |
619 EXPECT_EQ(mojom::Cursor::CURSOR_NULL, cursor_id()); | 620 EXPECT_EQ(mojom::Cursor::CURSOR_NULL, cursor_id()); |
620 | 621 |
621 // Move the pointer to the inside of the window | 622 // Move the pointer to the inside of the window |
622 DispatchEventAndAckImmediately(CreateMouseMoveEvent(21, 22)); | 623 DispatchEventAndAckImmediately(CreateMouseMoveEvent(21, 22)); |
623 EXPECT_EQ(mojom::Cursor::CURSOR_IBEAM, cursor_id()); | 624 EXPECT_EQ(mojom::Cursor::IBEAM, cursor_id()); |
624 | 625 |
625 // Start the drag. | 626 // Start the drag. |
626 DispatchEventAndAckImmediately(CreateMouseDownEvent(21, 22)); | 627 DispatchEventAndAckImmediately(CreateMouseDownEvent(21, 22)); |
627 EXPECT_EQ(mojom::Cursor::CURSOR_IBEAM, cursor_id()); | 628 EXPECT_EQ(mojom::Cursor::IBEAM, cursor_id()); |
628 | 629 |
629 // Move the cursor (mouse is still down) outside the window. | 630 // Move the cursor (mouse is still down) outside the window. |
630 DispatchEventAndAckImmediately(CreateMouseMoveEvent(5, 5)); | 631 DispatchEventAndAckImmediately(CreateMouseMoveEvent(5, 5)); |
631 EXPECT_EQ(mojom::Cursor::CURSOR_IBEAM, cursor_id()); | 632 EXPECT_EQ(mojom::Cursor::IBEAM, cursor_id()); |
632 | 633 |
633 // Release the cursor. We should now adapt the cursor of the window | 634 // Release the cursor. We should now adapt the cursor of the window |
634 // underneath the pointer. | 635 // underneath the pointer. |
635 DispatchEventAndAckImmediately(CreateMouseUpEvent(5, 5)); | 636 DispatchEventAndAckImmediately(CreateMouseUpEvent(5, 5)); |
636 EXPECT_EQ(mojom::Cursor::CURSOR_NULL, cursor_id()); | 637 EXPECT_EQ(mojom::Cursor::CURSOR_NULL, cursor_id()); |
637 } | 638 } |
638 | 639 |
639 TEST_F(WindowTreeTest, ChangingWindowBoundsChangesCursor) { | 640 TEST_F(WindowTreeTest, ChangingWindowBoundsChangesCursor) { |
640 TestWindowTreeClient* embed_connection = nullptr; | 641 TestWindowTreeClient* embed_connection = nullptr; |
641 WindowTreeImpl* window_tree_connection = nullptr; | 642 WindowTreeImpl* window_tree_connection = nullptr; |
642 ServerWindow* window = nullptr; | 643 ServerWindow* window = nullptr; |
643 EXPECT_NO_FATAL_FAILURE( | 644 EXPECT_NO_FATAL_FAILURE( |
644 SetupEventTargeting(&embed_connection, &window_tree_connection, &window)); | 645 SetupEventTargeting(&embed_connection, &window_tree_connection, &window)); |
645 | 646 |
646 // Put the cursor just outside the bounds of the window. | 647 // Put the cursor just outside the bounds of the window. |
647 DispatchEventAndAckImmediately(CreateMouseMoveEvent(41, 41)); | 648 DispatchEventAndAckImmediately(CreateMouseMoveEvent(41, 41)); |
648 window->SetPredefinedCursor(mojom::Cursor::CURSOR_IBEAM); | 649 window->SetPredefinedCursor(mojom::Cursor::IBEAM); |
649 EXPECT_EQ(mojom::Cursor::CURSOR_NULL, cursor_id()); | 650 EXPECT_EQ(mojom::Cursor::CURSOR_NULL, cursor_id()); |
650 | 651 |
651 // Expand the bounds of the window so they now include where the cursor now | 652 // Expand the bounds of the window so they now include where the cursor now |
652 // is. | 653 // is. |
653 window->SetBounds(gfx::Rect(20, 20, 25, 25)); | 654 window->SetBounds(gfx::Rect(20, 20, 25, 25)); |
654 EXPECT_EQ(mojom::Cursor::CURSOR_IBEAM, cursor_id()); | 655 EXPECT_EQ(mojom::Cursor::IBEAM, cursor_id()); |
655 | 656 |
656 // Contract the bounds again. | 657 // Contract the bounds again. |
657 window->SetBounds(gfx::Rect(20, 20, 20, 20)); | 658 window->SetBounds(gfx::Rect(20, 20, 20, 20)); |
658 EXPECT_EQ(mojom::Cursor::CURSOR_NULL, cursor_id()); | 659 EXPECT_EQ(mojom::Cursor::CURSOR_NULL, cursor_id()); |
659 } | 660 } |
660 | 661 |
661 TEST_F(WindowTreeTest, WindowReorderingChangesCursor) { | 662 TEST_F(WindowTreeTest, WindowReorderingChangesCursor) { |
662 TestWindowTreeClient* embed_connection = nullptr; | 663 TestWindowTreeClient* embed_connection = nullptr; |
663 WindowTreeImpl* window_tree_connection = nullptr; | 664 WindowTreeImpl* window_tree_connection = nullptr; |
664 ServerWindow* window1 = nullptr; | 665 ServerWindow* window1 = nullptr; |
665 EXPECT_NO_FATAL_FAILURE(SetupEventTargeting( | 666 EXPECT_NO_FATAL_FAILURE(SetupEventTargeting( |
666 &embed_connection, &window_tree_connection, &window1)); | 667 &embed_connection, &window_tree_connection, &window1)); |
667 | 668 |
668 // Create a second window right over the first. | 669 // Create a second window right over the first. |
669 const WindowId embed_window_id(wm_connection()->id(), 1); | 670 const WindowId embed_window_id(wm_connection()->id(), 1); |
670 const WindowId child2(window_tree_connection->id(), 2); | 671 const WindowId child2(window_tree_connection->id(), 2); |
671 EXPECT_TRUE( | 672 EXPECT_TRUE( |
672 window_tree_connection->NewWindow(child2, ServerWindow::Properties())); | 673 window_tree_connection->NewWindow(child2, ServerWindow::Properties())); |
673 EXPECT_TRUE(window_tree_connection->AddWindow(embed_window_id, child2)); | 674 EXPECT_TRUE(window_tree_connection->AddWindow(embed_window_id, child2)); |
674 window_tree_connection->GetHost()->AddActivationParent( | 675 window_tree_connection->GetHost()->AddActivationParent( |
675 WindowIdToTransportId(embed_window_id)); | 676 WindowIdToTransportId(embed_window_id)); |
676 ServerWindow* window2 = window_tree_connection->GetWindow(child2); | 677 ServerWindow* window2 = window_tree_connection->GetWindow(child2); |
677 window2->SetVisible(true); | 678 window2->SetVisible(true); |
678 window2->SetBounds(gfx::Rect(20, 20, 20, 20)); | 679 window2->SetBounds(gfx::Rect(20, 20, 20, 20)); |
679 EnableHitTest(window2); | 680 EnableHitTest(window2); |
680 | 681 |
681 // Give each window a different cursor. | 682 // Give each window a different cursor. |
682 window1->SetPredefinedCursor(mojom::Cursor::CURSOR_IBEAM); | 683 window1->SetPredefinedCursor(mojom::Cursor::IBEAM); |
683 window2->SetPredefinedCursor(mojom::Cursor::CURSOR_HAND); | 684 window2->SetPredefinedCursor(mojom::Cursor::HAND); |
684 | 685 |
685 // We expect window2 to be over window1 now. | 686 // We expect window2 to be over window1 now. |
686 DispatchEventAndAckImmediately(CreateMouseMoveEvent(22, 22)); | 687 DispatchEventAndAckImmediately(CreateMouseMoveEvent(22, 22)); |
687 EXPECT_EQ(mojom::Cursor::CURSOR_HAND, cursor_id()); | 688 EXPECT_EQ(mojom::Cursor::HAND, cursor_id()); |
688 | 689 |
689 // But when we put window2 at the bottom, we should adapt window1's cursor. | 690 // But when we put window2 at the bottom, we should adapt window1's cursor. |
690 window2->parent()->StackChildAtBottom(window2); | 691 window2->parent()->StackChildAtBottom(window2); |
691 EXPECT_EQ(mojom::Cursor::CURSOR_IBEAM, cursor_id()); | 692 EXPECT_EQ(mojom::Cursor::IBEAM, cursor_id()); |
692 } | 693 } |
693 | 694 |
694 TEST_F(WindowTreeTest, EventAck) { | 695 TEST_F(WindowTreeTest, EventAck) { |
695 const WindowId embed_window_id(wm_connection()->id(), 1); | 696 const WindowId embed_window_id(wm_connection()->id(), 1); |
696 EXPECT_TRUE( | 697 EXPECT_TRUE( |
697 wm_connection()->NewWindow(embed_window_id, ServerWindow::Properties())); | 698 wm_connection()->NewWindow(embed_window_id, ServerWindow::Properties())); |
698 EXPECT_TRUE(wm_connection()->SetWindowVisibility(embed_window_id, true)); | 699 EXPECT_TRUE(wm_connection()->SetWindowVisibility(embed_window_id, true)); |
699 EXPECT_TRUE( | 700 EXPECT_TRUE( |
700 wm_connection()->AddWindow(*(wm_connection()->root()), embed_window_id)); | 701 wm_connection()->AddWindow(*(wm_connection()->root()), embed_window_id)); |
701 host_connection()->window_tree_host()->root_window()->SetBounds( | 702 host_connection()->window_tree_host()->root_window()->SetBounds( |
(...skipping 13 matching lines...) Expand all Loading... |
715 // Ack the first event. That should trigger the dispatch of the second event. | 716 // Ack the first event. That should trigger the dispatch of the second event. |
716 AckPreviousEvent(); | 717 AckPreviousEvent(); |
717 ASSERT_EQ(1u, wm_client()->tracker()->changes()->size()); | 718 ASSERT_EQ(1u, wm_client()->tracker()->changes()->size()); |
718 EXPECT_EQ("InputEvent window=0,2 event_action=5", | 719 EXPECT_EQ("InputEvent window=0,2 event_action=5", |
719 ChangesToDescription1(*wm_client()->tracker()->changes())[0]); | 720 ChangesToDescription1(*wm_client()->tracker()->changes())[0]); |
720 } | 721 } |
721 | 722 |
722 } // namespace ws | 723 } // namespace ws |
723 | 724 |
724 } // namespace mus | 725 } // namespace mus |
OLD | NEW |