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 "chrome/browser/ui/views/tabs/tab_drag_controller_interactive_uitest.h" | 5 #include "chrome/browser/ui/views/tabs/tab_drag_controller_interactive_uitest.h" |
6 | 6 |
| 7 #include <algorithm> |
| 8 |
7 #include "ash/wm/window_state.h" | 9 #include "ash/wm/window_state.h" |
8 #include "base/bind.h" | 10 #include "base/bind.h" |
9 #include "base/callback.h" | 11 #include "base/callback.h" |
10 #include "base/command_line.h" | 12 #include "base/command_line.h" |
11 #include "base/run_loop.h" | 13 #include "base/run_loop.h" |
12 #include "base/strings/string_number_conversions.h" | 14 #include "base/strings/string_number_conversions.h" |
13 #include "chrome/browser/chrome_notification_types.h" | 15 #include "chrome/browser/chrome_notification_types.h" |
14 #include "chrome/browser/ui/browser.h" | 16 #include "chrome/browser/ui/browser.h" |
15 #include "chrome/browser/ui/browser_commands.h" | 17 #include "chrome/browser/ui/browser_commands.h" |
16 #include "chrome/browser/ui/browser_iterator.h" | 18 #include "chrome/browser/ui/browser_iterator.h" |
(...skipping 22 matching lines...) Expand all Loading... |
39 #include "chrome/browser/ui/views/frame/desktop_browser_frame_aura.h" | 41 #include "chrome/browser/ui/views/frame/desktop_browser_frame_aura.h" |
40 #include "ui/views/widget/desktop_aura/desktop_native_widget_aura.h" | 42 #include "ui/views/widget/desktop_aura/desktop_native_widget_aura.h" |
41 #endif | 43 #endif |
42 | 44 |
43 #if defined(USE_ASH) | 45 #if defined(USE_ASH) |
44 #include "ash/display/display_controller.h" | 46 #include "ash/display/display_controller.h" |
45 #include "ash/display/display_manager.h" | 47 #include "ash/display/display_manager.h" |
46 #include "ash/shell.h" | 48 #include "ash/shell.h" |
47 #include "ash/test/cursor_manager_test_api.h" | 49 #include "ash/test/cursor_manager_test_api.h" |
48 #include "ash/wm/coordinate_conversion.h" | 50 #include "ash/wm/coordinate_conversion.h" |
49 #include "ash/wm/window_state.h" | |
50 #include "ash/wm/window_util.h" | 51 #include "ash/wm/window_util.h" |
51 #include "chrome/browser/ui/views/frame/immersive_mode_controller.h" | 52 #include "chrome/browser/ui/views/frame/immersive_mode_controller.h" |
52 #include "ui/aura/client/screen_position_client.h" | 53 #include "ui/aura/client/screen_position_client.h" |
53 #include "ui/aura/test/event_generator.h" | 54 #include "ui/aura/test/event_generator.h" |
54 #include "ui/aura/window_event_dispatcher.h" | 55 #include "ui/aura/window_event_dispatcher.h" |
55 #endif | 56 #endif |
56 | 57 |
57 using content::WebContents; | 58 using content::WebContents; |
58 | 59 |
59 namespace test { | 60 namespace test { |
(...skipping 265 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
325 TabStrip* tab_strip = GetTabStripForBrowser(browser()); | 326 TabStrip* tab_strip = GetTabStripForBrowser(browser()); |
326 | 327 |
327 Tab* tab1 = tab_strip->tab_at(1); | 328 Tab* tab1 = tab_strip->tab_at(1); |
328 gfx::Point tab_1_center(tab1->width() / 2, tab1->height() / 2); | 329 gfx::Point tab_1_center(tab1->width() / 2, tab1->height() / 2); |
329 | 330 |
330 ui::GestureEvent gesture_begin(ui::ET_GESTURE_BEGIN, tab_1_center.x(), | 331 ui::GestureEvent gesture_begin(ui::ET_GESTURE_BEGIN, tab_1_center.x(), |
331 tab_1_center.x(), 0, base::TimeDelta(), | 332 tab_1_center.x(), 0, base::TimeDelta(), |
332 ui::GestureEventDetails(ui::ET_GESTURE_BEGIN, 0.0f, 0.0f), 0); | 333 ui::GestureEventDetails(ui::ET_GESTURE_BEGIN, 0.0f, 0.0f), 0); |
333 tab_strip->MaybeStartDrag(tab1, gesture_begin, | 334 tab_strip->MaybeStartDrag(tab1, gesture_begin, |
334 tab_strip->GetSelectionModel()); | 335 tab_strip->GetSelectionModel()); |
335 //tab_strip->tab_at(1)->OnGestureEvent(&gesture_begin); | |
336 EXPECT_TRUE(TabDragController::IsActive()); | 336 EXPECT_TRUE(TabDragController::IsActive()); |
337 | 337 |
338 ui::GestureEvent gesture_end(ui::ET_GESTURE_END, tab_1_center.x(), | 338 ui::GestureEvent gesture_end(ui::ET_GESTURE_END, tab_1_center.x(), |
339 tab_1_center.x(), 0, base::TimeDelta(), | 339 tab_1_center.x(), 0, base::TimeDelta(), |
340 ui::GestureEventDetails(ui::ET_GESTURE_END, 0.0f, 0.0f), 0); | 340 ui::GestureEventDetails(ui::ET_GESTURE_END, 0.0f, 0.0f), 0); |
341 tab_strip->OnGestureEvent(&gesture_end); | 341 tab_strip->OnGestureEvent(&gesture_end); |
342 EXPECT_FALSE(TabDragController::IsActive()); | 342 EXPECT_FALSE(TabDragController::IsActive()); |
343 EXPECT_FALSE(tab_strip->IsDragSessionActive()); | 343 EXPECT_FALSE(tab_strip->IsDragSessionActive()); |
344 } | 344 } |
345 | 345 |
346 #endif | 346 #endif |
347 | 347 |
348 class DetachToBrowserTabDragControllerTest | 348 class DetachToBrowserTabDragControllerTest |
349 : public TabDragControllerTest, | 349 : public TabDragControllerTest, |
350 public ::testing::WithParamInterface<const char*> { | 350 public ::testing::WithParamInterface<const char*> { |
351 public: | 351 public: |
352 DetachToBrowserTabDragControllerTest() {} | 352 DetachToBrowserTabDragControllerTest() {} |
353 | 353 |
354 virtual void SetUpOnMainThread() OVERRIDE { | 354 virtual void SetUpOnMainThread() OVERRIDE { |
355 #if defined(USE_ASH) && !defined(OS_WIN) // TODO(win_ash) | 355 #if defined(OS_CHROMEOS) |
356 event_generator_.reset(new aura::test::EventGenerator( | 356 event_generator_.reset(new aura::test::EventGenerator( |
357 ash::Shell::GetPrimaryRootWindow())); | 357 ash::Shell::GetPrimaryRootWindow())); |
358 #endif | 358 #endif |
359 } | 359 } |
360 | 360 |
361 InputSource input_source() const { | 361 InputSource input_source() const { |
362 return strstr(GetParam(), "mouse") ? | 362 return strstr(GetParam(), "mouse") ? |
363 INPUT_SOURCE_MOUSE : INPUT_SOURCE_TOUCH; | 363 INPUT_SOURCE_MOUSE : INPUT_SOURCE_TOUCH; |
364 } | 364 } |
365 | 365 |
366 // Set root window from a point in screen coordinates | 366 // Set root window from a point in screen coordinates |
367 void SetEventGeneratorRootWindow(const gfx::Point& point) { | 367 void SetEventGeneratorRootWindow(const gfx::Point& point) { |
368 if (input_source() == INPUT_SOURCE_MOUSE) | 368 if (input_source() == INPUT_SOURCE_MOUSE) |
369 return; | 369 return; |
370 #if defined(USE_ASH) && !defined(OS_WIN) // TODO(win_ash) | 370 #if defined(OS_CHROMEOS) |
371 event_generator_.reset(new aura::test::EventGenerator( | 371 event_generator_.reset(new aura::test::EventGenerator( |
372 new ScreenEventGeneratorDelegate(ash::wm::GetRootWindowAt(point)))); | 372 new ScreenEventGeneratorDelegate(ash::wm::GetRootWindowAt(point)))); |
373 #endif | 373 #endif |
374 } | 374 } |
375 | 375 |
376 // The following methods update one of the mouse or touch input depending upon | 376 // The following methods update one of the mouse or touch input depending upon |
377 // the InputSource. | 377 // the InputSource. |
378 bool PressInput(const gfx::Point& location) { | 378 bool PressInput(const gfx::Point& location) { |
379 if (input_source() == INPUT_SOURCE_MOUSE) { | 379 if (input_source() == INPUT_SOURCE_MOUSE) { |
380 return ui_test_utils::SendMouseMoveSync(location) && | 380 return ui_test_utils::SendMouseMoveSync(location) && |
381 ui_test_utils::SendMouseEventsSync( | 381 ui_test_utils::SendMouseEventsSync( |
382 ui_controls::LEFT, ui_controls::DOWN); | 382 ui_controls::LEFT, ui_controls::DOWN); |
383 } | 383 } |
384 #if defined(USE_ASH) && !defined(OS_WIN) // TODO(win_ash) | 384 #if defined(OS_CHROMEOS) |
385 event_generator_->set_current_location(location); | 385 event_generator_->set_current_location(location); |
386 event_generator_->PressTouch(); | 386 event_generator_->PressTouch(); |
387 #else | 387 #else |
388 NOTREACHED(); | 388 NOTREACHED(); |
389 #endif | 389 #endif |
390 return true; | 390 return true; |
391 } | 391 } |
392 | 392 |
393 bool PressInput2() { | 393 bool PressInput2() { |
394 // Second touch input is only used for touch sequence tests. | 394 // Second touch input is only used for touch sequence tests. |
395 EXPECT_EQ(INPUT_SOURCE_TOUCH, input_source()); | 395 EXPECT_EQ(INPUT_SOURCE_TOUCH, input_source()); |
396 #if defined(USE_ASH) && !defined(OS_WIN) // TODO(win_ash) | 396 #if defined(OS_CHROMEOS) |
397 event_generator_->set_current_location( | 397 event_generator_->set_current_location( |
398 event_generator_->current_location()); | 398 event_generator_->current_location()); |
399 event_generator_->PressTouchId(1); | 399 event_generator_->PressTouchId(1); |
400 #else | 400 #else |
401 NOTREACHED(); | 401 NOTREACHED(); |
402 #endif | 402 #endif |
403 return true; | 403 return true; |
404 } | 404 } |
405 | 405 |
406 bool DragInputTo(const gfx::Point& location) { | 406 bool DragInputTo(const gfx::Point& location) { |
407 if (input_source() == INPUT_SOURCE_MOUSE) | 407 if (input_source() == INPUT_SOURCE_MOUSE) |
408 return ui_test_utils::SendMouseMoveSync(location); | 408 return ui_test_utils::SendMouseMoveSync(location); |
409 #if defined(USE_ASH) && !defined(OS_WIN) // TODO(win_ash) | 409 #if defined(OS_CHROMEOS) |
410 event_generator_->MoveTouch(location); | 410 event_generator_->MoveTouch(location); |
411 #else | 411 #else |
412 NOTREACHED(); | 412 NOTREACHED(); |
413 #endif | 413 #endif |
414 return true; | 414 return true; |
415 } | 415 } |
416 | 416 |
417 bool DragInputToAsync(const gfx::Point& location) { | 417 bool DragInputToAsync(const gfx::Point& location) { |
418 if (input_source() == INPUT_SOURCE_MOUSE) | 418 if (input_source() == INPUT_SOURCE_MOUSE) |
419 return ui_controls::SendMouseMove(location.x(), location.y()); | 419 return ui_controls::SendMouseMove(location.x(), location.y()); |
420 #if defined(USE_ASH) && !defined(OS_WIN) // TODO(win_ash) | 420 #if defined(OS_CHROMEOS) |
421 event_generator_->MoveTouch(location); | 421 event_generator_->MoveTouch(location); |
422 #else | 422 #else |
423 NOTREACHED(); | 423 NOTREACHED(); |
424 #endif | 424 #endif |
425 return true; | 425 return true; |
426 } | 426 } |
427 | 427 |
428 bool DragInputToNotifyWhenDone(int x, | 428 bool DragInputToNotifyWhenDone(int x, |
429 int y, | 429 int y, |
430 const base::Closure& task) { | 430 const base::Closure& task) { |
431 if (input_source() == INPUT_SOURCE_MOUSE) | 431 if (input_source() == INPUT_SOURCE_MOUSE) |
432 return ui_controls::SendMouseMoveNotifyWhenDone(x, y, task); | 432 return ui_controls::SendMouseMoveNotifyWhenDone(x, y, task); |
433 #if defined(USE_ASH) && !defined(OS_WIN) // TODO(win_ash) | 433 #if defined(OS_CHROMEOS) |
434 base::MessageLoop::current()->PostTask(FROM_HERE, task); | 434 base::MessageLoop::current()->PostTask(FROM_HERE, task); |
435 event_generator_->MoveTouch(gfx::Point(x, y)); | 435 event_generator_->MoveTouch(gfx::Point(x, y)); |
436 #else | 436 #else |
437 NOTREACHED(); | 437 NOTREACHED(); |
438 #endif | 438 #endif |
439 return true; | 439 return true; |
440 } | 440 } |
441 | 441 |
442 bool DragInputToDelayedNotifyWhenDone(int x, | 442 bool DragInputToDelayedNotifyWhenDone(int x, |
443 int y, | 443 int y, |
444 const base::Closure& task, | 444 const base::Closure& task, |
445 base::TimeDelta delay) { | 445 base::TimeDelta delay) { |
446 if (input_source() == INPUT_SOURCE_MOUSE) | 446 if (input_source() == INPUT_SOURCE_MOUSE) |
447 return ui_controls::SendMouseMoveNotifyWhenDone(x, y, task); | 447 return ui_controls::SendMouseMoveNotifyWhenDone(x, y, task); |
448 #if defined(USE_ASH) && !defined(OS_WIN) // TODO(win_ash) | 448 #if defined(OS_CHROMEOS) |
449 base::MessageLoop::current()->PostDelayedTask(FROM_HERE, task, delay); | 449 base::MessageLoop::current()->PostDelayedTask(FROM_HERE, task, delay); |
450 event_generator_->MoveTouch(gfx::Point(x, y)); | 450 event_generator_->MoveTouch(gfx::Point(x, y)); |
451 #else | 451 #else |
452 NOTREACHED(); | 452 NOTREACHED(); |
453 #endif | 453 #endif |
454 return true; | 454 return true; |
455 } | 455 } |
456 | 456 |
457 bool DragInput2ToNotifyWhenDone(int x, | 457 bool DragInput2ToNotifyWhenDone(int x, |
458 int y, | 458 int y, |
459 const base::Closure& task) { | 459 const base::Closure& task) { |
460 if (input_source() == INPUT_SOURCE_MOUSE) | 460 if (input_source() == INPUT_SOURCE_MOUSE) |
461 return ui_controls::SendMouseMoveNotifyWhenDone(x, y, task); | 461 return ui_controls::SendMouseMoveNotifyWhenDone(x, y, task); |
462 #if defined(USE_ASH) && !defined(OS_WIN) // TODO(win_ash) | 462 #if defined(OS_CHROMEOS) |
463 base::MessageLoop::current()->PostTask(FROM_HERE, task); | 463 base::MessageLoop::current()->PostTask(FROM_HERE, task); |
464 event_generator_->MoveTouchId(gfx::Point(x, y), 1); | 464 event_generator_->MoveTouchId(gfx::Point(x, y), 1); |
465 #else | 465 #else |
466 NOTREACHED(); | 466 NOTREACHED(); |
467 #endif | 467 #endif |
468 return true; | 468 return true; |
469 } | 469 } |
470 | 470 |
471 bool ReleaseInput() { | 471 bool ReleaseInput() { |
472 if (input_source() == INPUT_SOURCE_MOUSE) { | 472 if (input_source() == INPUT_SOURCE_MOUSE) { |
473 return ui_test_utils::SendMouseEventsSync( | 473 return ui_test_utils::SendMouseEventsSync( |
474 ui_controls::LEFT, ui_controls::UP); | 474 ui_controls::LEFT, ui_controls::UP); |
475 } | 475 } |
476 #if defined(USE_ASH) && !defined(OS_WIN) // TODO(win_ash) | 476 #if defined(OS_CHROMEOS) |
477 event_generator_->ReleaseTouch(); | 477 event_generator_->ReleaseTouch(); |
478 #else | 478 #else |
479 NOTREACHED(); | 479 NOTREACHED(); |
480 #endif | 480 #endif |
481 return true; | 481 return true; |
482 } | 482 } |
483 | 483 |
484 bool ReleaseInput2() { | 484 bool ReleaseInput2() { |
485 if (input_source() == INPUT_SOURCE_MOUSE) { | 485 if (input_source() == INPUT_SOURCE_MOUSE) { |
486 return ui_test_utils::SendMouseEventsSync( | 486 return ui_test_utils::SendMouseEventsSync( |
487 ui_controls::LEFT, ui_controls::UP); | 487 ui_controls::LEFT, ui_controls::UP); |
488 } | 488 } |
489 #if defined(USE_ASH) && !defined(OS_WIN) // TODO(win_ash) | 489 #if defined(OS_CHROMEOS) |
490 event_generator_->ReleaseTouchId(1); | 490 event_generator_->ReleaseTouchId(1); |
491 #else | 491 #else |
492 NOTREACHED(); | 492 NOTREACHED(); |
493 #endif | 493 #endif |
494 return true; | 494 return true; |
495 } | 495 } |
496 | 496 |
497 bool ReleaseMouseAsync() { | 497 bool ReleaseMouseAsync() { |
498 return input_source() == INPUT_SOURCE_MOUSE && | 498 return input_source() == INPUT_SOURCE_MOUSE && |
499 ui_controls::SendMouseEvents(ui_controls::LEFT, ui_controls::UP); | 499 ui_controls::SendMouseEvents(ui_controls::LEFT, ui_controls::UP); |
(...skipping 14 matching lines...) Expand all Loading... |
514 } | 514 } |
515 } | 515 } |
516 | 516 |
517 void AddBlankTabAndShow(Browser* browser) { | 517 void AddBlankTabAndShow(Browser* browser) { |
518 InProcessBrowserTest::AddBlankTabAndShow(browser); | 518 InProcessBrowserTest::AddBlankTabAndShow(browser); |
519 } | 519 } |
520 | 520 |
521 Browser* browser() const { return InProcessBrowserTest::browser(); } | 521 Browser* browser() const { return InProcessBrowserTest::browser(); } |
522 | 522 |
523 private: | 523 private: |
524 #if defined(USE_ASH) && !defined(OS_WIN) // TODO(win_ash) | 524 #if defined(OS_CHROMEOS) |
525 scoped_ptr<aura::test::EventGenerator> event_generator_; | 525 scoped_ptr<aura::test::EventGenerator> event_generator_; |
526 #endif | 526 #endif |
527 | 527 |
528 DISALLOW_COPY_AND_ASSIGN(DetachToBrowserTabDragControllerTest); | 528 DISALLOW_COPY_AND_ASSIGN(DetachToBrowserTabDragControllerTest); |
529 }; | 529 }; |
530 | 530 |
531 // Creates a browser with two tabs, drags the second to the first. | 531 // Creates a browser with two tabs, drags the second to the first. |
532 IN_PROC_BROWSER_TEST_P(DetachToBrowserTabDragControllerTest, DragInSameWindow) { | 532 IN_PROC_BROWSER_TEST_P(DetachToBrowserTabDragControllerTest, DragInSameWindow) { |
533 // TODO(sky): this won't work with touch as it requires a long press. | 533 // TODO(sky): this won't work with touch as it requires a long press. |
534 if (input_source() == INPUT_SOURCE_TOUCH) { | 534 if (input_source() == INPUT_SOURCE_TOUCH) { |
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
629 EXPECT_FALSE(tab_strip2->GetWidget()->HasCapture()); | 629 EXPECT_FALSE(tab_strip2->GetWidget()->HasCapture()); |
630 } | 630 } |
631 | 631 |
632 namespace { | 632 namespace { |
633 | 633 |
634 void DetachToOwnWindowStep2(DetachToBrowserTabDragControllerTest* test) { | 634 void DetachToOwnWindowStep2(DetachToBrowserTabDragControllerTest* test) { |
635 if (test->input_source() == INPUT_SOURCE_TOUCH) | 635 if (test->input_source() == INPUT_SOURCE_TOUCH) |
636 ASSERT_TRUE(test->ReleaseInput()); | 636 ASSERT_TRUE(test->ReleaseInput()); |
637 } | 637 } |
638 | 638 |
639 #if defined(USE_ASH) && !defined(OS_WIN) // TODO(win_ash) | 639 #if defined(OS_CHROMEOS) |
640 bool IsWindowPositionManaged(aura::Window* window) { | 640 bool IsWindowPositionManaged(aura::Window* window) { |
641 return ash::wm::GetWindowState(window)->window_position_managed(); | 641 return ash::wm::GetWindowState(window)->window_position_managed(); |
642 } | 642 } |
643 bool HasUserChangedWindowPositionOrSize(aura::Window* window) { | 643 bool HasUserChangedWindowPositionOrSize(aura::Window* window) { |
644 return ash::wm::GetWindowState(window)->bounds_changed_by_user(); | 644 return ash::wm::GetWindowState(window)->bounds_changed_by_user(); |
645 } | 645 } |
646 #else | 646 #else |
647 bool IsWindowPositionManaged(gfx::NativeWindow window) { | 647 bool IsWindowPositionManaged(gfx::NativeWindow window) { |
648 return true; | 648 return true; |
649 } | 649 } |
(...skipping 246 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
896 Browser* new_browser = browser_list->get(1); | 896 Browser* new_browser = browser_list->get(1); |
897 // This ends up closing the source window. | 897 // This ends up closing the source window. |
898 delete tab; | 898 delete tab; |
899 // Cancel the drag. | 899 // Cancel the drag. |
900 ui_controls::SendKeyPress(new_browser->window()->GetNativeWindow(), | 900 ui_controls::SendKeyPress(new_browser->window()->GetNativeWindow(), |
901 ui::VKEY_ESCAPE, false, false, false, false); | 901 ui::VKEY_ESCAPE, false, false, false, false); |
902 } | 902 } |
903 | 903 |
904 } // namespace | 904 } // namespace |
905 | 905 |
906 #if defined(OS_CHROMEOS) | 906 #if defined(OS_CHROMEOS) || defined(OS_LINUX) |
907 // TODO(sky,sad): Disabled as it fails due to resize locks with a real | 907 // TODO(sky,sad): Disabled as it fails due to resize locks with a real |
908 // compositor. crbug.com/331924 | 908 // compositor. crbug.com/331924 |
909 #define MAYBE_DeleteSourceDetached DISABLED_DeleteSourceDetached | 909 #define MAYBE_DeleteSourceDetached DISABLED_DeleteSourceDetached |
910 #else | 910 #else |
911 #define MAYBE_DeleteSourceDetached DeleteSourceDetached | 911 #define MAYBE_DeleteSourceDetached DeleteSourceDetached |
912 #endif | 912 #endif |
913 // Detaches a tab and while detached deletes a tab from the source so that the | 913 // Detaches a tab and while detached deletes a tab from the source so that the |
914 // source window closes then presses escape to cancel the drag. | 914 // source window closes then presses escape to cancel the drag. |
915 IN_PROC_BROWSER_TEST_P(DetachToBrowserTabDragControllerTest, | 915 IN_PROC_BROWSER_TEST_P(DetachToBrowserTabDragControllerTest, |
916 MAYBE_DeleteSourceDetached) { | 916 MAYBE_DeleteSourceDetached) { |
(...skipping 29 matching lines...) Expand all Loading... |
946 void PressEscapeWhileDetachedStep2(const BrowserList* browser_list) { | 946 void PressEscapeWhileDetachedStep2(const BrowserList* browser_list) { |
947 ASSERT_EQ(2u, browser_list->size()); | 947 ASSERT_EQ(2u, browser_list->size()); |
948 Browser* new_browser = browser_list->get(1); | 948 Browser* new_browser = browser_list->get(1); |
949 ui_controls::SendKeyPress( | 949 ui_controls::SendKeyPress( |
950 new_browser->window()->GetNativeWindow(), ui::VKEY_ESCAPE, false, false, | 950 new_browser->window()->GetNativeWindow(), ui::VKEY_ESCAPE, false, false, |
951 false, false); | 951 false, false); |
952 } | 952 } |
953 | 953 |
954 } // namespace | 954 } // namespace |
955 | 955 |
956 #if defined(OS_CHROMEOS) | 956 #if defined(OS_CHROMEOS) || defined(OS_LINUX) |
957 // TODO(sky,sad): Disabled as it fails due to resize locks with a real | 957 // TODO(sky,sad): Disabled as it fails due to resize locks with a real |
958 // compositor. crbug.com/331924 | 958 // compositor. crbug.com/331924 |
959 #define MAYBE_PressEscapeWhileDetached DISABLED_PressEscapeWhileDetached | 959 #define MAYBE_PressEscapeWhileDetached DISABLED_PressEscapeWhileDetached |
960 #else | 960 #else |
961 #define MAYBE_PressEscapeWhileDetached PressEscapeWhileDetached | 961 #define MAYBE_PressEscapeWhileDetached PressEscapeWhileDetached |
962 #endif | 962 #endif |
963 // This is disabled until NativeViewHost::Detach really detaches. | 963 // This is disabled until NativeViewHost::Detach really detaches. |
964 // Detaches a tab and while detached presses escape to revert the drag. | 964 // Detaches a tab and while detached presses escape to revert the drag. |
965 IN_PROC_BROWSER_TEST_P(DetachToBrowserTabDragControllerTest, | 965 IN_PROC_BROWSER_TEST_P(DetachToBrowserTabDragControllerTest, |
966 MAYBE_PressEscapeWhileDetached) { | 966 MAYBE_PressEscapeWhileDetached) { |
(...skipping 352 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1319 const BrowserList* browser_list) { | 1319 const BrowserList* browser_list) { |
1320 ASSERT_TRUE(TabDragController::IsActive()); | 1320 ASSERT_TRUE(TabDragController::IsActive()); |
1321 ASSERT_EQ(2u, browser_list->size()); | 1321 ASSERT_EQ(2u, browser_list->size()); |
1322 | 1322 |
1323 // Add another tab. This should trigger exiting the nested loop. | 1323 // Add another tab. This should trigger exiting the nested loop. |
1324 test->AddBlankTabAndShow(browser_list->GetLastActive()); | 1324 test->AddBlankTabAndShow(browser_list->GetLastActive()); |
1325 } | 1325 } |
1326 | 1326 |
1327 } // namespace | 1327 } // namespace |
1328 | 1328 |
1329 #if defined(OS_CHROMEOS) | 1329 #if defined(OS_CHROMEOS) || defined(OS_LINUX) |
1330 // TODO(sky,sad): Disabled as it fails due to resize locks with a real | 1330 // TODO(sky,sad): Disabled as it fails due to resize locks with a real |
1331 // compositor. crbug.com/331924 | 1331 // compositor. crbug.com/331924 |
1332 #define MAYBE_CancelOnNewTabWhenDragging DISABLED_CancelOnNewTabWhenDragging | 1332 #define MAYBE_CancelOnNewTabWhenDragging DISABLED_CancelOnNewTabWhenDragging |
1333 #else | 1333 #else |
1334 #define MAYBE_CancelOnNewTabWhenDragging CancelOnNewTabWhenDragging | 1334 #define MAYBE_CancelOnNewTabWhenDragging CancelOnNewTabWhenDragging |
1335 #endif | 1335 #endif |
1336 // Adds another tab, detaches into separate window, adds another tab and | 1336 // Adds another tab, detaches into separate window, adds another tab and |
1337 // verifies the run loop ends. | 1337 // verifies the run loop ends. |
1338 IN_PROC_BROWSER_TEST_P(DetachToBrowserTabDragControllerTest, | 1338 IN_PROC_BROWSER_TEST_P(DetachToBrowserTabDragControllerTest, |
1339 MAYBE_CancelOnNewTabWhenDragging) { | 1339 MAYBE_CancelOnNewTabWhenDragging) { |
(...skipping 14 matching lines...) Expand all Loading... |
1354 // Should be two windows and not dragging. | 1354 // Should be two windows and not dragging. |
1355 ASSERT_FALSE(TabDragController::IsActive()); | 1355 ASSERT_FALSE(TabDragController::IsActive()); |
1356 ASSERT_EQ(2u, native_browser_list->size()); | 1356 ASSERT_EQ(2u, native_browser_list->size()); |
1357 for (chrome::BrowserIterator it; !it.done(); it.Next()) { | 1357 for (chrome::BrowserIterator it; !it.done(); it.Next()) { |
1358 EXPECT_FALSE(GetIsDragged(*it)); | 1358 EXPECT_FALSE(GetIsDragged(*it)); |
1359 // Should not be maximized | 1359 // Should not be maximized |
1360 EXPECT_FALSE(it->window()->IsMaximized()); | 1360 EXPECT_FALSE(it->window()->IsMaximized()); |
1361 } | 1361 } |
1362 } | 1362 } |
1363 | 1363 |
1364 #if defined(USE_ASH) && !defined(OS_WIN) // TODO(win_ash) | 1364 #if defined(OS_CHROMEOS) |
1365 | 1365 // TODO(sky,sad): A number of tests below are disabled as they fail due to |
| 1366 // resize locks with a real compositor. crbug.com/331924 |
1366 namespace { | 1367 namespace { |
1367 | 1368 |
1368 void DragInMaximizedWindowStep2(DetachToBrowserTabDragControllerTest* test, | 1369 void DragInMaximizedWindowStep2(DetachToBrowserTabDragControllerTest* test, |
1369 Browser* browser, | 1370 Browser* browser, |
1370 TabStrip* tab_strip, | 1371 TabStrip* tab_strip, |
1371 const BrowserList* browser_list) { | 1372 const BrowserList* browser_list) { |
1372 // There should be another browser. | 1373 // There should be another browser. |
1373 ASSERT_EQ(2u, browser_list->size()); | 1374 ASSERT_EQ(2u, browser_list->size()); |
1374 Browser* new_browser = browser_list->get(1); | 1375 Browser* new_browser = browser_list->get(1); |
1375 EXPECT_NE(browser, new_browser); | 1376 EXPECT_NE(browser, new_browser); |
1376 ASSERT_TRUE(new_browser->window()->IsActive()); | 1377 ASSERT_TRUE(new_browser->window()->IsActive()); |
1377 TabStrip* tab_strip2 = GetTabStripForBrowser(new_browser); | 1378 TabStrip* tab_strip2 = GetTabStripForBrowser(new_browser); |
1378 | 1379 |
1379 ASSERT_TRUE(tab_strip2->IsDragSessionActive()); | 1380 ASSERT_TRUE(tab_strip2->IsDragSessionActive()); |
1380 ASSERT_FALSE(tab_strip->IsDragSessionActive()); | 1381 ASSERT_FALSE(tab_strip->IsDragSessionActive()); |
1381 | 1382 |
1382 // Both windows should be visible. | 1383 // Both windows should be visible. |
1383 EXPECT_TRUE(tab_strip->GetWidget()->IsVisible()); | 1384 EXPECT_TRUE(tab_strip->GetWidget()->IsVisible()); |
1384 EXPECT_TRUE(tab_strip2->GetWidget()->IsVisible()); | 1385 EXPECT_TRUE(tab_strip2->GetWidget()->IsVisible()); |
1385 | 1386 |
1386 // Stops dragging. | 1387 // Stops dragging. |
1387 ASSERT_TRUE(test->ReleaseInput()); | 1388 ASSERT_TRUE(test->ReleaseInput()); |
1388 } | 1389 } |
1389 | 1390 |
1390 } // namespace | 1391 } // namespace |
1391 | 1392 |
1392 #if defined(OS_CHROMEOS) | |
1393 // TODO(sky,sad): Disabled as it fails due to resize locks with a real | |
1394 // compositor. crbug.com/331924 | |
1395 #define MAYBE_DragInMaximizedWindow DISABLED_DragInMaximizedWindow | |
1396 #else | |
1397 #define MAYBE_DragInMaximizedWindow DragInMaximizedWindow | |
1398 #endif | |
1399 // Creates a browser with two tabs, maximizes it, drags the tab out. | 1393 // Creates a browser with two tabs, maximizes it, drags the tab out. |
1400 IN_PROC_BROWSER_TEST_P(DetachToBrowserTabDragControllerTest, | 1394 IN_PROC_BROWSER_TEST_P(DetachToBrowserTabDragControllerTest, |
1401 MAYBE_DragInMaximizedWindow) { | 1395 DISABLED_DragInMaximizedWindow) { |
1402 AddTabAndResetBrowser(browser()); | 1396 AddTabAndResetBrowser(browser()); |
1403 browser()->window()->Maximize(); | 1397 browser()->window()->Maximize(); |
1404 | 1398 |
1405 TabStrip* tab_strip = GetTabStripForBrowser(browser()); | 1399 TabStrip* tab_strip = GetTabStripForBrowser(browser()); |
1406 | 1400 |
1407 // Move to the first tab and drag it enough so that it detaches. | 1401 // Move to the first tab and drag it enough so that it detaches. |
1408 gfx::Point tab_0_center( | 1402 gfx::Point tab_0_center( |
1409 GetCenterInScreenCoordinates(tab_strip->tab_at(0))); | 1403 GetCenterInScreenCoordinates(tab_strip->tab_at(0))); |
1410 ASSERT_TRUE(PressInput(tab_0_center)); | 1404 ASSERT_TRUE(PressInput(tab_0_center)); |
1411 ASSERT_TRUE(DragInputToNotifyWhenDone( | 1405 ASSERT_TRUE(DragInputToNotifyWhenDone( |
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1475 void DragSingleTabToSeparateWindowInSecondDisplayStep2( | 1469 void DragSingleTabToSeparateWindowInSecondDisplayStep2( |
1476 DetachToBrowserTabDragControllerTest* test, | 1470 DetachToBrowserTabDragControllerTest* test, |
1477 const gfx::Point& target_point) { | 1471 const gfx::Point& target_point) { |
1478 ASSERT_TRUE(test->DragInputToNotifyWhenDone( | 1472 ASSERT_TRUE(test->DragInputToNotifyWhenDone( |
1479 target_point.x(), target_point.y(), | 1473 target_point.x(), target_point.y(), |
1480 base::Bind(&DragSingleTabToSeparateWindowInSecondDisplayStep3, test))); | 1474 base::Bind(&DragSingleTabToSeparateWindowInSecondDisplayStep3, test))); |
1481 } | 1475 } |
1482 | 1476 |
1483 } // namespace | 1477 } // namespace |
1484 | 1478 |
1485 #if defined(OS_CHROMEOS) | |
1486 // TODO(sky,sad): Disabled as it fails due to resize locks with a real | |
1487 // compositor. crbug.com/331924 | |
1488 #define MAYBE_DragSingleTabToSeparateWindowInSecondDisplay \ | |
1489 DISABLED_DragSingleTabToSeparateWindowInSecondDisplay | |
1490 #else | |
1491 #define MAYBE_DragSingleTabToSeparateWindowInSecondDisplay \ | |
1492 DragSingleTabToSeparateWindowInSecondDisplay | |
1493 #endif | |
1494 // Drags from browser to a second display and releases input. | 1479 // Drags from browser to a second display and releases input. |
1495 IN_PROC_BROWSER_TEST_P(DetachToBrowserInSeparateDisplayTabDragControllerTest, | 1480 IN_PROC_BROWSER_TEST_P(DetachToBrowserInSeparateDisplayTabDragControllerTest, |
1496 MAYBE_DragSingleTabToSeparateWindowInSecondDisplay) { | 1481 DISABLED_DragSingleTabToSeparateWindowInSecondDisplay) { |
1497 // Add another tab. | 1482 // Add another tab. |
1498 AddTabAndResetBrowser(browser()); | 1483 AddTabAndResetBrowser(browser()); |
1499 TabStrip* tab_strip = GetTabStripForBrowser(browser()); | 1484 TabStrip* tab_strip = GetTabStripForBrowser(browser()); |
1500 | 1485 |
1501 // Move to the first tab and drag it enough so that it detaches. | 1486 // Move to the first tab and drag it enough so that it detaches. |
1502 // Then drag it to the final destination on the second screen. | 1487 // Then drag it to the final destination on the second screen. |
1503 gfx::Point tab_0_center(GetCenterInScreenCoordinates(tab_strip->tab_at(0))); | 1488 gfx::Point tab_0_center(GetCenterInScreenCoordinates(tab_strip->tab_at(0))); |
1504 ASSERT_TRUE(PressInput(tab_0_center)); | 1489 ASSERT_TRUE(PressInput(tab_0_center)); |
1505 ASSERT_TRUE(DragInputToNotifyWhenDone( | 1490 ASSERT_TRUE(DragInputToNotifyWhenDone( |
1506 tab_0_center.x(), tab_0_center.y() + GetDetachY(tab_strip), | 1491 tab_0_center.x(), tab_0_center.y() + GetDetachY(tab_strip), |
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1557 GetCenterInScreenCoordinates(target_tab_strip->tab_at(0))); | 1542 GetCenterInScreenCoordinates(target_tab_strip->tab_at(0))); |
1558 | 1543 |
1559 // Move it close to the beginning of the target tabstrip. | 1544 // Move it close to the beginning of the target tabstrip. |
1560 target_point.set_x( | 1545 target_point.set_x( |
1561 target_point.x() - target_tab_strip->tab_at(0)->width() / 2 + 10); | 1546 target_point.x() - target_tab_strip->tab_at(0)->width() / 2 + 10); |
1562 ASSERT_TRUE(test->DragInputToAsync(target_point)); | 1547 ASSERT_TRUE(test->DragInputToAsync(target_point)); |
1563 } | 1548 } |
1564 | 1549 |
1565 } // namespace | 1550 } // namespace |
1566 | 1551 |
1567 #if defined(OS_CHROMEOS) | |
1568 // TODO(sky,sad): Disabled as it fails due to resize locks with a real | |
1569 // compositor. crbug.com/331924 | |
1570 #define MAYBE_DragTabToWindowInSeparateDisplay \ | |
1571 DISABLED_DragTabToWindowInSeparateDisplay | |
1572 #else | |
1573 #define MAYBE_DragTabToWindowInSeparateDisplay DragTabToWindowInSeparateDisplay | |
1574 #endif | |
1575 // Drags from browser to another browser on a second display and releases input. | 1552 // Drags from browser to another browser on a second display and releases input. |
1576 IN_PROC_BROWSER_TEST_P(DetachToBrowserInSeparateDisplayTabDragControllerTest, | 1553 IN_PROC_BROWSER_TEST_P(DetachToBrowserInSeparateDisplayTabDragControllerTest, |
1577 MAYBE_DragTabToWindowInSeparateDisplay) { | 1554 DISABLED_DragTabToWindowInSeparateDisplay) { |
1578 // Add another tab. | 1555 // Add another tab. |
1579 AddTabAndResetBrowser(browser()); | 1556 AddTabAndResetBrowser(browser()); |
1580 TabStrip* tab_strip = GetTabStripForBrowser(browser()); | 1557 TabStrip* tab_strip = GetTabStripForBrowser(browser()); |
1581 | 1558 |
1582 // Create another browser. | 1559 // Create another browser. |
1583 Browser* browser2 = CreateBrowser(browser()->profile()); | 1560 Browser* browser2 = CreateBrowser(browser()->profile()); |
1584 TabStrip* tab_strip2 = GetTabStripForBrowser(browser2); | 1561 TabStrip* tab_strip2 = GetTabStripForBrowser(browser2); |
1585 ResetIDs(browser2->tab_strip_model(), 100); | 1562 ResetIDs(browser2->tab_strip_model(), 100); |
1586 | 1563 |
1587 // Move the second browser to the second display. | 1564 // Move the second browser to the second display. |
(...skipping 27 matching lines...) Expand all Loading... |
1615 ASSERT_FALSE(tab_strip->IsDragSessionActive()); | 1592 ASSERT_FALSE(tab_strip->IsDragSessionActive()); |
1616 ASSERT_FALSE(TabDragController::IsActive()); | 1593 ASSERT_FALSE(TabDragController::IsActive()); |
1617 EXPECT_EQ("0 100", IDString(browser2->tab_strip_model())); | 1594 EXPECT_EQ("0 100", IDString(browser2->tab_strip_model())); |
1618 EXPECT_EQ("1", IDString(browser()->tab_strip_model())); | 1595 EXPECT_EQ("1", IDString(browser()->tab_strip_model())); |
1619 | 1596 |
1620 // Both windows should not be maximized | 1597 // Both windows should not be maximized |
1621 EXPECT_FALSE(browser()->window()->IsMaximized()); | 1598 EXPECT_FALSE(browser()->window()->IsMaximized()); |
1622 EXPECT_FALSE(browser2->window()->IsMaximized()); | 1599 EXPECT_FALSE(browser2->window()->IsMaximized()); |
1623 } | 1600 } |
1624 | 1601 |
1625 #if defined(OS_CHROMEOS) | |
1626 // TODO(sky,sad): Disabled as it fails due to resize locks with a real | |
1627 // compositor. crbug.com/331924 | |
1628 #define MAYBE_DragTabToWindowOnSecondDisplay \ | |
1629 DISABLED_DragTabToWindowOnSecondDisplay | |
1630 #else | |
1631 #define MAYBE_DragTabToWindowOnSecondDisplay DragTabToWindowOnSecondDisplay | |
1632 #endif | |
1633 // Drags from browser to another browser on a second display and releases input. | 1602 // Drags from browser to another browser on a second display and releases input. |
1634 IN_PROC_BROWSER_TEST_P(DetachToBrowserInSeparateDisplayTabDragControllerTest, | 1603 IN_PROC_BROWSER_TEST_P(DetachToBrowserInSeparateDisplayTabDragControllerTest, |
1635 MAYBE_DragTabToWindowOnSecondDisplay) { | 1604 DISABLED_DragTabToWindowOnSecondDisplay) { |
1636 // Add another tab. | 1605 // Add another tab. |
1637 AddTabAndResetBrowser(browser()); | 1606 AddTabAndResetBrowser(browser()); |
1638 TabStrip* tab_strip = GetTabStripForBrowser(browser()); | 1607 TabStrip* tab_strip = GetTabStripForBrowser(browser()); |
1639 | 1608 |
1640 // Create another browser. | 1609 // Create another browser. |
1641 Browser* browser2 = CreateBrowser(browser()->profile()); | 1610 Browser* browser2 = CreateBrowser(browser()->profile()); |
1642 TabStrip* tab_strip2 = GetTabStripForBrowser(browser2); | 1611 TabStrip* tab_strip2 = GetTabStripForBrowser(browser2); |
1643 ResetIDs(browser2->tab_strip_model(), 100); | 1612 ResetIDs(browser2->tab_strip_model(), 100); |
1644 | 1613 |
1645 // Move both browsers to the second display. | 1614 // Move both browsers to the second display. |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1685 ASSERT_FALSE(tab_strip->IsDragSessionActive()); | 1654 ASSERT_FALSE(tab_strip->IsDragSessionActive()); |
1686 ASSERT_FALSE(TabDragController::IsActive()); | 1655 ASSERT_FALSE(TabDragController::IsActive()); |
1687 EXPECT_EQ("0 100", IDString(browser2->tab_strip_model())); | 1656 EXPECT_EQ("0 100", IDString(browser2->tab_strip_model())); |
1688 EXPECT_EQ("1", IDString(browser()->tab_strip_model())); | 1657 EXPECT_EQ("1", IDString(browser()->tab_strip_model())); |
1689 | 1658 |
1690 // Both windows should not be maximized | 1659 // Both windows should not be maximized |
1691 EXPECT_FALSE(browser()->window()->IsMaximized()); | 1660 EXPECT_FALSE(browser()->window()->IsMaximized()); |
1692 EXPECT_FALSE(browser2->window()->IsMaximized()); | 1661 EXPECT_FALSE(browser2->window()->IsMaximized()); |
1693 } | 1662 } |
1694 | 1663 |
1695 #if defined(OS_CHROMEOS) | |
1696 // TODO(sky,sad): Disabled as it fails due to resize locks with a real | |
1697 // compositor. crbug.com/331924 | |
1698 #define MAYBE_DragMaxTabToNonMaxWindowInSeparateDisplay \ | |
1699 DISABLED_DragMaxTabToNonMaxWindowInSeparateDisplay | |
1700 #else | |
1701 #define MAYBE_DragMaxTabToNonMaxWindowInSeparateDisplay \ | |
1702 DragMaxTabToNonMaxWindowInSeparateDisplay | |
1703 #endif | |
1704 // Drags from a maximized browser to another non-maximized browser on a second | 1664 // Drags from a maximized browser to another non-maximized browser on a second |
1705 // display and releases input. | 1665 // display and releases input. |
1706 IN_PROC_BROWSER_TEST_P(DetachToBrowserInSeparateDisplayTabDragControllerTest, | 1666 IN_PROC_BROWSER_TEST_P(DetachToBrowserInSeparateDisplayTabDragControllerTest, |
1707 MAYBE_DragMaxTabToNonMaxWindowInSeparateDisplay) { | 1667 DISABLED_DragMaxTabToNonMaxWindowInSeparateDisplay) { |
1708 // Add another tab. | 1668 // Add another tab. |
1709 AddTabAndResetBrowser(browser()); | 1669 AddTabAndResetBrowser(browser()); |
1710 browser()->window()->Maximize(); | 1670 browser()->window()->Maximize(); |
1711 TabStrip* tab_strip = GetTabStripForBrowser(browser()); | 1671 TabStrip* tab_strip = GetTabStripForBrowser(browser()); |
1712 | 1672 |
1713 // Create another browser on the second display. | 1673 // Create another browser on the second display. |
1714 aura::Window::Windows roots = ash::Shell::GetAllRootWindows(); | 1674 aura::Window::Windows roots = ash::Shell::GetAllRootWindows(); |
1715 ASSERT_EQ(2u, roots.size()); | 1675 ASSERT_EQ(2u, roots.size()); |
1716 aura::Window* first_root = roots[0]; | 1676 aura::Window* first_root = roots[0]; |
1717 aura::Window* second_root = roots[1]; | 1677 aura::Window* second_root = roots[1]; |
1718 gfx::Rect work_area = gfx::Screen::GetNativeScreen()->GetDisplayNearestWindow( | 1678 gfx::Rect work_area = gfx::Screen::GetNativeScreen()->GetDisplayNearestWindow( |
1719 second_root).work_area(); | 1679 second_root).work_area(); |
1720 work_area.Inset(20,20,20,60); | 1680 work_area.Inset(20, 20, 20, 60); |
1721 Browser::CreateParams params(browser()->profile(), | 1681 Browser::CreateParams params(browser()->profile(), |
1722 browser()->host_desktop_type()); | 1682 browser()->host_desktop_type()); |
1723 params.initial_show_state = ui::SHOW_STATE_NORMAL; | 1683 params.initial_show_state = ui::SHOW_STATE_NORMAL; |
1724 params.initial_bounds = work_area; | 1684 params.initial_bounds = work_area; |
1725 Browser* browser2 = new Browser(params); | 1685 Browser* browser2 = new Browser(params); |
1726 AddBlankTabAndShow(browser2); | 1686 AddBlankTabAndShow(browser2); |
1727 | 1687 |
1728 TabStrip* tab_strip2 = GetTabStripForBrowser(browser2); | 1688 TabStrip* tab_strip2 = GetTabStripForBrowser(browser2); |
1729 ResetIDs(browser2->tab_strip_model(), 100); | 1689 ResetIDs(browser2->tab_strip_model(), 100); |
1730 | 1690 |
(...skipping 30 matching lines...) Expand all Loading... |
1761 ASSERT_FALSE(tab_strip->IsDragSessionActive()); | 1721 ASSERT_FALSE(tab_strip->IsDragSessionActive()); |
1762 ASSERT_FALSE(TabDragController::IsActive()); | 1722 ASSERT_FALSE(TabDragController::IsActive()); |
1763 EXPECT_EQ("0 100", IDString(browser2->tab_strip_model())); | 1723 EXPECT_EQ("0 100", IDString(browser2->tab_strip_model())); |
1764 EXPECT_EQ("1", IDString(browser()->tab_strip_model())); | 1724 EXPECT_EQ("1", IDString(browser()->tab_strip_model())); |
1765 | 1725 |
1766 // Source browser should still be maximized, target should not | 1726 // Source browser should still be maximized, target should not |
1767 EXPECT_TRUE(browser()->window()->IsMaximized()); | 1727 EXPECT_TRUE(browser()->window()->IsMaximized()); |
1768 EXPECT_FALSE(browser2->window()->IsMaximized()); | 1728 EXPECT_FALSE(browser2->window()->IsMaximized()); |
1769 } | 1729 } |
1770 | 1730 |
1771 // Immersive fullscreen is Ash only. However, Windows Ash does not support | |
1772 // multiple displays. | |
1773 #if defined(OS_CHROMEOS) | |
1774 // TODO(sky,sad): Disabled as it fails due to resize locks with a real | |
1775 // compositor. crbug.com/331924 | |
1776 #define MAYBE_DragTabToImmersiveBrowserOnSeparateDisplay \ | |
1777 DISABLED_DragTabToImmersiveBrowserOnSeparateDisplay | |
1778 // Drags from a restored browser to an immersive fullscreen browser on a | 1731 // Drags from a restored browser to an immersive fullscreen browser on a |
1779 // second display and releases input. | 1732 // second display and releases input. |
1780 IN_PROC_BROWSER_TEST_P(DetachToBrowserInSeparateDisplayTabDragControllerTest, | 1733 IN_PROC_BROWSER_TEST_P(DetachToBrowserInSeparateDisplayTabDragControllerTest, |
1781 MAYBE_DragTabToImmersiveBrowserOnSeparateDisplay) { | 1734 DISABLED_DragTabToImmersiveBrowserOnSeparateDisplay) { |
1782 // Add another tab. | 1735 // Add another tab. |
1783 AddTabAndResetBrowser(browser()); | 1736 AddTabAndResetBrowser(browser()); |
1784 TabStrip* tab_strip = GetTabStripForBrowser(browser()); | 1737 TabStrip* tab_strip = GetTabStripForBrowser(browser()); |
1785 | 1738 |
1786 // Create another browser. | 1739 // Create another browser. |
1787 Browser* browser2 = CreateBrowser(browser()->profile()); | 1740 Browser* browser2 = CreateBrowser(browser()->profile()); |
1788 TabStrip* tab_strip2 = GetTabStripForBrowser(browser2); | 1741 TabStrip* tab_strip2 = GetTabStripForBrowser(browser2); |
1789 ResetIDs(browser2->tab_strip_model(), 100); | 1742 ResetIDs(browser2->tab_strip_model(), 100); |
1790 | 1743 |
1791 // Move the second browser to the second display. | 1744 // Move the second browser to the second display. |
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1844 // The first browser window should not be in immersive fullscreen. | 1797 // The first browser window should not be in immersive fullscreen. |
1845 // browser2 should still be in immersive fullscreen, but the top chrome should | 1798 // browser2 should still be in immersive fullscreen, but the top chrome should |
1846 // no longer be revealed. | 1799 // no longer be revealed. |
1847 BrowserView* browser_view = BrowserView::GetBrowserViewForBrowser(browser()); | 1800 BrowserView* browser_view = BrowserView::GetBrowserViewForBrowser(browser()); |
1848 EXPECT_FALSE(browser_view->immersive_mode_controller()->IsEnabled()); | 1801 EXPECT_FALSE(browser_view->immersive_mode_controller()->IsEnabled()); |
1849 | 1802 |
1850 EXPECT_TRUE(immersive_controller2->IsEnabled()); | 1803 EXPECT_TRUE(immersive_controller2->IsEnabled()); |
1851 EXPECT_FALSE(immersive_controller2->IsRevealed()); | 1804 EXPECT_FALSE(immersive_controller2->IsRevealed()); |
1852 EXPECT_TRUE(tab_strip2->IsImmersiveStyle()); | 1805 EXPECT_TRUE(tab_strip2->IsImmersiveStyle()); |
1853 } | 1806 } |
1854 #endif // OS_CHROMEOS | |
1855 | 1807 |
1856 // Subclass of DetachToBrowserTabDragControllerTest that | 1808 // Subclass of DetachToBrowserTabDragControllerTest that |
1857 // creates multiple displays with different device scale factors. | 1809 // creates multiple displays with different device scale factors. |
1858 class DifferentDeviceScaleFactorDisplayTabDragControllerTest | 1810 class DifferentDeviceScaleFactorDisplayTabDragControllerTest |
1859 : public DetachToBrowserTabDragControllerTest { | 1811 : public DetachToBrowserTabDragControllerTest { |
1860 public: | 1812 public: |
1861 DifferentDeviceScaleFactorDisplayTabDragControllerTest() {} | 1813 DifferentDeviceScaleFactorDisplayTabDragControllerTest() {} |
1862 virtual ~DifferentDeviceScaleFactorDisplayTabDragControllerTest() {} | 1814 virtual ~DifferentDeviceScaleFactorDisplayTabDragControllerTest() {} |
1863 | 1815 |
1864 virtual void SetUpCommandLine(CommandLine* command_line) OVERRIDE { | 1816 virtual void SetUpCommandLine(CommandLine* command_line) OVERRIDE { |
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1924 } else { | 1876 } else { |
1925 // Finishes a serise of CursorDeviceScaleFactorStep calls and ends drag. | 1877 // Finishes a serise of CursorDeviceScaleFactorStep calls and ends drag. |
1926 EXPECT_EQ(1.0f, test->GetCursorDeviceScaleFactor()); | 1878 EXPECT_EQ(1.0f, test->GetCursorDeviceScaleFactor()); |
1927 ASSERT_TRUE(ui_test_utils::SendMouseEventsSync( | 1879 ASSERT_TRUE(ui_test_utils::SendMouseEventsSync( |
1928 ui_controls::LEFT, ui_controls::UP)); | 1880 ui_controls::LEFT, ui_controls::UP)); |
1929 } | 1881 } |
1930 } | 1882 } |
1931 | 1883 |
1932 } // namespace | 1884 } // namespace |
1933 | 1885 |
1934 #if defined(OS_CHROMEOS) | |
1935 // TODO(sky,sad): Disabled as it fails due to resize locks with a real | |
1936 // compositor. crbug.com/331924 | |
1937 #define MAYBE_CursorDeviceScaleFactor DISABLED_CursorDeviceScaleFactor | |
1938 #else | |
1939 #define MAYBE_CursorDeviceScaleFactor CursorDeviceScaleFactor | |
1940 #endif | |
1941 // Verifies cursor's device scale factor is updated when a tab is moved across | 1886 // Verifies cursor's device scale factor is updated when a tab is moved across |
1942 // displays with different device scale factors (http://crbug.com/154183). | 1887 // displays with different device scale factors (http://crbug.com/154183). |
1943 IN_PROC_BROWSER_TEST_P(DifferentDeviceScaleFactorDisplayTabDragControllerTest, | 1888 IN_PROC_BROWSER_TEST_P(DifferentDeviceScaleFactorDisplayTabDragControllerTest, |
1944 MAYBE_CursorDeviceScaleFactor) { | 1889 DISABLED_CursorDeviceScaleFactor) { |
1945 // Add another tab. | 1890 // Add another tab. |
1946 AddTabAndResetBrowser(browser()); | 1891 AddTabAndResetBrowser(browser()); |
1947 TabStrip* tab_strip = GetTabStripForBrowser(browser()); | 1892 TabStrip* tab_strip = GetTabStripForBrowser(browser()); |
1948 | 1893 |
1949 // Move the second browser to the second display. | 1894 // Move the second browser to the second display. |
1950 aura::Window::Windows roots = ash::Shell::GetAllRootWindows(); | 1895 aura::Window::Windows roots = ash::Shell::GetAllRootWindows(); |
1951 ASSERT_EQ(2u, roots.size()); | 1896 ASSERT_EQ(2u, roots.size()); |
1952 | 1897 |
1953 // Move to the first tab and drag it enough so that it detaches. | 1898 // Move to the first tab and drag it enough so that it detaches. |
1954 gfx::Point tab_0_center(GetCenterInScreenCoordinates(tab_strip->tab_at(0))); | 1899 gfx::Point tab_0_center(GetCenterInScreenCoordinates(tab_strip->tab_at(0))); |
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2025 new_browser->window()->GetNativeWindow()->GetRootWindow()); | 1970 new_browser->window()->GetNativeWindow()->GetRootWindow()); |
2026 | 1971 |
2027 ASSERT_TRUE(test->DragTabAndExecuteTaskWhenDone( | 1972 ASSERT_TRUE(test->DragTabAndExecuteTaskWhenDone( |
2028 final_destination, | 1973 final_destination, |
2029 base::Bind(&CancelDragTabToWindowInSeparateDisplayStep3, | 1974 base::Bind(&CancelDragTabToWindowInSeparateDisplayStep3, |
2030 tab_strip, browser_list))); | 1975 tab_strip, browser_list))); |
2031 } | 1976 } |
2032 | 1977 |
2033 } // namespace | 1978 } // namespace |
2034 | 1979 |
2035 #if defined(OS_CHROMEOS) || defined(OS_LINUX) | |
2036 // TODO(sky,sad): Disabled as it fails due to resize locks with a real | |
2037 // compositor. crbug.com/331924 | |
2038 #define MAYBE_CancelDragTabToWindowIn2ndDisplay \ | |
2039 DISABLED_CancelDragTabToWindowIn2ndDisplay | |
2040 #else | |
2041 #define MAYBE_CancelDragTabToWindowIn2ndDisplay \ | |
2042 CancelDragTabToWindowIn2ndDisplay | |
2043 #endif | |
2044 // Drags from browser to a second display and releases input. | 1980 // Drags from browser to a second display and releases input. |
2045 IN_PROC_BROWSER_TEST_F( | 1981 IN_PROC_BROWSER_TEST_F( |
2046 DetachToBrowserInSeparateDisplayAndCancelTabDragControllerTest, | 1982 DetachToBrowserInSeparateDisplayAndCancelTabDragControllerTest, |
2047 MAYBE_CancelDragTabToWindowIn2ndDisplay) { | 1983 DISABLED_CancelDragTabToWindowIn2ndDisplay) { |
2048 // Add another tab. | 1984 // Add another tab. |
2049 AddTabAndResetBrowser(browser()); | 1985 AddTabAndResetBrowser(browser()); |
2050 TabStrip* tab_strip = GetTabStripForBrowser(browser()); | 1986 TabStrip* tab_strip = GetTabStripForBrowser(browser()); |
2051 | 1987 |
2052 EXPECT_EQ("0 1", IDString(browser()->tab_strip_model())); | 1988 EXPECT_EQ("0 1", IDString(browser()->tab_strip_model())); |
2053 | 1989 |
2054 // Move the second browser to the second display. | 1990 // Move the second browser to the second display. |
2055 aura::Window::Windows roots = ash::Shell::GetAllRootWindows(); | 1991 aura::Window::Windows roots = ash::Shell::GetAllRootWindows(); |
2056 ASSERT_EQ(2u, roots.size()); | 1992 ASSERT_EQ(2u, roots.size()); |
2057 gfx::Point final_destination = | 1993 gfx::Point final_destination = |
(...skipping 14 matching lines...) Expand all Loading... |
2072 ASSERT_EQ(1u, native_browser_list->size()); | 2008 ASSERT_EQ(1u, native_browser_list->size()); |
2073 ASSERT_FALSE(tab_strip->IsDragSessionActive()); | 2009 ASSERT_FALSE(tab_strip->IsDragSessionActive()); |
2074 ASSERT_FALSE(TabDragController::IsActive()); | 2010 ASSERT_FALSE(TabDragController::IsActive()); |
2075 EXPECT_EQ("0 1", IDString(browser()->tab_strip_model())); | 2011 EXPECT_EQ("0 1", IDString(browser()->tab_strip_model())); |
2076 | 2012 |
2077 // Release the mouse | 2013 // Release the mouse |
2078 ASSERT_TRUE(ui_test_utils::SendMouseEventsSync( | 2014 ASSERT_TRUE(ui_test_utils::SendMouseEventsSync( |
2079 ui_controls::LEFT, ui_controls::UP)); | 2015 ui_controls::LEFT, ui_controls::UP)); |
2080 } | 2016 } |
2081 | 2017 |
2082 #if defined(OS_CHROMEOS) || defined(OS_LINUX) | |
2083 // TODO(sky,sad): Disabled as it fails due to resize locks with a real | |
2084 // compositor. crbug.com/331924 | |
2085 #define MAYBE_CancelDragTabToWindowIn1stDisplay \ | |
2086 DISABLED_CancelDragTabToWindowIn1stDisplay | |
2087 #else | |
2088 #define MAYBE_CancelDragTabToWindowIn1stDisplay \ | |
2089 CancelDragTabToWindowIn1stDisplay | |
2090 #endif | |
2091 // Drags from browser from a second display to primary and releases input. | 2018 // Drags from browser from a second display to primary and releases input. |
2092 IN_PROC_BROWSER_TEST_F( | 2019 IN_PROC_BROWSER_TEST_F( |
2093 DetachToBrowserInSeparateDisplayAndCancelTabDragControllerTest, | 2020 DetachToBrowserInSeparateDisplayAndCancelTabDragControllerTest, |
2094 MAYBE_CancelDragTabToWindowIn1stDisplay) { | 2021 DISABLED_CancelDragTabToWindowIn1stDisplay) { |
2095 aura::Window::Windows roots = ash::Shell::GetAllRootWindows(); | 2022 aura::Window::Windows roots = ash::Shell::GetAllRootWindows(); |
2096 ASSERT_EQ(2u, roots.size()); | 2023 ASSERT_EQ(2u, roots.size()); |
2097 | 2024 |
2098 // Add another tab. | 2025 // Add another tab. |
2099 AddTabAndResetBrowser(browser()); | 2026 AddTabAndResetBrowser(browser()); |
2100 TabStrip* tab_strip = GetTabStripForBrowser(browser()); | 2027 TabStrip* tab_strip = GetTabStripForBrowser(browser()); |
2101 | 2028 |
2102 EXPECT_EQ("0 1", IDString(browser()->tab_strip_model())); | 2029 EXPECT_EQ("0 1", IDString(browser()->tab_strip_model())); |
2103 EXPECT_EQ(roots[0], browser()->window()->GetNativeWindow()->GetRootWindow()); | 2030 EXPECT_EQ(roots[0], browser()->window()->GetNativeWindow()->GetRootWindow()); |
2104 | 2031 |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2140 ASSERT_TRUE(TabDragController::IsActive()); | 2067 ASSERT_TRUE(TabDragController::IsActive()); |
2141 ASSERT_EQ(2u, test->native_browser_list->size()); | 2068 ASSERT_EQ(2u, test->native_browser_list->size()); |
2142 Browser* new_browser = test->native_browser_list->get(1); | 2069 Browser* new_browser = test->native_browser_list->get(1); |
2143 ASSERT_TRUE(new_browser->window()->IsActive()); | 2070 ASSERT_TRUE(new_browser->window()->IsActive()); |
2144 | 2071 |
2145 ASSERT_TRUE(test->PressInput2()); | 2072 ASSERT_TRUE(test->PressInput2()); |
2146 } | 2073 } |
2147 | 2074 |
2148 } // namespace | 2075 } // namespace |
2149 | 2076 |
2150 #if defined(OS_CHROMEOS) | |
2151 // TODO(sky,sad): Disabled as it fails due to resize locks with a real | |
2152 // compositor. crbug.com/331924 | |
2153 #define MAYBE_PressSecondFingerWhileDetached DISABLED_PressSecondFingerWhileDeta
ched | |
2154 #else | |
2155 #define MAYBE_PressSecondFingerWhileDetached PressSecondFingerWhileDetached | |
2156 #endif | |
2157 // Detaches a tab and while detached presses a second finger. | 2077 // Detaches a tab and while detached presses a second finger. |
2158 IN_PROC_BROWSER_TEST_P(DetachToBrowserTabDragControllerTestTouch, | 2078 IN_PROC_BROWSER_TEST_P(DetachToBrowserTabDragControllerTestTouch, |
2159 MAYBE_PressSecondFingerWhileDetached) { | 2079 DISABLED_PressSecondFingerWhileDetached) { |
2160 gfx::Rect bounds(browser()->window()->GetBounds()); | 2080 gfx::Rect bounds(browser()->window()->GetBounds()); |
2161 // Add another tab. | 2081 // Add another tab. |
2162 AddTabAndResetBrowser(browser()); | 2082 AddTabAndResetBrowser(browser()); |
2163 TabStrip* tab_strip = GetTabStripForBrowser(browser()); | 2083 TabStrip* tab_strip = GetTabStripForBrowser(browser()); |
2164 EXPECT_EQ("0 1", IDString(browser()->tab_strip_model())); | 2084 EXPECT_EQ("0 1", IDString(browser()->tab_strip_model())); |
2165 | 2085 |
2166 // Move to the first tab and drag it enough so that it detaches. | 2086 // Move to the first tab and drag it enough so that it detaches. |
2167 gfx::Point tab_0_center( | 2087 gfx::Point tab_0_center( |
2168 GetCenterInScreenCoordinates(tab_strip->tab_at(0))); | 2088 GetCenterInScreenCoordinates(tab_strip->tab_at(0))); |
2169 ASSERT_TRUE(PressInput(tab_0_center)); | 2089 ASSERT_TRUE(PressInput(tab_0_center)); |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2202 ASSERT_TRUE(test->DragInputToNotifyWhenDone( | 2122 ASSERT_TRUE(test->DragInputToNotifyWhenDone( |
2203 target_point.x(), target_point.y(), | 2123 target_point.x(), target_point.y(), |
2204 base::Bind(&DetachToDockedWindowNextStep, | 2124 base::Bind(&DetachToDockedWindowNextStep, |
2205 test, | 2125 test, |
2206 gfx::Point(target_point.x(), 1 + target_point.y()), | 2126 gfx::Point(target_point.x(), 1 + target_point.y()), |
2207 iteration - 1))); | 2127 iteration - 1))); |
2208 } | 2128 } |
2209 | 2129 |
2210 } // namespace | 2130 } // namespace |
2211 | 2131 |
2212 #if defined(OS_CHROMEOS) | |
2213 // TODO(sky,sad): Disabled as it fails due to resize locks with a real | |
2214 // compositor. crbug.com/331924 | |
2215 #define MAYBE_DetachToDockedWindowFromMaximizedWindow \ | |
2216 DISABLED_DetachToDockedWindowFromMaximizedWindow | |
2217 #else | |
2218 #define MAYBE_DetachToDockedWindowFromMaximizedWindow \ | |
2219 DetachToDockedWindowFromMaximizedWindow | |
2220 #endif | |
2221 // Drags from browser to separate window, docks that window and releases mouse. | 2132 // Drags from browser to separate window, docks that window and releases mouse. |
2222 IN_PROC_BROWSER_TEST_F(DetachToBrowserTabDragControllerTest, | 2133 IN_PROC_BROWSER_TEST_P(DetachToBrowserTabDragControllerTest, |
2223 MAYBE_DetachToDockedWindowFromMaximizedWindow) { | 2134 DISABLED_DetachToDockedWindowFromMaximizedWindow) { |
2224 // Maximize the initial browser window. | 2135 // Maximize the initial browser window. |
2225 browser()->window()->Maximize(); | 2136 browser()->window()->Maximize(); |
2226 ASSERT_TRUE(browser()->window()->IsMaximized()); | 2137 ASSERT_TRUE(browser()->window()->IsMaximized()); |
2227 | 2138 |
2228 // Add another tab. | 2139 // Add another tab. |
2229 AddTabAndResetBrowser(browser()); | 2140 AddTabAndResetBrowser(browser()); |
2230 TabStrip* tab_strip = GetTabStripForBrowser(browser()); | 2141 TabStrip* tab_strip = GetTabStripForBrowser(browser()); |
2231 | 2142 |
2232 // Move to the first tab and drag it enough so that it detaches. | 2143 // Move to the first tab and drag it enough so that it detaches. |
2233 gfx::Point tab_0_center( | 2144 gfx::Point tab_0_center( |
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2287 ::testing::Values("mouse", "touch")); | 2198 ::testing::Values("mouse", "touch")); |
2288 INSTANTIATE_TEST_CASE_P(TabDragging, | 2199 INSTANTIATE_TEST_CASE_P(TabDragging, |
2289 DifferentDeviceScaleFactorDisplayTabDragControllerTest, | 2200 DifferentDeviceScaleFactorDisplayTabDragControllerTest, |
2290 ::testing::Values("mouse")); | 2201 ::testing::Values("mouse")); |
2291 INSTANTIATE_TEST_CASE_P(TabDragging, | 2202 INSTANTIATE_TEST_CASE_P(TabDragging, |
2292 DetachToBrowserTabDragControllerTest, | 2203 DetachToBrowserTabDragControllerTest, |
2293 ::testing::Values("mouse", "touch")); | 2204 ::testing::Values("mouse", "touch")); |
2294 INSTANTIATE_TEST_CASE_P(TabDragging, | 2205 INSTANTIATE_TEST_CASE_P(TabDragging, |
2295 DetachToBrowserTabDragControllerTestTouch, | 2206 DetachToBrowserTabDragControllerTestTouch, |
2296 ::testing::Values("touch")); | 2207 ::testing::Values("touch")); |
2297 #elif defined(USE_ASH) && !defined(OS_LINUX) // TODO(linux_ash) | 2208 #elif defined(USE_ASH) |
2298 INSTANTIATE_TEST_CASE_P(TabDragging, | 2209 INSTANTIATE_TEST_CASE_P(TabDragging, |
2299 DetachToBrowserTabDragControllerTest, | 2210 DetachToBrowserTabDragControllerTest, |
2300 ::testing::Values("mouse")); | 2211 ::testing::Values("mouse")); |
2301 #endif | 2212 #endif |
OLD | NEW |