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

Unified Diff: ash/wm/toplevel_window_event_handler_unittest.cc

Issue 354343002: [M-37]: Fix dragging tab via mouse when touch is down on ChromeOS (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 5 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 | « ash/wm/toplevel_window_event_handler.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ash/wm/toplevel_window_event_handler_unittest.cc
diff --git a/ash/wm/toplevel_window_event_handler_unittest.cc b/ash/wm/toplevel_window_event_handler_unittest.cc
index 3aa25ba7d8b8a1ed02bcf5845b8574eedef11951..74497f7be2b21a89e3a308b432397550c586bf46 100644
--- a/ash/wm/toplevel_window_event_handler_unittest.cc
+++ b/ash/wm/toplevel_window_event_handler_unittest.cc
@@ -16,6 +16,7 @@
#include "ash/wm/workspace_controller.h"
#include "base/basictypes.h"
#include "base/compiler_specific.h"
+#include "base/message_loop/message_loop.h"
#include "testing/gtest/include/gtest/gtest.h"
#include "ui/aura/client/aura_constants.h"
#include "ui/aura/test/aura_test_base.h"
@@ -705,6 +706,37 @@ TEST_F(ToplevelWindowEventHandlerTest, RunMoveLoopFailsDuringInProgressDrag) {
EXPECT_EQ("10,11 100x100", window1->bounds().ToString());
}
+namespace {
+
+void SendMouseReleaseAndReleaseCapture(aura::test::EventGenerator* generator,
+ aura::Window* window) {
+ generator->ReleaseLeftButton();
+ window->ReleaseCapture();
+}
+
+} // namespace
+
+// Test that a drag is successful even if ET_MOUSE_CAPTURE_CHANGED is sent
+// immediately after the mouse release. views::Widget has this behavior.
+TEST_F(ToplevelWindowEventHandlerTest, CaptureLossAfterMouseRelease) {
+ scoped_ptr<aura::Window> window(CreateWindow(HTNOWHERE));
+ aura::test::EventGenerator generator(Shell::GetPrimaryRootWindow(),
+ window.get());
+ generator.PressLeftButton();
+ window->SetCapture();
+
+ aura::client::WindowMoveClient* move_client =
+ aura::client::GetWindowMoveClient(window->GetRootWindow());
+ base::MessageLoopForUI::current()->PostTask(
+ FROM_HERE,
+ base::Bind(&SendMouseReleaseAndReleaseCapture,
+ base::Unretained(&generator),
+ base::Unretained(window.get())));
+ EXPECT_EQ(aura::client::MOVE_SUCCESSFUL,
+ move_client->RunMoveLoop(window.get(), gfx::Vector2d(),
+ aura::client::WINDOW_MOVE_SOURCE_MOUSE));
+}
+
// Showing the resize shadows when the mouse is over the window edges is tested
// in resize_shadow_and_cursor_test.cc
« no previous file with comments | « ash/wm/toplevel_window_event_handler.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698