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

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

Issue 10961021: Return primary display if out of bounds point or NULL ponter is passed to gfx::Screen::GeDisplayNea (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fix a few other tests that were using native coordinate. it shoud use screen coordinate now. Created 8 years, 3 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/multi_display_manager.cc ('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 a987cd5f6476c3dc727db9b6ff2ea4531e2c1f2d..67f29fb2fb1c290940c0a9dc4c69c1270027e64d 100644
--- a/ash/wm/workspace/workspace_window_resizer_unittest.cc
+++ b/ash/wm/workspace/workspace_window_resizer_unittest.cc
@@ -16,6 +16,7 @@
#include "ash/wm/workspace/snap_sizer.h"
#include "ash/wm/workspace/phantom_window_controller.h"
#include "base/string_number_conversions.h"
+#include "base/stringprintf.h"
#include "ui/aura/root_window.h"
#include "ui/aura/test/test_window_delegate.h"
#include "ui/base/hit_test.h"
@@ -58,11 +59,12 @@ class WorkspaceWindowResizerTest : public test::AshTestBase {
virtual void SetUp() OVERRIDE {
AshTestBase::SetUp();
- aura::RootWindow* root = Shell::GetPrimaryRootWindow();
- root->SetHostSize(gfx::Size(800, kRootHeight));
+ UpdateDisplay(StringPrintf("800x%d", kRootHeight));
+ aura::RootWindow* root = Shell::GetPrimaryRootWindow();
gfx::Rect root_bounds(root->bounds());
EXPECT_EQ(kRootHeight, root_bounds.height());
+ EXPECT_EQ(800, root_bounds.width());
Shell::GetInstance()->SetDisplayWorkAreaInsets(root, gfx::Insets());
window_.reset(new aura::Window(&delegate_));
window_->SetType(aura::client::WINDOW_TYPE_NORMAL);
@@ -491,16 +493,13 @@ TEST_F(WorkspaceWindowResizerTest, MAYBE_WindowDragWithMultiDisplays) {
window_.get(), gfx::Point(), HTCAPTION, empty_windows()));
ASSERT_TRUE(resizer.get());
// Drag the pointer to the right. Once it reaches the right edge of the
- // primary display, it warps to the secondary. Since the secondary root
- // window's native origin held by aura::RootWindowHost is (0, 600), and a
- // mouse drag event has a location in the primary root window's coordinates,
- // (810, 0) right means (10, 0) in the second root window's coordinates.
- resizer->Drag(CalculateDragPoint(*resizer, 810, 0), 0);
+ // primary display, it warps to the secondary.
+ resizer->Drag(CalculateDragPoint(*resizer, 800, 10), 0);
resizer->CompleteDrag(0);
// The whole window is on the secondary display now. The parent should be
// changed.
EXPECT_EQ(root_windows[1], window_->GetRootWindow());
- EXPECT_EQ("10,0 50x60", window_->bounds().ToString());
+ EXPECT_EQ("0,10 50x60", window_->bounds().ToString());
}
window_->SetBoundsInScreen(gfx::Rect(0, 0, 50, 60),
@@ -528,14 +527,13 @@ TEST_F(WorkspaceWindowResizerTest, MAYBE_WindowDragWithMultiDisplays) {
scoped_ptr<WorkspaceWindowResizer> resizer(WorkspaceWindowResizer::Create(
window_.get(), gfx::Point(49, 0), HTCAPTION, empty_windows()));
ASSERT_TRUE(resizer.get());
- resizer->Drag(CalculateDragPoint(*resizer, -49 + 800, 0),
- ui::EF_CONTROL_DOWN);
+ resizer->Drag(CalculateDragPoint(*resizer, 751, 10), ui::EF_CONTROL_DOWN);
resizer->CompleteDrag(0);
- // Since the pointer is on the secondary, the parent should not be changed
+ // Since the pointer is on the secondary, the parent should be changed
// even though only small fraction of the window is within the secondary
// root window's bounds.
EXPECT_EQ(root_windows[1], window_->GetRootWindow());
- EXPECT_EQ("-49,0 50x60", window_->bounds().ToString());
+ EXPECT_EQ("-49,10 50x60", window_->bounds().ToString());
}
}
@@ -557,8 +555,7 @@ TEST_F(WorkspaceWindowResizerTest,
window_.get(), gfx::Point(), HTCAPTION, empty_windows()));
ASSERT_TRUE(resizer.get());
// Move the mouse near the right edge, (798, 0), of the primary display.
- resizer->Drag(CalculateDragPoint(*resizer, -2, 0),
- ui::EF_CONTROL_DOWN);
+ resizer->Drag(CalculateDragPoint(*resizer, -2, 0), ui::EF_CONTROL_DOWN);
resizer->CompleteDrag(0);
EXPECT_EQ(root_windows[0], window_->GetRootWindow());
EXPECT_EQ("798,0 50x60", window_->bounds().ToString());
@@ -607,7 +604,7 @@ TEST_F(WorkspaceWindowResizerTest, MAYBE_PhantomStyle) {
EXPECT_GT(1.0f, controller->GetOpacity());
// Enter the pointer to the secondary display.
- resizer->Drag(CalculateDragPoint(*resizer, 810, 0), 0);
+ resizer->Drag(CalculateDragPoint(*resizer, 800, 10), 0);
EXPECT_FALSE(resizer->snap_phantom_window_controller_.get());
controller = resizer->drag_phantom_window_controller_.get();
ASSERT_TRUE(controller);
« no previous file with comments | « ash/display/multi_display_manager.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698