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

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

Issue 11280283: Extract the code of showing a dragging window on another display from PhantomWindowController. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: assign NULL after deleting Layer Created 8 years 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/workspace/workspace_window_resizer.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 b7c8eb04c5699344b9f3a1ad1918ffc64bf7743a..58ca53f83f442c366a8d9a6ee010302c5eb0d8d4 100644
--- a/ash/wm/workspace/workspace_window_resizer_unittest.cc
+++ b/ash/wm/workspace/workspace_window_resizer_unittest.cc
@@ -13,12 +13,13 @@
#include "ash/test/ash_test_base.h"
#include "ash/test/cursor_manager_test_api.h"
#include "ash/wm/cursor_manager.h"
+#include "ash/wm/drag_window_controller.h"
#include "ash/wm/property_util.h"
#include "ash/wm/shelf_layout_manager.h"
#include "ash/wm/window_util.h"
-#include "ash/wm/workspace_controller.h"
-#include "ash/wm/workspace/snap_sizer.h"
#include "ash/wm/workspace/phantom_window_controller.h"
+#include "ash/wm/workspace/snap_sizer.h"
+#include "ash/wm/workspace_controller.h"
#include "base/string_number_conversions.h"
#include "base/stringprintf.h"
#include "ui/aura/client/aura_constants.h"
@@ -607,8 +608,8 @@ TEST_F(WorkspaceWindowResizerTest,
}
}
-// Verifies the style of the drag phantom window is correct.
-TEST_F(WorkspaceWindowResizerTest, PhantomStyle) {
+// Verifies the drag window controller is instanciated appropriately.
+TEST_F(WorkspaceWindowResizerTest, DragWindowController) {
UpdateDisplay("800x600,800x600");
Shell::RootWindowList root_windows = Shell::GetAllRootWindows();
ASSERT_EQ(2U, root_windows.size());
@@ -622,41 +623,42 @@ TEST_F(WorkspaceWindowResizerTest, PhantomStyle) {
window_.get(), gfx::Point(), HTCAPTION, empty_windows()));
ASSERT_TRUE(resizer.get());
EXPECT_FALSE(resizer->snap_phantom_window_controller_.get());
- EXPECT_FALSE(resizer->drag_phantom_window_controller_.get());
+ EXPECT_FALSE(resizer->drag_window_controller_.get());
// The pointer is inside the primary root. Both phantoms should be NULL.
resizer->Drag(CalculateDragPoint(*resizer, 10, 10), 0);
EXPECT_FALSE(resizer->snap_phantom_window_controller_.get());
- EXPECT_FALSE(resizer->drag_phantom_window_controller_.get());
+ EXPECT_FALSE(resizer->drag_window_controller_.get());
// The window spans both root windows.
resizer->Drag(CalculateDragPoint(*resizer, 798, 10), 0);
EXPECT_FALSE(resizer->snap_phantom_window_controller_.get());
- PhantomWindowController* controller =
- resizer->drag_phantom_window_controller_.get();
+ DragWindowController* controller =
+ resizer->drag_window_controller_.get();
ASSERT_TRUE(controller);
- EXPECT_EQ(PhantomWindowController::STYLE_DRAGGING, controller->style());
+ ASSERT_TRUE(controller->drag_widget_);
+ ui::Layer* drag_layer =
+ controller->drag_widget_->GetNativeWindow()->layer();
+ ASSERT_TRUE(drag_layer);
// Check if |resizer->layer_| is properly set to the phantom widget.
- const std::vector<ui::Layer*>& layers =
- controller->phantom_widget_->GetNativeWindow()->layer()->children();
+ const std::vector<ui::Layer*>& layers = drag_layer->children();
EXPECT_FALSE(layers.empty());
- EXPECT_EQ(resizer->layer_, layers.back());
+ EXPECT_EQ(controller->layer_, layers.back());
// |window_| should be opaque since the pointer is still on the primary
// root window. The phantom should be semi-transparent.
EXPECT_FLOAT_EQ(1.0f, window_->layer()->opacity());
- EXPECT_GT(1.0f, controller->GetOpacity());
+ EXPECT_GT(1.0f, drag_layer->opacity());
// Enter the pointer to the secondary display.
resizer->Drag(CalculateDragPoint(*resizer, 800, 10), 0);
EXPECT_FALSE(resizer->snap_phantom_window_controller_.get());
- controller = resizer->drag_phantom_window_controller_.get();
+ controller = resizer->drag_window_controller_.get();
ASSERT_TRUE(controller);
- EXPECT_EQ(PhantomWindowController::STYLE_DRAGGING, controller->style());
// |window_| should be transparent, and the phantom should be opaque.
EXPECT_GT(1.0f, window_->layer()->opacity());
- EXPECT_FLOAT_EQ(1.0f, controller->GetOpacity());
+ EXPECT_FLOAT_EQ(1.0f, drag_layer->opacity());
resizer->CompleteDrag(0);
EXPECT_EQ(root_windows[1], window_->GetRootWindow());
@@ -673,7 +675,7 @@ TEST_F(WorkspaceWindowResizerTest, PhantomStyle) {
window_.get(), gfx::Point(), HTCAPTION, empty_windows()));
ASSERT_TRUE(resizer.get());
EXPECT_FALSE(resizer->snap_phantom_window_controller_.get());
- EXPECT_FALSE(resizer->drag_phantom_window_controller_.get());
+ EXPECT_FALSE(resizer->drag_window_controller_.get());
resizer->Drag(CalculateDragPoint(*resizer, 0, 610), 0);
resizer->RevertDrag();
@@ -697,7 +699,7 @@ TEST_F(WorkspaceWindowResizerTest, CancelSnapPhantom) {
window_.get(), gfx::Point(), HTCAPTION, empty_windows()));
ASSERT_TRUE(resizer.get());
EXPECT_FALSE(resizer->snap_phantom_window_controller_.get());
- EXPECT_FALSE(resizer->drag_phantom_window_controller_.get());
+ EXPECT_FALSE(resizer->drag_window_controller_.get());
EXPECT_EQ(WorkspaceWindowResizer::SNAP_NONE, resizer->snap_type_);
// The pointer is on the edge but not shared. Both controllers should be
@@ -705,10 +707,9 @@ TEST_F(WorkspaceWindowResizerTest, CancelSnapPhantom) {
resizer->Drag(CalculateDragPoint(*resizer, 799, 0), 0);
EXPECT_TRUE(resizer->snap_phantom_window_controller_.get());
EXPECT_EQ(WorkspaceWindowResizer::SNAP_RIGHT_EDGE, resizer->snap_type_);
- PhantomWindowController* controller =
- resizer->drag_phantom_window_controller_.get();
+ DragWindowController* controller =
+ resizer->drag_window_controller_.get();
ASSERT_TRUE(controller);
- EXPECT_EQ(PhantomWindowController::STYLE_DRAGGING, controller->style());
// Move the cursor across the edge. Now the snap phantom controller
// should be canceled.
@@ -716,9 +717,8 @@ TEST_F(WorkspaceWindowResizerTest, CancelSnapPhantom) {
EXPECT_FALSE(resizer->snap_phantom_window_controller_.get());
EXPECT_EQ(WorkspaceWindowResizer::SNAP_NONE, resizer->snap_type_);
controller =
- resizer->drag_phantom_window_controller_.get();
+ resizer->drag_window_controller_.get();
ASSERT_TRUE(controller);
- EXPECT_EQ(PhantomWindowController::STYLE_DRAGGING, controller->style());
}
}
« no previous file with comments | « ash/wm/workspace/workspace_window_resizer.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698