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

Side by Side Diff: components/mus/ws/window_tree_apptest.cc

Issue 1465803003: mus: Let clients set the cursor of their window. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Sync pass the nacl breakage Created 5 years 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 "base/bind.h" 5 #include "base/bind.h"
6 #include "base/message_loop/message_loop.h" 6 #include "base/message_loop/message_loop.h"
7 #include "base/run_loop.h" 7 #include "base/run_loop.h"
8 #include "base/strings/stringprintf.h" 8 #include "base/strings/stringprintf.h"
9 #include "components/mus/public/interfaces/window_tree.mojom.h" 9 #include "components/mus/public/interfaces/window_tree.mojom.h"
10 #include "components/mus/public/interfaces/window_tree_host.mojom.h" 10 #include "components/mus/public/interfaces/window_tree_host.mojom.h"
(...skipping 335 matching lines...) Expand 10 before | Expand all | Expand 10 after
346 // Don't log input events as none of the tests care about them and they 346 // Don't log input events as none of the tests care about them and they
347 // may come in at random points. 347 // may come in at random points.
348 } 348 }
349 void OnWindowSharedPropertyChanged(uint32_t window, 349 void OnWindowSharedPropertyChanged(uint32_t window,
350 const String& name, 350 const String& name,
351 Array<uint8_t> new_data) override { 351 Array<uint8_t> new_data) override {
352 tracker_.OnWindowSharedPropertyChanged(window, name, new_data.Pass()); 352 tracker_.OnWindowSharedPropertyChanged(window, name, new_data.Pass());
353 } 353 }
354 // TODO(sky): add testing coverage. 354 // TODO(sky): add testing coverage.
355 void OnWindowFocused(uint32_t focused_window_id) override {} 355 void OnWindowFocused(uint32_t focused_window_id) override {}
356 void OnWindowCursorChanged(uint32 window_id,
357 mojom::Cursor cursor_id) override {
358 tracker_.OnWindowCursorChanged(window_id, cursor_id);
359 }
356 void OnChangeCompleted(uint32_t change_id, bool success) override { 360 void OnChangeCompleted(uint32_t change_id, bool success) override {
357 if (waiting_change_id_ == change_id && change_completed_run_loop_) { 361 if (waiting_change_id_ == change_id && change_completed_run_loop_) {
358 on_change_completed_result_ = success; 362 on_change_completed_result_ = success;
359 change_completed_run_loop_->Quit(); 363 change_completed_run_loop_->Quit();
360 } 364 }
361 } 365 }
362 void WmSetBounds(uint32_t change_id, 366 void WmSetBounds(uint32_t change_id,
363 Id window_id, 367 Id window_id,
364 mojo::RectPtr bounds) override {} 368 mojo::RectPtr bounds) override {}
365 void WmSetProperty(uint32_t change_id, 369 void WmSetProperty(uint32_t change_id,
(...skipping 1042 matching lines...) Expand 10 before | Expand all | Expand 10 after
1408 ASSERT_EQ(2u, windows.size()); 1412 ASSERT_EQ(2u, windows.size());
1409 EXPECT_EQ(WindowParentToString(window_1_1, root_window_id()) + 1413 EXPECT_EQ(WindowParentToString(window_1_1, root_window_id()) +
1410 " visible=true drawn=true", 1414 " visible=true drawn=true",
1411 windows[0].ToString2()); 1415 windows[0].ToString2());
1412 EXPECT_EQ(WindowParentToString(window_1_2, window_1_1) + 1416 EXPECT_EQ(WindowParentToString(window_1_2, window_1_1) +
1413 " visible=true drawn=true", 1417 " visible=true drawn=true",
1414 windows[1].ToString2()); 1418 windows[1].ToString2());
1415 } 1419 }
1416 } 1420 }
1417 1421
1422 // Test that we hear the cursor change in other connections.
1423 TEST_F(WindowTreeAppTest, SetCursor) {
1424 // Get a second connection to listen in.
1425 ASSERT_NO_FATAL_FAILURE(EstablishSecondConnection(true));
1426 Id window_1_1 = BuildWindowId(connection_id_1(), 1);
1427 changes2()->clear();
1428
1429 ws1()->SetStandardCursor(window_1_1, mojom::Cursor::CURSOR_IBEAM);
1430 ws_client2_->WaitForChangeCount(1u);
1431
1432 EXPECT_EQ("CursorChanged id=" + IdToString(window_1_1) + " cursor_id=4",
1433 SingleChangeToDescription(*changes2()));
1434 }
1435
1418 // Assertions for SetWindowVisibility sending notifications. 1436 // Assertions for SetWindowVisibility sending notifications.
1419 TEST_F(WindowTreeAppTest, SetWindowVisibilityNotifications) { 1437 TEST_F(WindowTreeAppTest, SetWindowVisibilityNotifications) {
1420 // Create 1,1 and 1,2. 1,2 is made a child of 1,1 and 1,1 a child of the root. 1438 // Create 1,1 and 1,2. 1,2 is made a child of 1,1 and 1,1 a child of the root.
1421 Id window_1_1 = ws_client1()->NewWindow(1); 1439 Id window_1_1 = ws_client1()->NewWindow(1);
1422 ASSERT_TRUE(window_1_1); 1440 ASSERT_TRUE(window_1_1);
1423 ASSERT_TRUE(SetWindowVisibility(ws1(), window_1_1, true)); 1441 ASSERT_TRUE(SetWindowVisibility(ws1(), window_1_1, true));
1424 Id window_1_2 = ws_client1()->NewWindow(2); 1442 Id window_1_2 = ws_client1()->NewWindow(2);
1425 ASSERT_TRUE(window_1_2); 1443 ASSERT_TRUE(window_1_2);
1426 ASSERT_TRUE(SetWindowVisibility(ws1(), window_1_2, true)); 1444 ASSERT_TRUE(SetWindowVisibility(ws1(), window_1_2, true));
1427 ASSERT_TRUE(AddWindow(ws1(), root_window_id(), window_1_1)); 1445 ASSERT_TRUE(AddWindow(ws1(), root_window_id(), window_1_1));
(...skipping 331 matching lines...) Expand 10 before | Expand all | Expand 10 after
1759 // originating connection. 1777 // originating connection.
1760 1778
1761 // TODO(sky): make sure coverage of what was 1779 // TODO(sky): make sure coverage of what was
1762 // WindowManagerTest.SecondEmbedRoot_InitService and 1780 // WindowManagerTest.SecondEmbedRoot_InitService and
1763 // WindowManagerTest.MultipleEmbedRootsBeforeWTHReady gets added to window 1781 // WindowManagerTest.MultipleEmbedRootsBeforeWTHReady gets added to window
1764 // manager 1782 // manager
1765 // tests. 1783 // tests.
1766 1784
1767 } // namespace ws 1785 } // namespace ws
1768 } // namespace mus 1786 } // namespace mus
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698