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

Side by Side Diff: ash/extended_desktop_unittest.cc

Issue 406413004: Cleanups for aura/test/event_generator.h (resolve TODOs) (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase at r285842 Created 6 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 unified diff | Download patch | Annotate | Revision Log
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/display/display_controller.h" 5 #include "ash/display/display_controller.h"
6 #include "ash/display/display_manager.h" 6 #include "ash/display/display_manager.h"
7 #include "ash/root_window_controller.h" 7 #include "ash/root_window_controller.h"
8 #include "ash/screen_util.h" 8 #include "ash/screen_util.h"
9 #include "ash/shell.h" 9 #include "ash/shell.h"
10 #include "ash/shell_window_ids.h" 10 #include "ash/shell_window_ids.h"
11 #include "ash/system/tray/system_tray.h" 11 #include "ash/system/tray/system_tray.h"
12 #include "ash/test/ash_test_base.h" 12 #include "ash/test/ash_test_base.h"
13 #include "ash/wm/coordinate_conversion.h" 13 #include "ash/wm/coordinate_conversion.h"
14 #include "ash/wm/window_properties.h" 14 #include "ash/wm/window_properties.h"
15 #include "ash/wm/window_util.h" 15 #include "ash/wm/window_util.h"
16 #include "base/strings/string_util.h" 16 #include "base/strings/string_util.h"
17 #include "base/strings/utf_string_conversions.h" 17 #include "base/strings/utf_string_conversions.h"
18 #include "ui/aura/client/capture_client.h" 18 #include "ui/aura/client/capture_client.h"
19 #include "ui/aura/client/focus_client.h" 19 #include "ui/aura/client/focus_client.h"
20 #include "ui/aura/test/event_generator.h"
21 #include "ui/aura/test/test_windows.h" 20 #include "ui/aura/test/test_windows.h"
22 #include "ui/aura/test/window_test_api.h" 21 #include "ui/aura/test/window_test_api.h"
23 #include "ui/aura/window.h" 22 #include "ui/aura/window.h"
24 #include "ui/aura/window_event_dispatcher.h" 23 #include "ui/aura/window_event_dispatcher.h"
25 #include "ui/base/cursor/cursor.h" 24 #include "ui/base/cursor/cursor.h"
26 #include "ui/events/event_handler.h" 25 #include "ui/events/event_handler.h"
26 #include "ui/events/test/event_generator.h"
27 #include "ui/gfx/display.h" 27 #include "ui/gfx/display.h"
28 #include "ui/gfx/screen.h" 28 #include "ui/gfx/screen.h"
29 #include "ui/views/controls/textfield/textfield.h" 29 #include "ui/views/controls/textfield/textfield.h"
30 #include "ui/views/widget/widget.h" 30 #include "ui/views/widget/widget.h"
31 #include "ui/views/widget/widget_delegate.h" 31 #include "ui/views/widget/widget_delegate.h"
32 #include "ui/wm/public/activation_client.h" 32 #include "ui/wm/public/activation_client.h"
33 33
34 namespace ash { 34 namespace ash {
35 namespace { 35 namespace {
36 36
(...skipping 170 matching lines...) Expand 10 before | Expand all | Expand 10 after
207 views::Widget* widget_on_1st = CreateTestWidget(gfx::Rect(10, 10, 100, 100)); 207 views::Widget* widget_on_1st = CreateTestWidget(gfx::Rect(10, 10, 100, 100));
208 views::Widget* widget_on_2nd = 208 views::Widget* widget_on_2nd =
209 CreateTestWidget(gfx::Rect(1200, 10, 100, 100)); 209 CreateTestWidget(gfx::Rect(1200, 10, 100, 100));
210 EXPECT_EQ(root_windows[0], widget_on_1st->GetNativeView()->GetRootWindow()); 210 EXPECT_EQ(root_windows[0], widget_on_1st->GetNativeView()->GetRootWindow());
211 EXPECT_EQ(root_windows[1], widget_on_2nd->GetNativeView()->GetRootWindow()); 211 EXPECT_EQ(root_windows[1], widget_on_2nd->GetNativeView()->GetRootWindow());
212 212
213 EXPECT_EQ(widget_on_2nd->GetNativeView(), 213 EXPECT_EQ(widget_on_2nd->GetNativeView(),
214 aura::client::GetFocusClient(root_windows[0])->GetFocusedWindow()); 214 aura::client::GetFocusClient(root_windows[0])->GetFocusedWindow());
215 EXPECT_TRUE(wm::IsActiveWindow(widget_on_2nd->GetNativeView())); 215 EXPECT_TRUE(wm::IsActiveWindow(widget_on_2nd->GetNativeView()));
216 216
217 aura::test::EventGenerator& event_generator(GetEventGenerator()); 217 ui::test::EventGenerator& event_generator(GetEventGenerator());
218 // Clicking a window changes the active window and active root window. 218 // Clicking a window changes the active window and active root window.
219 event_generator.MoveMouseToCenterOf(widget_on_1st->GetNativeView()); 219 event_generator.MoveMouseToCenterOf(widget_on_1st->GetNativeView());
220 event_generator.ClickLeftButton(); 220 event_generator.ClickLeftButton();
221 221
222 EXPECT_EQ(widget_on_1st->GetNativeView(), 222 EXPECT_EQ(widget_on_1st->GetNativeView(),
223 aura::client::GetFocusClient(root_windows[0])->GetFocusedWindow()); 223 aura::client::GetFocusClient(root_windows[0])->GetFocusedWindow());
224 EXPECT_TRUE(wm::IsActiveWindow(widget_on_1st->GetNativeView())); 224 EXPECT_TRUE(wm::IsActiveWindow(widget_on_1st->GetNativeView()));
225 225
226 event_generator.MoveMouseToCenterOf(widget_on_2nd->GetNativeView()); 226 event_generator.MoveMouseToCenterOf(widget_on_2nd->GetNativeView());
227 event_generator.ClickLeftButton(); 227 event_generator.ClickLeftButton();
(...skipping 18 matching lines...) Expand all
246 // Open system modal. Make sure it's on 2nd root window and active. 246 // Open system modal. Make sure it's on 2nd root window and active.
247 views::Widget* modal_widget = views::Widget::CreateWindowWithContextAndBounds( 247 views::Widget* modal_widget = views::Widget::CreateWindowWithContextAndBounds(
248 new ModalWidgetDelegate(), 248 new ModalWidgetDelegate(),
249 CurrentContext(), 249 CurrentContext(),
250 gfx::Rect(1200, 100, 100, 100)); 250 gfx::Rect(1200, 100, 100, 100));
251 modal_widget->Show(); 251 modal_widget->Show();
252 EXPECT_TRUE(wm::IsActiveWindow(modal_widget->GetNativeView())); 252 EXPECT_TRUE(wm::IsActiveWindow(modal_widget->GetNativeView()));
253 EXPECT_EQ(root_windows[1], modal_widget->GetNativeView()->GetRootWindow()); 253 EXPECT_EQ(root_windows[1], modal_widget->GetNativeView()->GetRootWindow());
254 EXPECT_EQ(root_windows[1], Shell::GetTargetRootWindow()); 254 EXPECT_EQ(root_windows[1], Shell::GetTargetRootWindow());
255 255
256 aura::test::EventGenerator& event_generator(GetEventGenerator()); 256 ui::test::EventGenerator& event_generator(GetEventGenerator());
257 257
258 // Clicking a widget on widget_on_1st display should not change activation. 258 // Clicking a widget on widget_on_1st display should not change activation.
259 event_generator.MoveMouseToCenterOf(widget_on_1st->GetNativeView()); 259 event_generator.MoveMouseToCenterOf(widget_on_1st->GetNativeView());
260 event_generator.ClickLeftButton(); 260 event_generator.ClickLeftButton();
261 EXPECT_TRUE(wm::IsActiveWindow(modal_widget->GetNativeView())); 261 EXPECT_TRUE(wm::IsActiveWindow(modal_widget->GetNativeView()));
262 EXPECT_EQ(root_windows[1], Shell::GetTargetRootWindow()); 262 EXPECT_EQ(root_windows[1], Shell::GetTargetRootWindow());
263 263
264 // Close system modal and so clicking a widget should work now. 264 // Close system modal and so clicking a widget should work now.
265 modal_widget->Close(); 265 modal_widget->Close();
266 event_generator.MoveMouseToCenterOf(widget_on_1st->GetNativeView()); 266 event_generator.MoveMouseToCenterOf(widget_on_1st->GetNativeView());
(...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after
384 scoped_ptr<aura::Window> r1_w2(aura::test::CreateTestWindowWithDelegate( 384 scoped_ptr<aura::Window> r1_w2(aura::test::CreateTestWindowWithDelegate(
385 &r1_d2, 0, gfx::Rect(10, 100, 100, 100), root_windows[0])); 385 &r1_d2, 0, gfx::Rect(10, 100, 100, 100), root_windows[0]));
386 scoped_ptr<aura::Window> r2_w1(aura::test::CreateTestWindowWithDelegate( 386 scoped_ptr<aura::Window> r2_w1(aura::test::CreateTestWindowWithDelegate(
387 &r2_d1, 0, gfx::Rect(10, 10, 100, 100), root_windows[1])); 387 &r2_d1, 0, gfx::Rect(10, 10, 100, 100), root_windows[1]));
388 388
389 r1_w1->SetCapture(); 389 r1_w1->SetCapture();
390 390
391 EXPECT_EQ(r1_w1.get(), 391 EXPECT_EQ(r1_w1.get(),
392 aura::client::GetCaptureWindow(r2_w1->GetRootWindow())); 392 aura::client::GetCaptureWindow(r2_w1->GetRootWindow()));
393 393
394 aura::test::EventGenerator& generator = GetEventGenerator(); 394 ui::test::EventGenerator& generator = GetEventGenerator();
395 generator.MoveMouseToCenterOf(r2_w1.get()); 395 generator.MoveMouseToCenterOf(r2_w1.get());
396 // |r1_w1| will receive the events because it has capture. 396 // |r1_w1| will receive the events because it has capture.
397 EXPECT_EQ("1 1 0", r1_d1.GetMouseMotionCountsAndReset()); 397 EXPECT_EQ("1 1 0", r1_d1.GetMouseMotionCountsAndReset());
398 EXPECT_EQ("0 0 0", r1_d2.GetMouseMotionCountsAndReset()); 398 EXPECT_EQ("0 0 0", r1_d2.GetMouseMotionCountsAndReset());
399 EXPECT_EQ("0 0 0", r2_d1.GetMouseMotionCountsAndReset()); 399 EXPECT_EQ("0 0 0", r2_d1.GetMouseMotionCountsAndReset());
400 400
401 generator.ClickLeftButton(); 401 generator.ClickLeftButton();
402 EXPECT_EQ("0 0 0", r2_d1.GetMouseMotionCountsAndReset()); 402 EXPECT_EQ("0 0 0", r2_d1.GetMouseMotionCountsAndReset());
403 EXPECT_EQ("0 0", r2_d1.GetMouseButtonCountsAndReset()); 403 EXPECT_EQ("0 0", r2_d1.GetMouseButtonCountsAndReset());
404 // The mouse is outside. On chromeos, the mouse is warped to the 404 // The mouse is outside. On chromeos, the mouse is warped to the
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
451 451
452 scoped_ptr<aura::Window> r1_w1(aura::test::CreateTestWindowWithDelegate( 452 scoped_ptr<aura::Window> r1_w1(aura::test::CreateTestWindowWithDelegate(
453 &r1_d1, 0, gfx::Rect(10, 10, 100, 100), root_windows[0])); 453 &r1_d1, 0, gfx::Rect(10, 10, 100, 100), root_windows[0]));
454 scoped_ptr<aura::Window> r1_w2(aura::test::CreateTestWindowWithDelegate( 454 scoped_ptr<aura::Window> r1_w2(aura::test::CreateTestWindowWithDelegate(
455 &r1_d2, 0, gfx::Rect(10, 100, 100, 100), root_windows[0])); 455 &r1_d2, 0, gfx::Rect(10, 100, 100, 100), root_windows[0]));
456 scoped_ptr<aura::Window> r2_w1(aura::test::CreateTestWindowWithDelegate( 456 scoped_ptr<aura::Window> r2_w1(aura::test::CreateTestWindowWithDelegate(
457 &r2_d1, 0, gfx::Rect(10, 10, 100, 100), root_windows[1])); 457 &r2_d1, 0, gfx::Rect(10, 10, 100, 100), root_windows[1]));
458 458
459 r1_w1->SetCapture(); 459 r1_w1->SetCapture();
460 460
461 aura::test::EventGenerator& generator = GetEventGenerator(); 461 ui::test::EventGenerator& generator = GetEventGenerator();
462 generator.MoveMouseToCenterOf(r2_w1.get()); 462 generator.MoveMouseToCenterOf(r2_w1.get());
463 EXPECT_EQ(gfx::Point(1060, 60).ToString(), 463 EXPECT_EQ(gfx::Point(1060, 60).ToString(),
464 generator.current_location().ToString()); 464 generator.current_location().ToString());
465 465
466 EventLocationHandler location_handler; 466 EventLocationHandler location_handler;
467 r1_w1->AddPreTargetHandler(&location_handler); 467 r1_w1->AddPreTargetHandler(&location_handler);
468 generator.ClickLeftButton(); 468 generator.ClickLeftButton();
469 r1_w1->RemovePreTargetHandler(&location_handler); 469 r1_w1->RemovePreTargetHandler(&location_handler);
470 EXPECT_EQ(gfx::Point(1050, 50).ToString(), 470 EXPECT_EQ(gfx::Point(1050, 50).ToString(),
471 location_handler.press_location().ToString()); 471 location_handler.press_location().ToString());
(...skipping 14 matching lines...) Expand all
486 486
487 scoped_ptr<aura::Window> r1_w1(aura::test::CreateTestWindowWithDelegate( 487 scoped_ptr<aura::Window> r1_w1(aura::test::CreateTestWindowWithDelegate(
488 &r1_d1, 0, gfx::Rect(10, 10, 100, 100), root_windows[0])); 488 &r1_d1, 0, gfx::Rect(10, 10, 100, 100), root_windows[0]));
489 scoped_ptr<aura::Window> r1_w2(aura::test::CreateTestWindowWithDelegate( 489 scoped_ptr<aura::Window> r1_w2(aura::test::CreateTestWindowWithDelegate(
490 &r1_d2, 0, gfx::Rect(10, 100, 100, 100), root_windows[0])); 490 &r1_d2, 0, gfx::Rect(10, 100, 100, 100), root_windows[0]));
491 scoped_ptr<aura::Window> r2_w1(aura::test::CreateTestWindowWithDelegate( 491 scoped_ptr<aura::Window> r2_w1(aura::test::CreateTestWindowWithDelegate(
492 &r2_d1, 0, gfx::Rect(10, 10, 100, 100), root_windows[1])); 492 &r2_d1, 0, gfx::Rect(10, 10, 100, 100), root_windows[1]));
493 493
494 r1_w1->SetCapture(); 494 r1_w1->SetCapture();
495 495
496 aura::test::EventGenerator& generator = GetEventGenerator(); 496 ui::test::EventGenerator& generator = GetEventGenerator();
497 generator.MoveMouseToCenterOf(r2_w1.get()); 497 generator.MoveMouseToCenterOf(r2_w1.get());
498 EXPECT_EQ(gfx::Point(560, 60).ToString(), 498 EXPECT_EQ(gfx::Point(560, 60).ToString(),
499 generator.current_location().ToString()); 499 generator.current_location().ToString());
500 500
501 EventLocationHandler location_handler; 501 EventLocationHandler location_handler;
502 r1_w1->AddPreTargetHandler(&location_handler); 502 r1_w1->AddPreTargetHandler(&location_handler);
503 generator.ClickLeftButton(); 503 generator.ClickLeftButton();
504 r1_w1->RemovePreTargetHandler(&location_handler); 504 r1_w1->RemovePreTargetHandler(&location_handler);
505 EXPECT_EQ(gfx::Point(550, 50).ToString(), 505 EXPECT_EQ(gfx::Point(550, 50).ToString(),
506 location_handler.press_location().ToString()); 506 location_handler.press_location().ToString());
(...skipping 14 matching lines...) Expand all
521 521
522 scoped_ptr<aura::Window> r1_w1(aura::test::CreateTestWindowWithDelegate( 522 scoped_ptr<aura::Window> r1_w1(aura::test::CreateTestWindowWithDelegate(
523 &r1_d1, 0, gfx::Rect(10, 10, 100, 100), root_windows[0])); 523 &r1_d1, 0, gfx::Rect(10, 10, 100, 100), root_windows[0]));
524 scoped_ptr<aura::Window> r1_w2(aura::test::CreateTestWindowWithDelegate( 524 scoped_ptr<aura::Window> r1_w2(aura::test::CreateTestWindowWithDelegate(
525 &r1_d2, 0, gfx::Rect(10, 100, 100, 100), root_windows[0])); 525 &r1_d2, 0, gfx::Rect(10, 100, 100, 100), root_windows[0]));
526 scoped_ptr<aura::Window> r2_w1(aura::test::CreateTestWindowWithDelegate( 526 scoped_ptr<aura::Window> r2_w1(aura::test::CreateTestWindowWithDelegate(
527 &r2_d1, 0, gfx::Rect(10, 10, 100, 100), root_windows[1])); 527 &r2_d1, 0, gfx::Rect(10, 10, 100, 100), root_windows[1]));
528 528
529 r1_w1->SetCapture(); 529 r1_w1->SetCapture();
530 530
531 aura::test::EventGenerator& generator = GetEventGenerator(); 531 ui::test::EventGenerator& generator = GetEventGenerator();
532 generator.MoveMouseToCenterOf(r2_w1.get()); 532 generator.MoveMouseToCenterOf(r2_w1.get());
533 EXPECT_EQ(gfx::Point(1060, 60).ToString(), 533 EXPECT_EQ(gfx::Point(1060, 60).ToString(),
534 generator.current_location().ToString()); 534 generator.current_location().ToString());
535 535
536 EventLocationHandler location_handler; 536 EventLocationHandler location_handler;
537 r1_w1->AddPreTargetHandler(&location_handler); 537 r1_w1->AddPreTargetHandler(&location_handler);
538 generator.ClickLeftButton(); 538 generator.ClickLeftButton();
539 r1_w1->RemovePreTargetHandler(&location_handler); 539 r1_w1->RemovePreTargetHandler(&location_handler);
540 // Event-generator dispatches the event in the primary root-window's coord 540 // Event-generator dispatches the event in the primary root-window's coord
541 // space. Since the location is (1060, 60), it goes to the secondary 541 // space. Since the location is (1060, 60), it goes to the secondary
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
590 590
591 UpdateDisplay("1000x600,600x400"); 591 UpdateDisplay("1000x600,600x400");
592 592
593 aura::Window::Windows root_windows = Shell::GetAllRootWindows(); 593 aura::Window::Windows root_windows = Shell::GetAllRootWindows();
594 aura::test::EventCountDelegate delegate; 594 aura::test::EventCountDelegate delegate;
595 scoped_ptr<aura::Window> window(aura::test::CreateTestWindowWithDelegate( 595 scoped_ptr<aura::Window> window(aura::test::CreateTestWindowWithDelegate(
596 &delegate, 0, gfx::Rect(10, 10, 100, 100), root_windows[0])); 596 &delegate, 0, gfx::Rect(10, 10, 100, 100), root_windows[0]));
597 MoveWindowByClickEventHandler event_handler(window.get()); 597 MoveWindowByClickEventHandler event_handler(window.get());
598 window->AddPreTargetHandler(&event_handler); 598 window->AddPreTargetHandler(&event_handler);
599 599
600 aura::test::EventGenerator& event_generator(GetEventGenerator()); 600 ui::test::EventGenerator& event_generator(GetEventGenerator());
601 601
602 event_generator.MoveMouseToCenterOf(window.get()); 602 event_generator.MoveMouseToCenterOf(window.get());
603 event_generator.ClickLeftButton(); 603 event_generator.ClickLeftButton();
604 // Both mouse pressed and released arrive at the window and its delegate. 604 // Both mouse pressed and released arrive at the window and its delegate.
605 EXPECT_EQ("1 1", delegate.GetMouseButtonCountsAndReset()); 605 EXPECT_EQ("1 1", delegate.GetMouseButtonCountsAndReset());
606 // Also event_handler moves the window to another root at mouse release. 606 // Also event_handler moves the window to another root at mouse release.
607 EXPECT_EQ(root_windows[1], window->GetRootWindow()); 607 EXPECT_EQ(root_windows[1], window->GetRootWindow());
608 } 608 }
609 609
610 TEST_F(ExtendedDesktopTest, MoveWindowToDisplay) { 610 TEST_F(ExtendedDesktopTest, MoveWindowToDisplay) {
(...skipping 146 matching lines...) Expand 10 before | Expand all | Expand 10 after
757 } 757 }
758 758
759 TEST_F(ExtendedDesktopTest, OpenSystemTray) { 759 TEST_F(ExtendedDesktopTest, OpenSystemTray) {
760 if (!SupportsMultipleDisplays()) 760 if (!SupportsMultipleDisplays())
761 return; 761 return;
762 762
763 UpdateDisplay("500x600,600x400"); 763 UpdateDisplay("500x600,600x400");
764 SystemTray* tray = ash::Shell::GetInstance()->GetPrimarySystemTray(); 764 SystemTray* tray = ash::Shell::GetInstance()->GetPrimarySystemTray();
765 ASSERT_FALSE(tray->HasSystemBubble()); 765 ASSERT_FALSE(tray->HasSystemBubble());
766 766
767 aura::test::EventGenerator& event_generator(GetEventGenerator()); 767 ui::test::EventGenerator& event_generator(GetEventGenerator());
768 768
769 // Opens the tray by a dummy click event and makes sure that adding/removing 769 // Opens the tray by a dummy click event and makes sure that adding/removing
770 // displays doesn't break anything. 770 // displays doesn't break anything.
771 event_generator.MoveMouseToCenterOf(tray->GetWidget()->GetNativeWindow()); 771 event_generator.MoveMouseToCenterOf(tray->GetWidget()->GetNativeWindow());
772 event_generator.ClickLeftButton(); 772 event_generator.ClickLeftButton();
773 EXPECT_TRUE(tray->HasSystemBubble()); 773 EXPECT_TRUE(tray->HasSystemBubble());
774 774
775 UpdateDisplay("500x600"); 775 UpdateDisplay("500x600");
776 EXPECT_TRUE(tray->HasSystemBubble()); 776 EXPECT_TRUE(tray->HasSystemBubble());
777 UpdateDisplay("500x600,600x400"); 777 UpdateDisplay("500x600,600x400");
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after
859 ash::kShellWindowId_LockScreenContainer) 859 ash::kShellWindowId_LockScreenContainer)
860 ->AddChild(lock_widget->GetNativeView()); 860 ->AddChild(lock_widget->GetNativeView());
861 lock_widget->Show(); 861 lock_widget->Show();
862 textfield->RequestFocus(); 862 textfield->RequestFocus();
863 863
864 aura::client::FocusClient* focus_client = 864 aura::client::FocusClient* focus_client =
865 aura::client::GetFocusClient(root_windows[0]); 865 aura::client::GetFocusClient(root_windows[0]);
866 EXPECT_EQ(lock_widget->GetNativeView(), focus_client->GetFocusedWindow()); 866 EXPECT_EQ(lock_widget->GetNativeView(), focus_client->GetFocusedWindow());
867 867
868 // The lock window should get events on both root windows. 868 // The lock window should get events on both root windows.
869 aura::test::EventGenerator& event_generator(GetEventGenerator()); 869 ui::test::EventGenerator& event_generator(GetEventGenerator());
870 870
871 event_generator.set_current_target(root_windows[0]); 871 event_generator.set_current_target(root_windows[0]);
872 event_generator.PressKey(ui::VKEY_A, 0); 872 event_generator.PressKey(ui::VKEY_A, 0);
873 event_generator.ReleaseKey(ui::VKEY_A, 0); 873 event_generator.ReleaseKey(ui::VKEY_A, 0);
874 EXPECT_EQ(lock_widget->GetNativeView(), focus_client->GetFocusedWindow()); 874 EXPECT_EQ(lock_widget->GetNativeView(), focus_client->GetFocusedWindow());
875 EXPECT_EQ("a", base::UTF16ToASCII(textfield->text())); 875 EXPECT_EQ("a", base::UTF16ToASCII(textfield->text()));
876 876
877 event_generator.set_current_target(root_windows[1]); 877 event_generator.set_current_target(root_windows[1]);
878 event_generator.PressKey(ui::VKEY_B, 0); 878 event_generator.PressKey(ui::VKEY_B, 0);
879 event_generator.ReleaseKey(ui::VKEY_B, 0); 879 event_generator.ReleaseKey(ui::VKEY_B, 0);
(...skipping 30 matching lines...) Expand all
910 910
911 EventLocationRecordingEventHandler event_handler; 911 EventLocationRecordingEventHandler event_handler;
912 ash::Shell::GetInstance()->AddPreTargetHandler(&event_handler); 912 ash::Shell::GetInstance()->AddPreTargetHandler(&event_handler);
913 913
914 UpdateDisplay("300x300,200x200"); 914 UpdateDisplay("300x300,200x200");
915 915
916 views::Widget* widget = CreateTestWidget(gfx::Rect(50, 50, 200, 200)); 916 views::Widget* widget = CreateTestWidget(gfx::Rect(50, 50, 200, 200));
917 widget->Show(); 917 widget->Show();
918 ASSERT_EQ("50,50 200x200", widget->GetWindowBoundsInScreen().ToString()); 918 ASSERT_EQ("50,50 200x200", widget->GetWindowBoundsInScreen().ToString());
919 919
920 aura::test::EventGenerator& generator(GetEventGenerator()); 920 ui::test::EventGenerator& generator(GetEventGenerator());
921 generator.MoveMouseTo(150, 150); 921 generator.MoveMouseTo(150, 150);
922 EXPECT_EQ("100,100 150,150", event_handler.GetLocationsAndReset()); 922 EXPECT_EQ("100,100 150,150", event_handler.GetLocationsAndReset());
923 923
924 generator.PressLeftButton(); 924 generator.PressLeftButton();
925 generator.MoveMouseTo(400, 150); 925 generator.MoveMouseTo(400, 150);
926 926
927 EXPECT_EQ("350,100 400,150", event_handler.GetLocationsAndReset()); 927 EXPECT_EQ("350,100 400,150", event_handler.GetLocationsAndReset());
928 928
929 generator.ReleaseLeftButton(); 929 generator.ReleaseLeftButton();
930 EXPECT_EQ("-999,-999 -999,-999", event_handler.GetLocationsAndReset()); 930 EXPECT_EQ("-999,-999 -999,-999", event_handler.GetLocationsAndReset());
931 931
932 generator.MoveMouseTo(400, 150); 932 generator.MoveMouseTo(400, 150);
933 EXPECT_EQ("100,150 100,150", event_handler.GetLocationsAndReset()); 933 EXPECT_EQ("100,150 100,150", event_handler.GetLocationsAndReset());
934 934
935 ash::Shell::GetInstance()->RemovePreTargetHandler(&event_handler); 935 ash::Shell::GetInstance()->RemovePreTargetHandler(&event_handler);
936 } 936 }
937 937
938 } // namespace ash 938 } // namespace ash
OLDNEW
« no previous file with comments | « ash/drag_drop/drag_drop_controller_unittest.cc ('k') | ash/first_run/first_run_helper_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698