OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "ash/drag_drop/drag_drop_controller.h" | 5 #include "ash/drag_drop/drag_drop_controller.h" |
6 | 6 |
7 #include "ash/shell.h" | 7 #include "ash/shell.h" |
8 #include "ash/test/ash_test_base.h" | 8 #include "ash/test/ash_test_base.h" |
9 #include "base/location.h" | 9 #include "base/location.h" |
10 #include "base/utf_string_conversions.h" | 10 #include "base/utf_string_conversions.h" |
(...skipping 189 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
200 void AddViewToWidgetAndResize(views::Widget* widget, views::View* view) { | 200 void AddViewToWidgetAndResize(views::Widget* widget, views::View* view) { |
201 if (!widget->GetContentsView()) { | 201 if (!widget->GetContentsView()) { |
202 views::View* contents_view = new views::View; | 202 views::View* contents_view = new views::View; |
203 widget->SetContentsView(contents_view); | 203 widget->SetContentsView(contents_view); |
204 } | 204 } |
205 | 205 |
206 views::View* contents_view = widget->GetContentsView(); | 206 views::View* contents_view = widget->GetContentsView(); |
207 contents_view->AddChildView(view); | 207 contents_view->AddChildView(view); |
208 view->SetBounds(contents_view->width(), 0, 100, 100); | 208 view->SetBounds(contents_view->width(), 0, 100, 100); |
209 gfx::Rect contents_view_bounds = contents_view->bounds(); | 209 gfx::Rect contents_view_bounds = contents_view->bounds(); |
210 contents_view_bounds = contents_view_bounds.Union(view->bounds()); | 210 contents_view_bounds.Union(view->bounds()); |
211 contents_view->SetBoundsRect(contents_view_bounds); | 211 contents_view->SetBoundsRect(contents_view_bounds); |
212 widget->SetBounds(contents_view_bounds); | 212 widget->SetBounds(contents_view_bounds); |
213 } | 213 } |
214 | 214 |
215 } // namespace | 215 } // namespace |
216 | 216 |
217 class DragDropControllerTest : public AshTestBase { | 217 class DragDropControllerTest : public AshTestBase { |
218 public: | 218 public: |
219 DragDropControllerTest() : AshTestBase() {} | 219 DragDropControllerTest() : AshTestBase() {} |
220 virtual ~DragDropControllerTest() {} | 220 virtual ~DragDropControllerTest() {} |
(...skipping 446 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
667 EXPECT_EQ(1, drag_view->num_drag_enters_); | 667 EXPECT_EQ(1, drag_view->num_drag_enters_); |
668 EXPECT_EQ(num_drags - 1 - drag_view->VerticalDragThreshold(), | 668 EXPECT_EQ(num_drags - 1 - drag_view->VerticalDragThreshold(), |
669 drag_view->num_drag_updates_); | 669 drag_view->num_drag_updates_); |
670 EXPECT_EQ(0, drag_view->num_drops_); | 670 EXPECT_EQ(0, drag_view->num_drops_); |
671 EXPECT_EQ(1, drag_view->num_drag_exits_); | 671 EXPECT_EQ(1, drag_view->num_drag_exits_); |
672 EXPECT_TRUE(drag_view->drag_done_received_); | 672 EXPECT_TRUE(drag_view->drag_done_received_); |
673 } | 673 } |
674 | 674 |
675 } // namespace test | 675 } // namespace test |
676 } // namespace aura | 676 } // namespace aura |
OLD | NEW |