| 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 <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 275 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 286 tree_ = std::move(tree); | 286 tree_ = std::move(tree); |
| 287 connection_id_ = connection_id; | 287 connection_id_ = connection_id; |
| 288 tracker()->OnEmbed(connection_id, std::move(root)); | 288 tracker()->OnEmbed(connection_id, std::move(root)); |
| 289 if (embed_run_loop_) | 289 if (embed_run_loop_) |
| 290 embed_run_loop_->Quit(); | 290 embed_run_loop_->Quit(); |
| 291 } | 291 } |
| 292 void OnEmbeddedAppDisconnected(Id window_id) override { | 292 void OnEmbeddedAppDisconnected(Id window_id) override { |
| 293 tracker()->OnEmbeddedAppDisconnected(window_id); | 293 tracker()->OnEmbeddedAppDisconnected(window_id); |
| 294 } | 294 } |
| 295 void OnUnembed(Id window_id) override { tracker()->OnUnembed(window_id); } | 295 void OnUnembed(Id window_id) override { tracker()->OnUnembed(window_id); } |
| 296 void OnLostCapture(Id window_id) override { |
| 297 tracker()->OnLostCapture(window_id); |
| 298 } |
| 296 void OnTopLevelCreated(uint32_t change_id, | 299 void OnTopLevelCreated(uint32_t change_id, |
| 297 mojom::WindowDataPtr data) override { | 300 mojom::WindowDataPtr data) override { |
| 298 tracker()->OnTopLevelCreated(change_id, std::move(data)); | 301 tracker()->OnTopLevelCreated(change_id, std::move(data)); |
| 299 } | 302 } |
| 300 void OnWindowBoundsChanged(Id window_id, | 303 void OnWindowBoundsChanged(Id window_id, |
| 301 RectPtr old_bounds, | 304 RectPtr old_bounds, |
| 302 RectPtr new_bounds) override { | 305 RectPtr new_bounds) override { |
| 303 // The bounds of the root may change during startup on Android at random | 306 // The bounds of the root may change during startup on Android at random |
| 304 // times. As this doesn't matter, and shouldn't impact test exepctations, | 307 // times. As this doesn't matter, and shouldn't impact test exepctations, |
| 305 // it is ignored. | 308 // it is ignored. |
| (...skipping 1550 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1856 // Remove 2_101 from wm, client1 should see the change. | 1859 // Remove 2_101 from wm, client1 should see the change. |
| 1857 ws1()->RemoveWindowFromParent(12, window_2_101_in_ws1); | 1860 ws1()->RemoveWindowFromParent(12, window_2_101_in_ws1); |
| 1858 ASSERT_TRUE(ws_client1()->WaitForChangeCompleted(12)); | 1861 ASSERT_TRUE(ws_client1()->WaitForChangeCompleted(12)); |
| 1859 ws_client2()->WaitForChangeCount(1); | 1862 ws_client2()->WaitForChangeCount(1); |
| 1860 EXPECT_EQ("HierarchyChanged window=" + IdToString(window_2_101) + | 1863 EXPECT_EQ("HierarchyChanged window=" + IdToString(window_2_101) + |
| 1861 " new_parent=null old_parent=" + | 1864 " new_parent=null old_parent=" + |
| 1862 IdToString(window_1_100_in_ws2), | 1865 IdToString(window_1_100_in_ws2), |
| 1863 SingleChangeToDescription(*changes2())); | 1866 SingleChangeToDescription(*changes2())); |
| 1864 } | 1867 } |
| 1865 | 1868 |
| 1869 // TODO(jonross): Enable this once apptests can send input events to the server. |
| 1870 // Enabling capture requires that the connection be processing events. |
| 1871 TEST_F(WindowTreeAppTest, DISABLED_ExplicitCapturePropagation) { |
| 1872 Id window_1_1 = ws_client1()->NewWindow(1); |
| 1873 Id window_1_2 = ws_client1()->NewWindow(2); |
| 1874 |
| 1875 // Add the windows to the root, so that they have a WindowTreeHostImpl to |
| 1876 // handle input capture. |
| 1877 ASSERT_TRUE(ws_client1()->AddWindow(root_window_id(), window_1_1)); |
| 1878 ASSERT_TRUE(ws_client1()->AddWindow(root_window_id(), window_1_2)); |
| 1879 |
| 1880 changes1()->clear(); |
| 1881 // Window 1 takes capture then Window 2 takes capture. |
| 1882 // Verify that window 1 has lost capture. |
| 1883 ws1()->SetCapture(1, window_1_1); |
| 1884 ws1()->SetCapture(2, window_1_2); |
| 1885 ws_client1_->WaitForChangeCount(1); |
| 1886 |
| 1887 EXPECT_EQ("OnLostCapture window=" + IdToString(window_1_1), |
| 1888 SingleChangeToDescription(*changes1())); |
| 1889 |
| 1890 changes1()->clear(); |
| 1891 // Explicitly releasing capture should not notify of lost capture. |
| 1892 ws1()->ReleaseCapture(3, window_1_2); |
| 1893 ws_client1_->WaitForAllMessages(); |
| 1894 |
| 1895 EXPECT_TRUE(changes1()->empty()); |
| 1896 } |
| 1897 |
| 1866 // TODO(sky): need to better track changes to initial connection. For example, | 1898 // TODO(sky): need to better track changes to initial connection. For example, |
| 1867 // that SetBounsdWindows/AddWindow and the like don't result in messages to the | 1899 // that SetBounsdWindows/AddWindow and the like don't result in messages to the |
| 1868 // originating connection. | 1900 // originating connection. |
| 1869 | 1901 |
| 1870 // TODO(sky): make sure coverage of what was | 1902 // TODO(sky): make sure coverage of what was |
| 1871 // WindowManagerTest.SecondEmbedRoot_InitService and | 1903 // WindowManagerTest.SecondEmbedRoot_InitService and |
| 1872 // WindowManagerTest.MultipleEmbedRootsBeforeWTHReady gets added to window | 1904 // WindowManagerTest.MultipleEmbedRootsBeforeWTHReady gets added to window |
| 1873 // manager | 1905 // manager |
| 1874 // tests. | 1906 // tests. |
| 1875 | 1907 |
| 1876 } // namespace ws | 1908 } // namespace ws |
| 1877 } // namespace mus | 1909 } // namespace mus |
| OLD | NEW |