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

Unified Diff: ui/views/mus/desktop_window_tree_host_mus_unittest.cc

Issue 2626013005: Change CaptureSynchronizer and PointerWatcherEventRouter to support multiple CaptureClients. (Closed)
Patch Set: fix leak in test Created 3 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
« no previous file with comments | « ui/views/mus/desktop_window_tree_host_mus.cc ('k') | ui/views/mus/mus_client.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/views/mus/desktop_window_tree_host_mus_unittest.cc
diff --git a/ui/views/mus/desktop_window_tree_host_mus_unittest.cc b/ui/views/mus/desktop_window_tree_host_mus_unittest.cc
index 1620c58655c6598879e4bb11d6cd2c613c2e9cb4..394abfa46cbafa9eed03b264f176aaf3d142e6ae 100644
--- a/ui/views/mus/desktop_window_tree_host_mus_unittest.cc
+++ b/ui/views/mus/desktop_window_tree_host_mus_unittest.cc
@@ -9,7 +9,10 @@
#include "base/memory/ptr_util.h"
#include "ui/aura/client/cursor_client.h"
#include "ui/aura/client/transient_window_client.h"
+#include "ui/aura/mus/capture_synchronizer.h"
#include "ui/aura/mus/in_flight_change.h"
+#include "ui/aura/mus/window_mus.h"
+#include "ui/aura/mus/window_tree_client.h"
#include "ui/aura/test/mus/change_completion_waiter.h"
#include "ui/aura/window.h"
#include "ui/views/mus/mus_client.h"
@@ -124,6 +127,50 @@ TEST_F(DesktopWindowTreeHostMusTest, Visibility) {
EXPECT_FALSE(widget->GetNativeView()->parent()->IsVisible());
}
+TEST_F(DesktopWindowTreeHostMusTest, Capture) {
+ std::unique_ptr<Widget> widget1(CreateWidget());
+ widget1->Show();
+ EXPECT_FALSE(widget1->HasCapture());
+
+ std::unique_ptr<Widget> widget2(CreateWidget());
+ widget2->Show();
+ EXPECT_FALSE(widget2->HasCapture());
+
+ widget1->SetCapture(widget1->GetRootView());
+ EXPECT_TRUE(widget1->HasCapture());
+ EXPECT_FALSE(widget2->HasCapture());
+ EXPECT_EQ(widget1->GetNativeWindow(), MusClient::Get()
+ ->window_tree_client()
+ ->capture_synchronizer()
+ ->capture_window()
+ ->GetWindow());
+
+ widget2->SetCapture(widget2->GetRootView());
+ EXPECT_TRUE(widget2->HasCapture());
+ EXPECT_EQ(widget2->GetNativeWindow(), MusClient::Get()
+ ->window_tree_client()
+ ->capture_synchronizer()
+ ->capture_window()
+ ->GetWindow());
+
+ widget1->ReleaseCapture();
+ EXPECT_TRUE(widget2->HasCapture());
+ EXPECT_FALSE(widget1->HasCapture());
+ EXPECT_EQ(widget2->GetNativeWindow(), MusClient::Get()
+ ->window_tree_client()
+ ->capture_synchronizer()
+ ->capture_window()
+ ->GetWindow());
+
+ widget2->ReleaseCapture();
+ EXPECT_FALSE(widget2->HasCapture());
+ EXPECT_FALSE(widget1->HasCapture());
+ EXPECT_EQ(nullptr, MusClient::Get()
+ ->window_tree_client()
+ ->capture_synchronizer()
+ ->capture_window());
+}
+
TEST_F(DesktopWindowTreeHostMusTest, Deactivate) {
std::unique_ptr<Widget> widget1(CreateWidget());
widget1->Show();
« no previous file with comments | « ui/views/mus/desktop_window_tree_host_mus.cc ('k') | ui/views/mus/mus_client.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698