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

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

Issue 1605773004: mus: Implement Window Server Capture (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase Created 4 years, 10 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 <stddef.h> 5 #include <stddef.h>
6 #include <stdint.h> 6 #include <stdint.h>
7 7
8 #include "base/bind.h" 8 #include "base/bind.h"
9 #include "base/macros.h" 9 #include "base/macros.h"
10 #include "base/message_loop/message_loop.h" 10 #include "base/message_loop/message_loop.h"
(...skipping 273 matching lines...) Expand 10 before | Expand all | Expand 10 after
284 tree_ = std::move(tree); 284 tree_ = std::move(tree);
285 connection_id_ = connection_id; 285 connection_id_ = connection_id;
286 tracker()->OnEmbed(connection_id, std::move(root)); 286 tracker()->OnEmbed(connection_id, std::move(root));
287 if (embed_run_loop_) 287 if (embed_run_loop_)
288 embed_run_loop_->Quit(); 288 embed_run_loop_->Quit();
289 } 289 }
290 void OnEmbeddedAppDisconnected(Id window_id) override { 290 void OnEmbeddedAppDisconnected(Id window_id) override {
291 tracker()->OnEmbeddedAppDisconnected(window_id); 291 tracker()->OnEmbeddedAppDisconnected(window_id);
292 } 292 }
293 void OnUnembed(Id window_id) override { tracker()->OnUnembed(window_id); } 293 void OnUnembed(Id window_id) override { tracker()->OnUnembed(window_id); }
294 void OnLostCapture(Id window_id) override {
295 tracker()->OnLostCapture(window_id);
296 }
294 void OnTopLevelCreated(uint32_t change_id, 297 void OnTopLevelCreated(uint32_t change_id,
295 mojom::WindowDataPtr data) override { 298 mojom::WindowDataPtr data) override {
296 tracker()->OnTopLevelCreated(change_id, std::move(data)); 299 tracker()->OnTopLevelCreated(change_id, std::move(data));
297 } 300 }
298 void OnWindowBoundsChanged(Id window_id, 301 void OnWindowBoundsChanged(Id window_id,
299 RectPtr old_bounds, 302 RectPtr old_bounds,
300 RectPtr new_bounds) override { 303 RectPtr new_bounds) override {
301 // The bounds of the root may change during startup on Android at random 304 // The bounds of the root may change during startup on Android at random
302 // times. As this doesn't matter, and shouldn't impact test exepctations, 305 // times. As this doesn't matter, and shouldn't impact test exepctations,
303 // it is ignored. 306 // it is ignored.
(...skipping 1522 matching lines...) Expand 10 before | Expand all | Expand 10 after
1826 // Remove 2_101 from wm, client1 should see the change. 1829 // Remove 2_101 from wm, client1 should see the change.
1827 ws1()->RemoveWindowFromParent(12, window_2_101_in_ws1); 1830 ws1()->RemoveWindowFromParent(12, window_2_101_in_ws1);
1828 ASSERT_TRUE(ws_client1()->WaitForChangeCompleted(12)); 1831 ASSERT_TRUE(ws_client1()->WaitForChangeCompleted(12));
1829 ws_client2()->WaitForChangeCount(1); 1832 ws_client2()->WaitForChangeCount(1);
1830 EXPECT_EQ("HierarchyChanged window=" + IdToString(window_2_101) + 1833 EXPECT_EQ("HierarchyChanged window=" + IdToString(window_2_101) +
1831 " new_parent=null old_parent=" + 1834 " new_parent=null old_parent=" +
1832 IdToString(window_1_100_in_ws2), 1835 IdToString(window_1_100_in_ws2),
1833 SingleChangeToDescription(*changes2())); 1836 SingleChangeToDescription(*changes2()));
1834 } 1837 }
1835 1838
1839 // TODO(jonross): Enable this once apptests can send input events to the server.
1840 // Enabling capture requires that the connection be processing events.
1841 TEST_F(WindowTreeAppTest, DISABLED_ExplicitCapturePropagation) {
1842 Id window_1_1 = ws_client1()->NewWindow(1);
1843 Id window_1_2 = ws_client1()->NewWindow(2);
1844
1845 // Add the windows to the root, so that they have a WindowTreeHostImpl to
1846 // handle input capture.
1847 ASSERT_TRUE(ws_client1()->AddWindow(root_window_id(), window_1_1));
1848 ASSERT_TRUE(ws_client1()->AddWindow(root_window_id(), window_1_2));
1849
1850 changes1()->clear();
1851 // Window 1 takes capture then Window 2 takes capture.
1852 // Verify that window 1 has lost capture.
1853 ws1()->SetCapture(1, window_1_1);
1854 ws1()->SetCapture(2, window_1_2);
1855 ws_client1_->WaitForChangeCount(1);
1856
1857 EXPECT_EQ("OnLostCapture window=" + IdToString(window_1_1),
1858 SingleChangeToDescription(*changes1()));
1859
1860 changes1()->clear();
1861 // Explicitly releasing capture should not notify of lost capture.
1862 ws1()->ReleaseCapture(3, window_1_2);
1863 ws_client1_->WaitForAllMessages();
1864
1865 EXPECT_TRUE(changes1()->empty());
1866 }
1867
1836 // TODO(sky): need to better track changes to initial connection. For example, 1868 // TODO(sky): need to better track changes to initial connection. For example,
1837 // that SetBounsdWindows/AddWindow and the like don't result in messages to the 1869 // that SetBounsdWindows/AddWindow and the like don't result in messages to the
1838 // originating connection. 1870 // originating connection.
1839 1871
1840 // TODO(sky): make sure coverage of what was 1872 // TODO(sky): make sure coverage of what was
1841 // WindowManagerTest.SecondEmbedRoot_InitService and 1873 // WindowManagerTest.SecondEmbedRoot_InitService and
1842 // WindowManagerTest.MultipleEmbedRootsBeforeWTHReady gets added to window 1874 // WindowManagerTest.MultipleEmbedRootsBeforeWTHReady gets added to window
1843 // manager 1875 // manager
1844 // tests. 1876 // tests.
1845 1877
1846 } // namespace ws 1878 } // namespace ws
1847 } // namespace mus 1879 } // namespace mus
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698