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

Unified Diff: ash/wm/workspace/workspace_window_resizer_unittest.cc

Issue 10826240: Add a unit test which verifies if the resizer sets/resets DisplayController::dont_warp_mouse_ as ex… (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: review Created 8 years, 4 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/display/display_controller.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ash/wm/workspace/workspace_window_resizer_unittest.cc
diff --git a/ash/wm/workspace/workspace_window_resizer_unittest.cc b/ash/wm/workspace/workspace_window_resizer_unittest.cc
index 72eca4b06ca73666952ed7a40de474e3d42a952d..017c459ac20c40a42cdd2ad88e1b4f336634a655 100644
--- a/ash/wm/workspace/workspace_window_resizer_unittest.cc
+++ b/ash/wm/workspace/workspace_window_resizer_unittest.cc
@@ -4,6 +4,7 @@
#include "ash/wm/workspace/workspace_window_resizer.h"
+#include "ash/display/display_controller.h"
#include "ash/screen_ash.h"
#include "ash/shell.h"
#include "ash/shell_window_ids.h"
@@ -646,6 +647,49 @@ TEST_F(WorkspaceWindowResizerTest, MAYBE_PhantomStyle) {
}
}
+// Verifies if the resizer sets and resets DisplayController::dont_warp_mouse_
+// as expected.
+TEST_F(WorkspaceWindowResizerTest, WarpMousePointer) {
+ DisplayController* controller = Shell::GetInstance()->display_controller();
+ ASSERT_TRUE(controller);
+ window_->SetBounds(gfx::Rect(0, 0, 50, 60));
+
+ EXPECT_FALSE(controller->dont_warp_mouse_);
+ {
+ scoped_ptr<WorkspaceWindowResizer> resizer(WorkspaceWindowResizer::Create(
+ window_.get(), gfx::Point(), HTCAPTION, empty_windows()));
+ // While dragging a window, warp should be allowed.
+ EXPECT_FALSE(controller->dont_warp_mouse_);
+ resizer->CompleteDrag(0);
+ }
+ EXPECT_FALSE(controller->dont_warp_mouse_);
+
+ {
+ scoped_ptr<WorkspaceWindowResizer> resizer(WorkspaceWindowResizer::Create(
+ window_.get(), gfx::Point(), HTCAPTION, empty_windows()));
+ EXPECT_FALSE(controller->dont_warp_mouse_);
+ resizer->RevertDrag();
+ }
+ EXPECT_FALSE(controller->dont_warp_mouse_);
+
+ {
+ scoped_ptr<WorkspaceWindowResizer> resizer(WorkspaceWindowResizer::Create(
+ window_.get(), gfx::Point(), HTRIGHT, empty_windows()));
+ // While resizing a window, warp should NOT be allowed.
+ EXPECT_TRUE(controller->dont_warp_mouse_);
+ resizer->CompleteDrag(0);
+ }
+ EXPECT_FALSE(controller->dont_warp_mouse_);
+
+ {
+ scoped_ptr<WorkspaceWindowResizer> resizer(WorkspaceWindowResizer::Create(
+ window_.get(), gfx::Point(), HTRIGHT, empty_windows()));
+ EXPECT_TRUE(controller->dont_warp_mouse_);
+ resizer->RevertDrag();
+ }
+ EXPECT_FALSE(controller->dont_warp_mouse_);
+}
+
// Verifies windows are correctly restacked when reordering multiple windows.
TEST_F(WorkspaceWindowResizerTest, RestackAttached) {
window_->SetBounds(gfx::Rect( 0, 0, 200, 300));
« no previous file with comments | « ash/display/display_controller.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698