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

Side by Side Diff: ash/drag_drop/drag_drop_controller_unittest.cc

Issue 10442017: Rename GetRootWindow() -> GetPrimaryRootWindow() (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: git-try -b linux_chromeos,win_aura Created 8 years, 7 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « ash/drag_drop/drag_drop_controller.cc ('k') | ash/high_contrast/high_contrast_controller.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 164 matching lines...) Expand 10 before | Expand all | Expand 10 after
175 static_cast<TestNativeWidgetAura*>(widget->native_widget())-> 175 static_cast<TestNativeWidgetAura*>(widget->native_widget())->
176 set_check_if_capture_lost(value); 176 set_check_if_capture_lost(value);
177 } 177 }
178 178
179 views::Widget* CreateNewWidget() { 179 views::Widget* CreateNewWidget() {
180 views::Widget* widget = new views::Widget; 180 views::Widget* widget = new views::Widget;
181 views::Widget::InitParams params; 181 views::Widget::InitParams params;
182 params.type = views::Widget::InitParams::TYPE_WINDOW_FRAMELESS; 182 params.type = views::Widget::InitParams::TYPE_WINDOW_FRAMELESS;
183 params.accept_events = true; 183 params.accept_events = true;
184 params.ownership = views::Widget::InitParams::WIDGET_OWNS_NATIVE_WIDGET; 184 params.ownership = views::Widget::InitParams::WIDGET_OWNS_NATIVE_WIDGET;
185 params.parent = Shell::GetRootWindow(); 185 params.parent = Shell::GetPrimaryRootWindow();
186 params.child = true; 186 params.child = true;
187 params.native_widget = new TestNativeWidgetAura(widget); 187 params.native_widget = new TestNativeWidgetAura(widget);
188 widget->Init(params); 188 widget->Init(params);
189 widget->Show(); 189 widget->Show();
190 return widget; 190 return widget;
191 } 191 }
192 192
193 void AddViewToWidgetAndResize(views::Widget* widget, views::View* view) { 193 void AddViewToWidgetAndResize(views::Widget* widget, views::View* view) {
194 if (!widget->GetContentsView()) { 194 if (!widget->GetContentsView()) {
195 views::View* contents_view = new views::View; 195 views::View* contents_view = new views::View;
(...skipping 13 matching lines...) Expand all
209 209
210 class DragDropControllerTest : public AshTestBase { 210 class DragDropControllerTest : public AshTestBase {
211 public: 211 public:
212 DragDropControllerTest() : AshTestBase() {} 212 DragDropControllerTest() : AshTestBase() {}
213 virtual ~DragDropControllerTest() {} 213 virtual ~DragDropControllerTest() {}
214 214
215 void SetUp() OVERRIDE { 215 void SetUp() OVERRIDE {
216 AshTestBase::SetUp(); 216 AshTestBase::SetUp();
217 drag_drop_controller_.reset(new TestDragDropController); 217 drag_drop_controller_.reset(new TestDragDropController);
218 drag_drop_controller_->set_should_block_during_drag_drop(false); 218 drag_drop_controller_->set_should_block_during_drag_drop(false);
219 aura::client::SetDragDropClient(Shell::GetRootWindow(), 219 aura::client::SetDragDropClient(Shell::GetPrimaryRootWindow(),
220 drag_drop_controller_.get()); 220 drag_drop_controller_.get());
221 views_delegate_.reset(new views::TestViewsDelegate); 221 views_delegate_.reset(new views::TestViewsDelegate);
222 } 222 }
223 223
224 void TearDown() OVERRIDE { 224 void TearDown() OVERRIDE {
225 aura::client::SetDragDropClient(Shell::GetRootWindow(), NULL); 225 aura::client::SetDragDropClient(Shell::GetPrimaryRootWindow(), NULL);
226 drag_drop_controller_.reset(); 226 drag_drop_controller_.reset();
227 AshTestBase::TearDown(); 227 AshTestBase::TearDown();
228 } 228 }
229 229
230 void UpdateDragData(ui::OSExchangeData* data) { 230 void UpdateDragData(ui::OSExchangeData* data) {
231 drag_drop_controller_->drag_data_ = data; 231 drag_drop_controller_->drag_data_ = data;
232 } 232 }
233 233
234 aura::Window* GetDragWindow() { 234 aura::Window* GetDragWindow() {
235 return drag_drop_controller_->drag_window_; 235 return drag_drop_controller_->drag_window_;
236 } 236 }
237 237
238 protected: 238 protected:
239 scoped_ptr<TestDragDropController> drag_drop_controller_; 239 scoped_ptr<TestDragDropController> drag_drop_controller_;
240 scoped_ptr<views::TestViewsDelegate> views_delegate_; 240 scoped_ptr<views::TestViewsDelegate> views_delegate_;
241 241
242 private: 242 private:
243 DISALLOW_COPY_AND_ASSIGN(DragDropControllerTest); 243 DISALLOW_COPY_AND_ASSIGN(DragDropControllerTest);
244 }; 244 };
245 245
246 TEST_F(DragDropControllerTest, DragDropInSingleViewTest) { 246 TEST_F(DragDropControllerTest, DragDropInSingleViewTest) {
247 scoped_ptr<views::Widget> widget(CreateNewWidget()); 247 scoped_ptr<views::Widget> widget(CreateNewWidget());
248 DragTestView* drag_view = new DragTestView; 248 DragTestView* drag_view = new DragTestView;
249 AddViewToWidgetAndResize(widget.get(), drag_view); 249 AddViewToWidgetAndResize(widget.get(), drag_view);
250 ui::OSExchangeData data; 250 ui::OSExchangeData data;
251 data.SetString(UTF8ToUTF16("I am being dragged")); 251 data.SetString(UTF8ToUTF16("I am being dragged"));
252 aura::test::EventGenerator generator(Shell::GetRootWindow(), 252 aura::test::EventGenerator generator(Shell::GetPrimaryRootWindow(),
253 widget->GetNativeView()); 253 widget->GetNativeView());
254 generator.PressLeftButton(); 254 generator.PressLeftButton();
255 255
256 int num_drags = 17; 256 int num_drags = 17;
257 SetCheckIfCaptureLost(widget.get(), true); 257 SetCheckIfCaptureLost(widget.get(), true);
258 for (int i = 0; i < num_drags; ++i) { 258 for (int i = 0; i < num_drags; ++i) {
259 // Because we are not doing a blocking drag and drop, the original 259 // Because we are not doing a blocking drag and drop, the original
260 // OSDragExchangeData object is lost as soon as we return from the drag 260 // OSDragExchangeData object is lost as soon as we return from the drag
261 // initiation in DragDropController::StartDragAndDrop(). Hence we set the 261 // initiation in DragDropController::StartDragAndDrop(). Hence we set the
262 // drag_data_ to a fake drag data object that we created. 262 // drag_data_ to a fake drag data object that we created.
(...skipping 25 matching lines...) Expand all
288 EXPECT_EQ(0, drag_view->num_drag_exits_); 288 EXPECT_EQ(0, drag_view->num_drag_exits_);
289 EXPECT_TRUE(drag_view->drag_done_received_); 289 EXPECT_TRUE(drag_view->drag_done_received_);
290 } 290 }
291 291
292 TEST_F(DragDropControllerTest, DragDropWithZeroDragUpdates) { 292 TEST_F(DragDropControllerTest, DragDropWithZeroDragUpdates) {
293 scoped_ptr<views::Widget> widget(CreateNewWidget()); 293 scoped_ptr<views::Widget> widget(CreateNewWidget());
294 DragTestView* drag_view = new DragTestView; 294 DragTestView* drag_view = new DragTestView;
295 AddViewToWidgetAndResize(widget.get(), drag_view); 295 AddViewToWidgetAndResize(widget.get(), drag_view);
296 ui::OSExchangeData data; 296 ui::OSExchangeData data;
297 data.SetString(UTF8ToUTF16("I am being dragged")); 297 data.SetString(UTF8ToUTF16("I am being dragged"));
298 aura::test::EventGenerator generator(Shell::GetRootWindow(), 298 aura::test::EventGenerator generator(Shell::GetPrimaryRootWindow(),
299 widget->GetNativeView()); 299 widget->GetNativeView());
300 generator.PressLeftButton(); 300 generator.PressLeftButton();
301 301
302 int num_drags = drag_view->VerticalDragThreshold() + 1; 302 int num_drags = drag_view->VerticalDragThreshold() + 1;
303 for (int i = 0; i < num_drags; ++i) { 303 for (int i = 0; i < num_drags; ++i) {
304 // Because we are not doing a blocking drag and drop, the original 304 // Because we are not doing a blocking drag and drop, the original
305 // OSDragExchangeData object is lost as soon as we return from the drag 305 // OSDragExchangeData object is lost as soon as we return from the drag
306 // initiation in DragDropController::StartDragAndDrop(). Hence we set the 306 // initiation in DragDropController::StartDragAndDrop(). Hence we set the
307 // drag_data_ to a fake drag data object that we created. 307 // drag_data_ to a fake drag data object that we created.
308 if (i > 0) 308 if (i > 0)
(...skipping 21 matching lines...) Expand all
330 TEST_F(DragDropControllerTest, DragDropInMultipleViewsSingleWidgetTest) { 330 TEST_F(DragDropControllerTest, DragDropInMultipleViewsSingleWidgetTest) {
331 scoped_ptr<views::Widget> widget(CreateNewWidget()); 331 scoped_ptr<views::Widget> widget(CreateNewWidget());
332 DragTestView* drag_view1 = new DragTestView; 332 DragTestView* drag_view1 = new DragTestView;
333 AddViewToWidgetAndResize(widget.get(), drag_view1); 333 AddViewToWidgetAndResize(widget.get(), drag_view1);
334 DragTestView* drag_view2 = new DragTestView; 334 DragTestView* drag_view2 = new DragTestView;
335 AddViewToWidgetAndResize(widget.get(), drag_view2); 335 AddViewToWidgetAndResize(widget.get(), drag_view2);
336 336
337 ui::OSExchangeData data; 337 ui::OSExchangeData data;
338 data.SetString(UTF8ToUTF16("I am being dragged")); 338 data.SetString(UTF8ToUTF16("I am being dragged"));
339 339
340 aura::test::EventGenerator generator(Shell::GetRootWindow()); 340 aura::test::EventGenerator generator(Shell::GetPrimaryRootWindow());
341 generator.MoveMouseRelativeTo(widget->GetNativeView(), 341 generator.MoveMouseRelativeTo(widget->GetNativeView(),
342 drag_view1->bounds().CenterPoint()); 342 drag_view1->bounds().CenterPoint());
343 generator.PressLeftButton(); 343 generator.PressLeftButton();
344 344
345 int num_drags = drag_view1->width(); 345 int num_drags = drag_view1->width();
346 for (int i = 0; i < num_drags; ++i) { 346 for (int i = 0; i < num_drags; ++i) {
347 // Because we are not doing a blocking drag and drop, the original 347 // Because we are not doing a blocking drag and drop, the original
348 // OSDragExchangeData object is lost as soon as we return from the drag 348 // OSDragExchangeData object is lost as soon as we return from the drag
349 // initiation in DragDropController::StartDragAndDrop(). Hence we set the 349 // initiation in DragDropController::StartDragAndDrop(). Hence we set the
350 // drag_data_ to a fake drag data object that we created. 350 // drag_data_ to a fake drag data object that we created.
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
390 DragTestView* drag_view2 = new DragTestView; 390 DragTestView* drag_view2 = new DragTestView;
391 AddViewToWidgetAndResize(widget2.get(), drag_view2); 391 AddViewToWidgetAndResize(widget2.get(), drag_view2);
392 gfx::Rect widget1_bounds = widget1->GetClientAreaScreenBounds(); 392 gfx::Rect widget1_bounds = widget1->GetClientAreaScreenBounds();
393 gfx::Rect widget2_bounds = widget2->GetClientAreaScreenBounds(); 393 gfx::Rect widget2_bounds = widget2->GetClientAreaScreenBounds();
394 widget2->SetBounds(gfx::Rect(widget1_bounds.width(), 0, 394 widget2->SetBounds(gfx::Rect(widget1_bounds.width(), 0,
395 widget2_bounds.width(), widget2_bounds.height())); 395 widget2_bounds.width(), widget2_bounds.height()));
396 396
397 ui::OSExchangeData data; 397 ui::OSExchangeData data;
398 data.SetString(UTF8ToUTF16("I am being dragged")); 398 data.SetString(UTF8ToUTF16("I am being dragged"));
399 399
400 aura::test::EventGenerator generator(Shell::GetRootWindow(), 400 aura::test::EventGenerator generator(Shell::GetPrimaryRootWindow(),
401 widget1->GetNativeView()); 401 widget1->GetNativeView());
402 generator.PressLeftButton(); 402 generator.PressLeftButton();
403 403
404 int num_drags = drag_view1->width(); 404 int num_drags = drag_view1->width();
405 for (int i = 0; i < num_drags; ++i) { 405 for (int i = 0; i < num_drags; ++i) {
406 // Because we are not doing a blocking drag and drop, the original 406 // Because we are not doing a blocking drag and drop, the original
407 // OSDragExchangeData object is lost as soon as we return from the drag 407 // OSDragExchangeData object is lost as soon as we return from the drag
408 // initiation in DragDropController::StartDragAndDrop(). Hence we set the 408 // initiation in DragDropController::StartDragAndDrop(). Hence we set the
409 // drag_data_ to a fake drag data object that we created. 409 // drag_data_ to a fake drag data object that we created.
410 if (i > 0) 410 if (i > 0)
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
442 } 442 }
443 443
444 TEST_F(DragDropControllerTest, ViewRemovedWhileInDragDropTest) { 444 TEST_F(DragDropControllerTest, ViewRemovedWhileInDragDropTest) {
445 scoped_ptr<views::Widget> widget(CreateNewWidget()); 445 scoped_ptr<views::Widget> widget(CreateNewWidget());
446 scoped_ptr<DragTestView> drag_view(new DragTestView); 446 scoped_ptr<DragTestView> drag_view(new DragTestView);
447 AddViewToWidgetAndResize(widget.get(), drag_view.get()); 447 AddViewToWidgetAndResize(widget.get(), drag_view.get());
448 gfx::Point point = gfx::Rect(drag_view->bounds()).CenterPoint(); 448 gfx::Point point = gfx::Rect(drag_view->bounds()).CenterPoint();
449 ui::OSExchangeData data; 449 ui::OSExchangeData data;
450 data.SetString(UTF8ToUTF16("I am being dragged")); 450 data.SetString(UTF8ToUTF16("I am being dragged"));
451 451
452 aura::test::EventGenerator generator(Shell::GetRootWindow()); 452 aura::test::EventGenerator generator(Shell::GetPrimaryRootWindow());
453 generator.MoveMouseToCenterOf(widget->GetNativeView()); 453 generator.MoveMouseToCenterOf(widget->GetNativeView());
454 generator.PressLeftButton(); 454 generator.PressLeftButton();
455 455
456 int num_drags_1 = 17; 456 int num_drags_1 = 17;
457 for (int i = 0; i < num_drags_1; ++i) { 457 for (int i = 0; i < num_drags_1; ++i) {
458 // Because we are not doing a blocking drag and drop, the original 458 // Because we are not doing a blocking drag and drop, the original
459 // OSDragExchangeData object is lost as soon as we return from the drag 459 // OSDragExchangeData object is lost as soon as we return from the drag
460 // initiation in DragDropController::StartDragAndDrop(). Hence we set the 460 // initiation in DragDropController::StartDragAndDrop(). Hence we set the
461 // drag_data_ to a fake drag data object that we created. 461 // drag_data_ to a fake drag data object that we created.
462 if (i > 0) 462 if (i > 0)
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
503 ui::ScopedClipboardWriter scw(cb, ui::Clipboard::BUFFER_STANDARD); 503 ui::ScopedClipboardWriter scw(cb, ui::Clipboard::BUFFER_STANDARD);
504 scw.WriteText(ASCIIToUTF16(clip_str)); 504 scw.WriteText(ASCIIToUTF16(clip_str));
505 } 505 }
506 EXPECT_TRUE(cb->IsFormatAvailable(ui::Clipboard::GetPlainTextFormatType(), 506 EXPECT_TRUE(cb->IsFormatAvailable(ui::Clipboard::GetPlainTextFormatType(),
507 ui::Clipboard::BUFFER_STANDARD)); 507 ui::Clipboard::BUFFER_STANDARD));
508 508
509 scoped_ptr<views::Widget> widget(CreateNewWidget()); 509 scoped_ptr<views::Widget> widget(CreateNewWidget());
510 DragTestView* drag_view = new DragTestView; 510 DragTestView* drag_view = new DragTestView;
511 AddViewToWidgetAndResize(widget.get(), drag_view); 511 AddViewToWidgetAndResize(widget.get(), drag_view);
512 512
513 aura::test::EventGenerator generator(Shell::GetRootWindow(), 513 aura::test::EventGenerator generator(Shell::GetPrimaryRootWindow(),
514 widget->GetNativeView()); 514 widget->GetNativeView());
515 ui::OSExchangeData data; 515 ui::OSExchangeData data;
516 std::string data_str("I am being dragged"); 516 std::string data_str("I am being dragged");
517 data.SetString(ASCIIToUTF16(data_str)); 517 data.SetString(ASCIIToUTF16(data_str));
518 518
519 generator.PressLeftButton(); 519 generator.PressLeftButton();
520 generator.MoveMouseBy(0, drag_view->VerticalDragThreshold() + 1); 520 generator.MoveMouseBy(0, drag_view->VerticalDragThreshold() + 1);
521 521
522 // Execute any scheduled draws to process deferred mouse events. 522 // Execute any scheduled draws to process deferred mouse events.
523 RunAllPendingInMessageLoop(); 523 RunAllPendingInMessageLoop();
524 524
525 // Verify the clipboard contents haven't changed 525 // Verify the clipboard contents haven't changed
526 std::string result; 526 std::string result;
527 EXPECT_TRUE(cb->IsFormatAvailable(ui::Clipboard::GetPlainTextFormatType(), 527 EXPECT_TRUE(cb->IsFormatAvailable(ui::Clipboard::GetPlainTextFormatType(),
528 ui::Clipboard::BUFFER_STANDARD)); 528 ui::Clipboard::BUFFER_STANDARD));
529 cb->ReadAsciiText(ui::Clipboard::BUFFER_STANDARD, &result); 529 cb->ReadAsciiText(ui::Clipboard::BUFFER_STANDARD, &result);
530 EXPECT_EQ(clip_str, result); 530 EXPECT_EQ(clip_str, result);
531 } 531 }
532 532
533 TEST_F(DragDropControllerTest, WindowDestroyedDuringDragDrop) { 533 TEST_F(DragDropControllerTest, WindowDestroyedDuringDragDrop) {
534 scoped_ptr<views::Widget> widget(CreateNewWidget()); 534 scoped_ptr<views::Widget> widget(CreateNewWidget());
535 DragTestView* drag_view = new DragTestView; 535 DragTestView* drag_view = new DragTestView;
536 AddViewToWidgetAndResize(widget.get(), drag_view); 536 AddViewToWidgetAndResize(widget.get(), drag_view);
537 aura::Window* window = widget->GetNativeView(); 537 aura::Window* window = widget->GetNativeView();
538 538
539 ui::OSExchangeData data; 539 ui::OSExchangeData data;
540 data.SetString(UTF8ToUTF16("I am being dragged")); 540 data.SetString(UTF8ToUTF16("I am being dragged"));
541 aura::test::EventGenerator generator(Shell::GetRootWindow(), 541 aura::test::EventGenerator generator(Shell::GetPrimaryRootWindow(),
542 widget->GetNativeView()); 542 widget->GetNativeView());
543 generator.PressLeftButton(); 543 generator.PressLeftButton();
544 544
545 int num_drags = 17; 545 int num_drags = 17;
546 for (int i = 0; i < num_drags; ++i) { 546 for (int i = 0; i < num_drags; ++i) {
547 // Because we are not doing a blocking drag and drop, the original 547 // Because we are not doing a blocking drag and drop, the original
548 // OSDragExchangeData object is lost as soon as we return from the drag 548 // OSDragExchangeData object is lost as soon as we return from the drag
549 // initiation in DragDropController::StartDragAndDrop(). Hence we set the 549 // initiation in DragDropController::StartDragAndDrop(). Hence we set the
550 // drag_data_ to a fake drag data object that we created. 550 // drag_data_ to a fake drag data object that we created.
551 if (i > 0) 551 if (i > 0)
(...skipping 23 matching lines...) Expand all
575 EXPECT_TRUE(drag_drop_controller_->drag_start_received_); 575 EXPECT_TRUE(drag_drop_controller_->drag_start_received_);
576 EXPECT_TRUE(drag_drop_controller_->drop_received_); 576 EXPECT_TRUE(drag_drop_controller_->drop_received_);
577 } 577 }
578 578
579 TEST_F(DragDropControllerTest, SyntheticEventsDuringDragDrop) { 579 TEST_F(DragDropControllerTest, SyntheticEventsDuringDragDrop) {
580 scoped_ptr<views::Widget> widget(CreateNewWidget()); 580 scoped_ptr<views::Widget> widget(CreateNewWidget());
581 DragTestView* drag_view = new DragTestView; 581 DragTestView* drag_view = new DragTestView;
582 AddViewToWidgetAndResize(widget.get(), drag_view); 582 AddViewToWidgetAndResize(widget.get(), drag_view);
583 ui::OSExchangeData data; 583 ui::OSExchangeData data;
584 data.SetString(UTF8ToUTF16("I am being dragged")); 584 data.SetString(UTF8ToUTF16("I am being dragged"));
585 aura::test::EventGenerator generator(Shell::GetRootWindow(), 585 aura::test::EventGenerator generator(Shell::GetPrimaryRootWindow(),
586 widget->GetNativeView()); 586 widget->GetNativeView());
587 generator.PressLeftButton(); 587 generator.PressLeftButton();
588 588
589 int num_drags = 17; 589 int num_drags = 17;
590 for (int i = 0; i < num_drags; ++i) { 590 for (int i = 0; i < num_drags; ++i) {
591 // Because we are not doing a blocking drag and drop, the original 591 // Because we are not doing a blocking drag and drop, the original
592 // OSDragExchangeData object is lost as soon as we return from the drag 592 // OSDragExchangeData object is lost as soon as we return from the drag
593 // initiation in DragDropController::StartDragAndDrop(). Hence we set the 593 // initiation in DragDropController::StartDragAndDrop(). Hence we set the
594 // drag_data_ to a fake drag data object that we created. 594 // drag_data_ to a fake drag data object that we created.
595 if (i > 0) 595 if (i > 0)
596 UpdateDragData(&data); 596 UpdateDragData(&data);
597 generator.MoveMouseBy(0, 1); 597 generator.MoveMouseBy(0, 1);
598 598
599 // We send a unexpected mouse move event. Note that we cannot use 599 // We send a unexpected mouse move event. Note that we cannot use
600 // EventGenerator since it implicitly turns these into mouse drag events. 600 // EventGenerator since it implicitly turns these into mouse drag events.
601 // The DragDropController should simply ignore these events. 601 // The DragDropController should simply ignore these events.
602 gfx::Point mouse_move_location = drag_view->bounds().CenterPoint(); 602 gfx::Point mouse_move_location = drag_view->bounds().CenterPoint();
603 aura::MouseEvent mouse_move(ui::ET_MOUSE_MOVED, 603 aura::MouseEvent mouse_move(ui::ET_MOUSE_MOVED,
604 mouse_move_location, mouse_move_location, 0); 604 mouse_move_location, mouse_move_location, 0);
605 Shell::GetRootWindow()->DispatchMouseEvent(&mouse_move); 605 Shell::GetPrimaryRootWindow()->DispatchMouseEvent(&mouse_move);
606 } 606 }
607 607
608 generator.ReleaseLeftButton(); 608 generator.ReleaseLeftButton();
609 609
610 EXPECT_TRUE(drag_drop_controller_->drag_start_received_); 610 EXPECT_TRUE(drag_drop_controller_->drag_start_received_);
611 EXPECT_EQ(num_drags - 1 - drag_view->VerticalDragThreshold(), 611 EXPECT_EQ(num_drags - 1 - drag_view->VerticalDragThreshold(),
612 drag_drop_controller_->num_drag_updates_); 612 drag_drop_controller_->num_drag_updates_);
613 EXPECT_TRUE(drag_drop_controller_->drop_received_); 613 EXPECT_TRUE(drag_drop_controller_->drop_received_);
614 EXPECT_EQ(UTF8ToUTF16("I am being dragged"), 614 EXPECT_EQ(UTF8ToUTF16("I am being dragged"),
615 drag_drop_controller_->drag_string_); 615 drag_drop_controller_->drag_string_);
616 616
617 EXPECT_EQ(1, drag_view->num_drag_enters_); 617 EXPECT_EQ(1, drag_view->num_drag_enters_);
618 EXPECT_EQ(num_drags - 1 - drag_view->VerticalDragThreshold(), 618 EXPECT_EQ(num_drags - 1 - drag_view->VerticalDragThreshold(),
619 drag_view->num_drag_updates_); 619 drag_view->num_drag_updates_);
620 EXPECT_EQ(1, drag_view->num_drops_); 620 EXPECT_EQ(1, drag_view->num_drops_);
621 EXPECT_EQ(0, drag_view->num_drag_exits_); 621 EXPECT_EQ(0, drag_view->num_drag_exits_);
622 EXPECT_TRUE(drag_view->drag_done_received_); 622 EXPECT_TRUE(drag_view->drag_done_received_);
623 } 623 }
624 624
625 } // namespace test 625 } // namespace test
626 } // namespace aura 626 } // namespace aura
OLDNEW
« no previous file with comments | « ash/drag_drop/drag_drop_controller.cc ('k') | ash/high_contrast/high_contrast_controller.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698