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

Side by Side Diff: services/ui/ws/window_tree_unittest.cc

Issue 2918553003: Implement a MoveCursorToScreenLocation for just the window manager. (Closed)
Patch Set: Thread to the PlatformWindow. Created 3 years, 6 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 | « services/ui/ws/window_tree.cc ('k') | ui/aura/mus/window_tree_client.h » ('j') | 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 "services/ui/ws/window_tree.h" 5 #include "services/ui/ws/window_tree.h"
6 6
7 #include <stdint.h> 7 #include <stdint.h>
8 8
9 #include <string> 9 #include <string>
10 #include <vector> 10 #include <vector>
(...skipping 1475 matching lines...) Expand 10 before | Expand all | Expand 10 after
1486 // Ack the change, which should resume the binding. 1486 // Ack the change, which should resume the binding.
1487 static_cast<mojom::WindowManagerClient*>(wm_tree()) 1487 static_cast<mojom::WindowManagerClient*>(wm_tree())
1488 ->OnWmCreatedTopLevelWindow(0u, embed_window_id2.id); 1488 ->OnWmCreatedTopLevelWindow(0u, embed_window_id2.id);
1489 1489
1490 // Change modal type to MODAL_TYPE_SYSTEM and check that it is forwarded to 1490 // Change modal type to MODAL_TYPE_SYSTEM and check that it is forwarded to
1491 // the window manager. 1491 // the window manager.
1492 child_tree->SetModalType(embed_window_id2_in_child, MODAL_TYPE_SYSTEM); 1492 child_tree->SetModalType(embed_window_id2_in_child, MODAL_TYPE_SYSTEM);
1493 EXPECT_TRUE(wm_internal.on_set_modal_type_called()); 1493 EXPECT_TRUE(wm_internal.on_set_modal_type_called());
1494 } 1494 }
1495 1495
1496 TEST_F(WindowTreeTest, TestWindowManagerSettingCursorLocation) {
1497 const ClientWindowId embed_window_id = BuildClientWindowId(wm_tree(), 1);
1498 EXPECT_TRUE(
1499 wm_tree()->NewWindow(embed_window_id, ServerWindow::Properties()));
1500 ServerWindow* embed_window = wm_tree()->GetWindowByClientId(embed_window_id);
1501 ASSERT_TRUE(embed_window);
1502 EXPECT_TRUE(wm_tree()->SetWindowVisibility(embed_window_id, true));
1503 ASSERT_TRUE(FirstRoot(wm_tree()));
1504 const ClientWindowId wm_root_id = FirstRootId(wm_tree());
1505 EXPECT_TRUE(wm_tree()->AddWindow(wm_root_id, embed_window_id));
1506 ServerWindow* wm_root = FirstRoot(wm_tree());
1507 ASSERT_TRUE(wm_root);
1508 wm_root->SetBounds(gfx::Rect(0, 0, 100, 100));
1509 // This tests expects |wm_root| to be a possible target.
1510 wm_root->set_event_targeting_policy(
1511 mojom::EventTargetingPolicy::TARGET_AND_DESCENDANTS);
1512 display()->root_window()->SetBounds(gfx::Rect(0, 0, 100, 100));
1513 mojom::WindowTreeClientPtr client;
1514 wm_client()->Bind(mojo::MakeRequest(&client));
1515 const uint32_t embed_flags = 0;
1516 wm_tree()->Embed(embed_window_id, std::move(client), embed_flags);
1517 WindowTree* tree1 = window_server()->GetTreeWithRoot(embed_window);
1518 ASSERT_TRUE(tree1 != nullptr);
1519 ASSERT_NE(tree1, wm_tree());
1520
1521 embed_window->SetBounds(gfx::Rect(20, 20, 20, 20));
1522 embed_window->SetCursor(ui::CursorData(ui::CursorType::kIBeam));
1523
1524 // Because the cursor is still at the origin, changing the cursor shouldn't
1525 // have switched to ibeam.
1526 EXPECT_EQ(ui::CursorType::kPointer, cursor_type());
1527
1528 // Have the window manager mvoe the cursor within the embed window.
sky 2017/06/02 13:10:07 mvoe -> move
1529 static_cast<mojom::WindowManagerClient*>(wm_tree())
1530 ->WmMoveCursorToDisplayLocation(gfx::Point(21, 21), -1);
1531
1532 EXPECT_EQ(ui::CursorType::kIBeam, cursor_type());
1533 }
1534
1496 using WindowTreeShutdownTest = testing::Test; 1535 using WindowTreeShutdownTest = testing::Test;
1497 1536
1498 // Makes sure WindowTreeClient doesn't get any messages during shutdown. 1537 // Makes sure WindowTreeClient doesn't get any messages during shutdown.
1499 TEST_F(WindowTreeShutdownTest, DontSendMessagesDuringShutdown) { 1538 TEST_F(WindowTreeShutdownTest, DontSendMessagesDuringShutdown) {
1500 std::unique_ptr<TestWindowTreeClient> client; 1539 std::unique_ptr<TestWindowTreeClient> client;
1501 { 1540 {
1502 // Create a tree with one window. 1541 // Create a tree with one window.
1503 WindowServerTestHelper ws_test_helper; 1542 WindowServerTestHelper ws_test_helper;
1504 WindowServer* window_server = ws_test_helper.window_server(); 1543 WindowServer* window_server = ws_test_helper.window_server();
1505 TestScreenManager screen_manager; 1544 TestScreenManager screen_manager;
(...skipping 232 matching lines...) Expand 10 before | Expand all | Expand 10 after
1738 EXPECT_TRUE(display_list.FindDisplayById(display_id2) == 1777 EXPECT_TRUE(display_list.FindDisplayById(display_id2) ==
1739 display_list.displays().end()); 1778 display_list.displays().end());
1740 ASSERT_TRUE(display_list.GetPrimaryDisplayIterator() != 1779 ASSERT_TRUE(display_list.GetPrimaryDisplayIterator() !=
1741 display_list.displays().end()); 1780 display_list.displays().end());
1742 EXPECT_EQ(display_id1, display_list.GetPrimaryDisplayIterator()->id()); 1781 EXPECT_EQ(display_id1, display_list.GetPrimaryDisplayIterator()->id());
1743 } 1782 }
1744 1783
1745 } // namespace test 1784 } // namespace test
1746 } // namespace ws 1785 } // namespace ws
1747 } // namespace ui 1786 } // namespace ui
OLDNEW
« no previous file with comments | « services/ui/ws/window_tree.cc ('k') | ui/aura/mus/window_tree_client.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698