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

Unified Diff: ui/wm/core/capture_controller_unittest.cc

Issue 2466023003: Makes CaptureController be created and owned by WMState (Closed)
Patch Set: moar Created 4 years, 1 month 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/wm/core/capture_controller.cc ('k') | ui/wm/core/wm_state.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/wm/core/capture_controller_unittest.cc
diff --git a/ui/wm/core/capture_controller_unittest.cc b/ui/wm/core/capture_controller_unittest.cc
index 6268e0a0bcd2493c082adda901bd052217412bdf..1996f2f7f925c9cfe4d833f804d4929e4c50f464 100644
--- a/ui/wm/core/capture_controller_unittest.cc
+++ b/ui/wm/core/capture_controller_unittest.cc
@@ -96,11 +96,7 @@ class CaptureControllerTest : public aura::test::AuraTestBase {
}
aura::Window* GetCaptureWindow() {
- return capture_controller_->capture_client()->GetCaptureWindow();
- }
-
- aura::Window* GetSecondCaptureWindow() {
- return second_capture_controller_->capture_client()->GetCaptureWindow();
+ return CaptureController::Get()->GetCaptureWindow();
}
std::unique_ptr<ScopedCaptureClient> capture_controller_;
@@ -141,17 +137,13 @@ TEST_F(CaptureControllerTest, ResetOtherWindowCaptureOnCapture) {
// Create a window inside the WindowEventDispatcher.
std::unique_ptr<aura::Window> w1(CreateNormalWindow(1, root_window(), NULL));
w1->SetCapture();
- // Both capture clients should return the same capture window.
EXPECT_EQ(w1.get(), GetCaptureWindow());
- EXPECT_EQ(w1.get(), GetSecondCaptureWindow());
// Build a window in the second WindowEventDispatcher and give it capture.
- // Both capture clients should return the same capture window.
std::unique_ptr<aura::Window> w2(
CreateNormalWindow(2, second_host_->window(), NULL));
w2->SetCapture();
EXPECT_EQ(w2.get(), GetCaptureWindow());
- EXPECT_EQ(w2.get(), GetSecondCaptureWindow());
}
// Verifies the touch target for the WindowEventDispatcher gets reset on
@@ -162,24 +154,19 @@ TEST_F(CaptureControllerTest, TouchTargetResetOnCaptureChange) {
ui::test::EventGenerator event_generator1(root_window());
event_generator1.PressTouch();
w1->SetCapture();
- // Both capture clients should return the same capture window.
EXPECT_EQ(w1.get(), GetCaptureWindow());
- EXPECT_EQ(w1.get(), GetSecondCaptureWindow());
// Build a window in the second WindowEventDispatcher and give it capture.
- // Both capture clients should return the same capture window.
std::unique_ptr<aura::Window> w2(
CreateNormalWindow(2, second_host_->window(), NULL));
w2->SetCapture();
EXPECT_EQ(w2.get(), GetCaptureWindow());
- EXPECT_EQ(w2.get(), GetSecondCaptureWindow());
// Release capture on the window. Releasing capture should reset the touch
// target of the first WindowEventDispatcher (as it no longer contains the
// capture target).
w2->ReleaseCapture();
- EXPECT_EQ(static_cast<aura::Window*>(NULL), GetCaptureWindow());
- EXPECT_EQ(static_cast<aura::Window*>(NULL), GetSecondCaptureWindow());
+ EXPECT_EQ(nullptr, GetCaptureWindow());
}
// Test that native capture is released properly when the window with capture
@@ -195,19 +182,16 @@ TEST_F(CaptureControllerTest, ReparentedWhileCaptured) {
std::unique_ptr<aura::Window> w(CreateNormalWindow(1, root_window(), NULL));
w->SetCapture();
EXPECT_EQ(w.get(), GetCaptureWindow());
- EXPECT_EQ(w.get(), GetSecondCaptureWindow());
EXPECT_TRUE(delegate->HasNativeCapture());
EXPECT_FALSE(delegate2->HasNativeCapture());
second_host_->window()->AddChild(w.get());
EXPECT_EQ(w.get(), GetCaptureWindow());
- EXPECT_EQ(w.get(), GetSecondCaptureWindow());
EXPECT_TRUE(delegate->HasNativeCapture());
EXPECT_FALSE(delegate2->HasNativeCapture());
w->ReleaseCapture();
EXPECT_EQ(nullptr, GetCaptureWindow());
- EXPECT_EQ(nullptr, GetSecondCaptureWindow());
EXPECT_FALSE(delegate->HasNativeCapture());
EXPECT_FALSE(delegate2->HasNativeCapture());
}
« no previous file with comments | « ui/wm/core/capture_controller.cc ('k') | ui/wm/core/wm_state.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698