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 266 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
277 tree_ = std::move(tree); | 277 tree_ = std::move(tree); |
278 connection_id_ = connection_id; | 278 connection_id_ = connection_id; |
279 tracker()->OnEmbed(connection_id, std::move(root)); | 279 tracker()->OnEmbed(connection_id, std::move(root)); |
280 if (embed_run_loop_) | 280 if (embed_run_loop_) |
281 embed_run_loop_->Quit(); | 281 embed_run_loop_->Quit(); |
282 } | 282 } |
283 void OnEmbeddedAppDisconnected(Id window_id) override { | 283 void OnEmbeddedAppDisconnected(Id window_id) override { |
284 tracker()->OnEmbeddedAppDisconnected(window_id); | 284 tracker()->OnEmbeddedAppDisconnected(window_id); |
285 } | 285 } |
286 void OnUnembed(Id window_id) override { tracker()->OnUnembed(window_id); } | 286 void OnUnembed(Id window_id) override { tracker()->OnUnembed(window_id); } |
| 287 void OnLostCapture(Id window_id) override { |
| 288 tracker()->OnLostCapture(window_id); |
| 289 } |
287 void OnTopLevelCreated(uint32_t change_id, | 290 void OnTopLevelCreated(uint32_t change_id, |
288 mojom::WindowDataPtr data) override { | 291 mojom::WindowDataPtr data) override { |
289 tracker()->OnTopLevelCreated(change_id, std::move(data)); | 292 tracker()->OnTopLevelCreated(change_id, std::move(data)); |
290 } | 293 } |
291 void OnWindowBoundsChanged(Id window_id, | 294 void OnWindowBoundsChanged(Id window_id, |
292 RectPtr old_bounds, | 295 RectPtr old_bounds, |
293 RectPtr new_bounds) override { | 296 RectPtr new_bounds) override { |
294 // The bounds of the root may change during startup on Android at random | 297 // The bounds of the root may change during startup on Android at random |
295 // times. As this doesn't matter, and shouldn't impact test exepctations, | 298 // times. As this doesn't matter, and shouldn't impact test exepctations, |
296 // it is ignored. | 299 // it is ignored. |
(...skipping 1466 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1763 | 1766 |
1764 changes1()->clear(); | 1767 changes1()->clear(); |
1765 ASSERT_TRUE(ws_client2()->DeleteWindow(window_2_1)); | 1768 ASSERT_TRUE(ws_client2()->DeleteWindow(window_2_1)); |
1766 ws_client1()->WaitForChangeCount(2); | 1769 ws_client1()->WaitForChangeCount(2); |
1767 EXPECT_EQ("WindowDeleted window=" + IdToString(window_2_2), | 1770 EXPECT_EQ("WindowDeleted window=" + IdToString(window_2_2), |
1768 ChangesToDescription1(*changes1())[0]); | 1771 ChangesToDescription1(*changes1())[0]); |
1769 EXPECT_EQ("WindowDeleted window=" + IdToString(window_2_1), | 1772 EXPECT_EQ("WindowDeleted window=" + IdToString(window_2_1), |
1770 ChangesToDescription1(*changes1())[1]); | 1773 ChangesToDescription1(*changes1())[1]); |
1771 } | 1774 } |
1772 | 1775 |
| 1776 TEST_F(WindowTreeAppTest, ExplicitCapturePropagation) { |
| 1777 Id window_1_1 = ws_client1()->NewWindow(1); |
| 1778 Id window_1_2 = ws_client1()->NewWindow(2); |
| 1779 |
| 1780 // Add the windows to the root, so that they have a WindowTreeHostImpl to |
| 1781 // handle input capture. |
| 1782 ASSERT_TRUE(ws_client1()->AddWindow(root_window_id(), window_1_1)); |
| 1783 ASSERT_TRUE(ws_client1()->AddWindow(root_window_id(), window_1_2)); |
| 1784 |
| 1785 changes1()->clear(); |
| 1786 // Window 1 takes capture then Window 2 takes capture. |
| 1787 // Verify that window 1 has lost capture. |
| 1788 ws1()->SetCapture(1, window_1_1); |
| 1789 ws1()->SetCapture(2, window_1_2); |
| 1790 ws_client1_->WaitForChangeCount(1); |
| 1791 |
| 1792 EXPECT_EQ("OnLostCapture window=" + IdToString(window_1_1), |
| 1793 SingleChangeToDescription(*changes1())); |
| 1794 changes1()->clear(); |
| 1795 ws1()->ReleaseCapture(3, window_1_2); |
| 1796 ws_client1_->WaitForChangeCount(1); |
| 1797 |
| 1798 EXPECT_EQ("OnLostCapture window=" + IdToString(window_1_2), |
| 1799 SingleChangeToDescription(*changes1())); |
| 1800 } |
| 1801 |
1773 // TODO(sky): need to better track changes to initial connection. For example, | 1802 // TODO(sky): need to better track changes to initial connection. For example, |
1774 // that SetBounsdWindows/AddWindow and the like don't result in messages to the | 1803 // that SetBounsdWindows/AddWindow and the like don't result in messages to the |
1775 // originating connection. | 1804 // originating connection. |
1776 | 1805 |
1777 // TODO(sky): make sure coverage of what was | 1806 // TODO(sky): make sure coverage of what was |
1778 // WindowManagerTest.SecondEmbedRoot_InitService and | 1807 // WindowManagerTest.SecondEmbedRoot_InitService and |
1779 // WindowManagerTest.MultipleEmbedRootsBeforeWTHReady gets added to window | 1808 // WindowManagerTest.MultipleEmbedRootsBeforeWTHReady gets added to window |
1780 // manager | 1809 // manager |
1781 // tests. | 1810 // tests. |
1782 | 1811 |
1783 } // namespace ws | 1812 } // namespace ws |
1784 } // namespace mus | 1813 } // namespace mus |
OLD | NEW |