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

Unified 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: Address Original Review Comments Created 4 years, 11 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 side-by-side diff with in-line comments
Download patch
Index: components/mus/ws/window_tree_apptest.cc
diff --git a/components/mus/ws/window_tree_apptest.cc b/components/mus/ws/window_tree_apptest.cc
index 58dc59bc3792fb0eb7a4ab3a1c02ca89d78ad586..bdf4e4e261c897b4d89ccd551de8aa9043f35501 100644
--- a/components/mus/ws/window_tree_apptest.cc
+++ b/components/mus/ws/window_tree_apptest.cc
@@ -284,6 +284,9 @@ class TestWindowTreeClientImpl : public mojom::WindowTreeClient,
tracker()->OnEmbeddedAppDisconnected(window_id);
}
void OnUnembed(Id window_id) override { tracker()->OnUnembed(window_id); }
+ void OnLostCapture(Id window_id) override {
+ tracker()->OnLostCapture(window_id);
+ }
void OnTopLevelCreated(uint32_t change_id,
mojom::WindowDataPtr data) override {
tracker()->OnTopLevelCreated(change_id, std::move(data));
@@ -1770,6 +1773,32 @@ TEST_F(WindowTreeAppTest, TransientWindowTracksTransientParentLifetime) {
ChangesToDescription1(*changes1())[1]);
}
+TEST_F(WindowTreeAppTest, ExplicitCapturePropagation) {
+ Id window_1_1 = ws_client1()->NewWindow(1);
+ Id window_1_2 = ws_client1()->NewWindow(2);
+
+ // Add the windows to the root, so that they have a WindowTreeHostImpl to
+ // handle input capture.
+ ASSERT_TRUE(ws_client1()->AddWindow(root_window_id(), window_1_1));
+ ASSERT_TRUE(ws_client1()->AddWindow(root_window_id(), window_1_2));
+
+ changes1()->clear();
+ // Window 1 takes capture then Window 2 takes capture.
+ // Verify that window 1 has lost capture.
+ ws1()->SetCapture(1, window_1_1);
+ ws1()->SetCapture(2, window_1_2);
+ ws_client1_->WaitForChangeCount(1);
+
+ EXPECT_EQ("OnLostCapture window=" + IdToString(window_1_1),
+ SingleChangeToDescription(*changes1()));
+ changes1()->clear();
+ ws1()->ReleaseCapture(3, window_1_2);
+ ws_client1_->WaitForChangeCount(1);
+
+ EXPECT_EQ("OnLostCapture window=" + IdToString(window_1_2),
+ SingleChangeToDescription(*changes1()));
+}
+
// TODO(sky): need to better track changes to initial connection. For example,
// that SetBounsdWindows/AddWindow and the like don't result in messages to the
// originating connection.

Powered by Google App Engine
This is Rietveld 408576698