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

Side by Side Diff: chrome/browser/ui/views/tabs/tab_drag_controller_interactive_uitest.cc

Issue 301613002: Enable Tab Dragging Tests with Linux and Ash (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 6 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
« no previous file with comments | « no previous file | no next file » | 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 "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 24 matching lines...) Expand all
41 #include "ui/views/widget/desktop_aura/desktop_native_widget_aura.h" 43 #include "ui/views/widget/desktop_aura/desktop_native_widget_aura.h"
42 #endif 44 #endif
43 45
44 #if defined(USE_ASH) 46 #if defined(USE_ASH)
45 #include "ash/ash_switches.h" 47 #include "ash/ash_switches.h"
46 #include "ash/display/display_controller.h" 48 #include "ash/display/display_controller.h"
47 #include "ash/display/display_manager.h" 49 #include "ash/display/display_manager.h"
48 #include "ash/shell.h" 50 #include "ash/shell.h"
49 #include "ash/test/cursor_manager_test_api.h" 51 #include "ash/test/cursor_manager_test_api.h"
50 #include "ash/wm/coordinate_conversion.h" 52 #include "ash/wm/coordinate_conversion.h"
51 #include "ash/wm/window_state.h"
52 #include "ash/wm/window_util.h" 53 #include "ash/wm/window_util.h"
53 #include "chrome/browser/ui/views/frame/immersive_mode_controller.h" 54 #include "chrome/browser/ui/views/frame/immersive_mode_controller.h"
54 #include "ui/aura/client/screen_position_client.h" 55 #include "ui/aura/client/screen_position_client.h"
55 #include "ui/aura/test/event_generator.h" 56 #include "ui/aura/test/event_generator.h"
56 #include "ui/aura/window_event_dispatcher.h" 57 #include "ui/aura/window_event_dispatcher.h"
57 #endif 58 #endif
58 59
59 using content::WebContents; 60 using content::WebContents;
60 61
61 namespace test { 62 namespace test {
(...skipping 265 matching lines...) Expand 10 before | Expand all | Expand 10 after
327 TabStrip* tab_strip = GetTabStripForBrowser(browser()); 328 TabStrip* tab_strip = GetTabStripForBrowser(browser());
328 329
329 Tab* tab1 = tab_strip->tab_at(1); 330 Tab* tab1 = tab_strip->tab_at(1);
330 gfx::Point tab_1_center(tab1->width() / 2, tab1->height() / 2); 331 gfx::Point tab_1_center(tab1->width() / 2, tab1->height() / 2);
331 332
332 ui::GestureEvent gesture_begin(ui::ET_GESTURE_BEGIN, tab_1_center.x(), 333 ui::GestureEvent gesture_begin(ui::ET_GESTURE_BEGIN, tab_1_center.x(),
333 tab_1_center.x(), 0, base::TimeDelta(), 334 tab_1_center.x(), 0, base::TimeDelta(),
334 ui::GestureEventDetails(ui::ET_GESTURE_BEGIN, 0.0f, 0.0f), 0); 335 ui::GestureEventDetails(ui::ET_GESTURE_BEGIN, 0.0f, 0.0f), 0);
335 tab_strip->MaybeStartDrag(tab1, gesture_begin, 336 tab_strip->MaybeStartDrag(tab1, gesture_begin,
336 tab_strip->GetSelectionModel()); 337 tab_strip->GetSelectionModel());
337 //tab_strip->tab_at(1)->OnGestureEvent(&gesture_begin);
338 EXPECT_TRUE(TabDragController::IsActive()); 338 EXPECT_TRUE(TabDragController::IsActive());
339 339
340 ui::GestureEvent gesture_end(ui::ET_GESTURE_END, tab_1_center.x(), 340 ui::GestureEvent gesture_end(ui::ET_GESTURE_END, tab_1_center.x(),
341 tab_1_center.x(), 0, base::TimeDelta(), 341 tab_1_center.x(), 0, base::TimeDelta(),
342 ui::GestureEventDetails(ui::ET_GESTURE_END, 0.0f, 0.0f), 0); 342 ui::GestureEventDetails(ui::ET_GESTURE_END, 0.0f, 0.0f), 0);
343 tab_strip->OnGestureEvent(&gesture_end); 343 tab_strip->OnGestureEvent(&gesture_end);
344 EXPECT_FALSE(TabDragController::IsActive()); 344 EXPECT_FALSE(TabDragController::IsActive());
345 EXPECT_FALSE(tab_strip->IsDragSessionActive()); 345 EXPECT_FALSE(tab_strip->IsDragSessionActive());
346 } 346 }
347 347
348 #endif 348 #endif
349 349
350 class DetachToBrowserTabDragControllerTest 350 class DetachToBrowserTabDragControllerTest
351 : public TabDragControllerTest, 351 : public TabDragControllerTest,
352 public ::testing::WithParamInterface<const char*> { 352 public ::testing::WithParamInterface<const char*> {
353 public: 353 public:
354 DetachToBrowserTabDragControllerTest() {} 354 DetachToBrowserTabDragControllerTest() {}
355 355
356 virtual void SetUpCommandLine(CommandLine* command_line) OVERRIDE { 356 virtual void SetUpCommandLine(CommandLine* command_line) OVERRIDE {
357 #if defined(USE_ASH) && !defined(OS_WIN) // TODO(win_ash) 357 #if defined(OS_CHROMEOS)
358 if (!docked_windows_enabled()) { 358 if (!docked_windows_enabled()) {
359 CommandLine::ForCurrentProcess()->AppendSwitch( 359 CommandLine::ForCurrentProcess()->AppendSwitch(
360 ash::switches::kAshDisableDockedWindows); 360 ash::switches::kAshDisableDockedWindows);
361 } 361 }
362 #endif 362 #endif
363 } 363 }
364 364
365 virtual void SetUpOnMainThread() OVERRIDE { 365 virtual void SetUpOnMainThread() OVERRIDE {
366 #if defined(USE_ASH) && !defined(OS_WIN) // TODO(win_ash) 366 #if defined(OS_CHROMEOS)
367 event_generator_.reset(new aura::test::EventGenerator( 367 event_generator_.reset(new aura::test::EventGenerator(
368 ash::Shell::GetPrimaryRootWindow())); 368 ash::Shell::GetPrimaryRootWindow()));
369 #endif 369 #endif
370 } 370 }
371 371
372 virtual void TearDownOnMainThread() OVERRIDE {
373 #if defined(OS_CHROMEOS)
374 event_generator_.reset();
375 #endif
376 }
pkotwicz 2014/05/28 15:00:33 Can this new code be removed?
jonross 2014/05/28 15:45:13 Done.
377
372 InputSource input_source() const { 378 InputSource input_source() const {
373 return strstr(GetParam(), "mouse") ? 379 return strstr(GetParam(), "mouse") ?
374 INPUT_SOURCE_MOUSE : INPUT_SOURCE_TOUCH; 380 INPUT_SOURCE_MOUSE : INPUT_SOURCE_TOUCH;
375 } 381 }
376 382
377 bool docked_windows_enabled() const { 383 bool docked_windows_enabled() const {
378 return (strstr(GetParam(), "docked") != NULL); 384 return (strstr(GetParam(), "docked") != NULL);
379 } 385 }
380 386
381 // Set root window from a point in screen coordinates 387 // Set root window from a point in screen coordinates
382 void SetEventGeneratorRootWindow(const gfx::Point& point) { 388 void SetEventGeneratorRootWindow(const gfx::Point& point) {
383 if (input_source() == INPUT_SOURCE_MOUSE) 389 if (input_source() == INPUT_SOURCE_MOUSE)
384 return; 390 return;
385 #if defined(USE_ASH) && !defined(OS_WIN) // TODO(win_ash) 391 #if defined(OS_CHROMEOS)
386 event_generator_.reset(new aura::test::EventGenerator( 392 event_generator_.reset(new aura::test::EventGenerator(
387 new ScreenEventGeneratorDelegate(ash::wm::GetRootWindowAt(point)))); 393 new ScreenEventGeneratorDelegate(ash::wm::GetRootWindowAt(point))));
388 #endif 394 #endif
389 } 395 }
390 396
391 // The following methods update one of the mouse or touch input depending upon 397 // The following methods update one of the mouse or touch input depending upon
392 // the InputSource. 398 // the InputSource.
393 bool PressInput(const gfx::Point& location) { 399 bool PressInput(const gfx::Point& location) {
394 if (input_source() == INPUT_SOURCE_MOUSE) { 400 if (input_source() == INPUT_SOURCE_MOUSE) {
395 return ui_test_utils::SendMouseMoveSync(location) && 401 return ui_test_utils::SendMouseMoveSync(location) &&
396 ui_test_utils::SendMouseEventsSync( 402 ui_test_utils::SendMouseEventsSync(
397 ui_controls::LEFT, ui_controls::DOWN); 403 ui_controls::LEFT, ui_controls::DOWN);
398 } 404 }
399 #if defined(USE_ASH) && !defined(OS_WIN) // TODO(win_ash) 405 #if defined(OS_CHROMEOS)
400 event_generator_->set_current_location(location); 406 event_generator_->set_current_location(location);
401 event_generator_->PressTouch(); 407 event_generator_->PressTouch();
402 #else 408 #else
403 NOTREACHED(); 409 NOTREACHED();
404 #endif 410 #endif
405 return true; 411 return true;
406 } 412 }
407 413
408 bool PressInput2() { 414 bool PressInput2() {
409 // Second touch input is only used for touch sequence tests. 415 // Second touch input is only used for touch sequence tests.
410 EXPECT_EQ(INPUT_SOURCE_TOUCH, input_source()); 416 EXPECT_EQ(INPUT_SOURCE_TOUCH, input_source());
411 #if defined(USE_ASH) && !defined(OS_WIN) // TODO(win_ash) 417 #if defined(OS_CHROMEOS)
412 event_generator_->set_current_location( 418 event_generator_->set_current_location(
413 event_generator_->current_location()); 419 event_generator_->current_location());
414 event_generator_->PressTouchId(1); 420 event_generator_->PressTouchId(1);
415 #else 421 #else
416 NOTREACHED(); 422 NOTREACHED();
417 #endif 423 #endif
418 return true; 424 return true;
419 } 425 }
420 426
421 bool DragInputTo(const gfx::Point& location) { 427 bool DragInputTo(const gfx::Point& location) {
422 if (input_source() == INPUT_SOURCE_MOUSE) 428 if (input_source() == INPUT_SOURCE_MOUSE)
423 return ui_test_utils::SendMouseMoveSync(location); 429 return ui_test_utils::SendMouseMoveSync(location);
424 #if defined(USE_ASH) && !defined(OS_WIN) // TODO(win_ash) 430 #if defined(OS_CHROMEOS)
425 event_generator_->MoveTouch(location); 431 event_generator_->MoveTouch(location);
426 #else 432 #else
427 NOTREACHED(); 433 NOTREACHED();
428 #endif 434 #endif
429 return true; 435 return true;
430 } 436 }
431 437
432 bool DragInputToAsync(const gfx::Point& location) { 438 bool DragInputToAsync(const gfx::Point& location) {
433 if (input_source() == INPUT_SOURCE_MOUSE) 439 if (input_source() == INPUT_SOURCE_MOUSE)
434 return ui_controls::SendMouseMove(location.x(), location.y()); 440 return ui_controls::SendMouseMove(location.x(), location.y());
435 #if defined(USE_ASH) && !defined(OS_WIN) // TODO(win_ash) 441 #if defined(OS_CHROMEOS)
436 event_generator_->MoveTouch(location); 442 event_generator_->MoveTouch(location);
437 #else 443 #else
438 NOTREACHED(); 444 NOTREACHED();
439 #endif 445 #endif
440 return true; 446 return true;
441 } 447 }
442 448
443 bool DragInputToNotifyWhenDone(int x, 449 bool DragInputToNotifyWhenDone(int x,
444 int y, 450 int y,
445 const base::Closure& task) { 451 const base::Closure& task) {
446 if (input_source() == INPUT_SOURCE_MOUSE) 452 if (input_source() == INPUT_SOURCE_MOUSE)
447 return ui_controls::SendMouseMoveNotifyWhenDone(x, y, task); 453 return ui_controls::SendMouseMoveNotifyWhenDone(x, y, task);
448 #if defined(USE_ASH) && !defined(OS_WIN) // TODO(win_ash) 454 #if defined(OS_CHROMEOS)
449 base::MessageLoop::current()->PostTask(FROM_HERE, task); 455 base::MessageLoop::current()->PostTask(FROM_HERE, task);
450 event_generator_->MoveTouch(gfx::Point(x, y)); 456 event_generator_->MoveTouch(gfx::Point(x, y));
451 #else 457 #else
452 NOTREACHED(); 458 NOTREACHED();
453 #endif 459 #endif
454 return true; 460 return true;
455 } 461 }
456 462
457 bool DragInputToDelayedNotifyWhenDone(int x, 463 bool DragInputToDelayedNotifyWhenDone(int x,
458 int y, 464 int y,
459 const base::Closure& task, 465 const base::Closure& task,
460 base::TimeDelta delay) { 466 base::TimeDelta delay) {
461 if (input_source() == INPUT_SOURCE_MOUSE) 467 if (input_source() == INPUT_SOURCE_MOUSE)
462 return ui_controls::SendMouseMoveNotifyWhenDone(x, y, task); 468 return ui_controls::SendMouseMoveNotifyWhenDone(x, y, task);
463 #if defined(USE_ASH) && !defined(OS_WIN) // TODO(win_ash) 469 #if defined(OS_CHROMEOS)
464 base::MessageLoop::current()->PostDelayedTask(FROM_HERE, task, delay); 470 base::MessageLoop::current()->PostDelayedTask(FROM_HERE, task, delay);
465 event_generator_->MoveTouch(gfx::Point(x, y)); 471 event_generator_->MoveTouch(gfx::Point(x, y));
466 #else 472 #else
467 NOTREACHED(); 473 NOTREACHED();
468 #endif 474 #endif
469 return true; 475 return true;
470 } 476 }
471 477
472 bool DragInput2ToNotifyWhenDone(int x, 478 bool DragInput2ToNotifyWhenDone(int x,
473 int y, 479 int y,
474 const base::Closure& task) { 480 const base::Closure& task) {
475 if (input_source() == INPUT_SOURCE_MOUSE) 481 if (input_source() == INPUT_SOURCE_MOUSE)
476 return ui_controls::SendMouseMoveNotifyWhenDone(x, y, task); 482 return ui_controls::SendMouseMoveNotifyWhenDone(x, y, task);
477 #if defined(USE_ASH) && !defined(OS_WIN) // TODO(win_ash) 483 #if defined(OS_CHROMEOS)
478 base::MessageLoop::current()->PostTask(FROM_HERE, task); 484 base::MessageLoop::current()->PostTask(FROM_HERE, task);
479 event_generator_->MoveTouchId(gfx::Point(x, y), 1); 485 event_generator_->MoveTouchId(gfx::Point(x, y), 1);
480 #else 486 #else
481 NOTREACHED(); 487 NOTREACHED();
482 #endif 488 #endif
483 return true; 489 return true;
484 } 490 }
485 491
486 bool ReleaseInput() { 492 bool ReleaseInput() {
487 if (input_source() == INPUT_SOURCE_MOUSE) { 493 if (input_source() == INPUT_SOURCE_MOUSE) {
488 return ui_test_utils::SendMouseEventsSync( 494 return ui_test_utils::SendMouseEventsSync(
489 ui_controls::LEFT, ui_controls::UP); 495 ui_controls::LEFT, ui_controls::UP);
490 } 496 }
491 #if defined(USE_ASH) && !defined(OS_WIN) // TODO(win_ash) 497 #if defined(OS_CHROMEOS)
492 event_generator_->ReleaseTouch(); 498 event_generator_->ReleaseTouch();
493 #else 499 #else
494 NOTREACHED(); 500 NOTREACHED();
495 #endif 501 #endif
496 return true; 502 return true;
497 } 503 }
498 504
499 bool ReleaseInput2() { 505 bool ReleaseInput2() {
500 if (input_source() == INPUT_SOURCE_MOUSE) { 506 if (input_source() == INPUT_SOURCE_MOUSE) {
501 return ui_test_utils::SendMouseEventsSync( 507 return ui_test_utils::SendMouseEventsSync(
502 ui_controls::LEFT, ui_controls::UP); 508 ui_controls::LEFT, ui_controls::UP);
503 } 509 }
504 #if defined(USE_ASH) && !defined(OS_WIN) // TODO(win_ash) 510 #if defined(OS_CHROMEOS)
505 event_generator_->ReleaseTouchId(1); 511 event_generator_->ReleaseTouchId(1);
506 #else 512 #else
507 NOTREACHED(); 513 NOTREACHED();
508 #endif 514 #endif
509 return true; 515 return true;
510 } 516 }
511 517
512 bool ReleaseMouseAsync() { 518 bool ReleaseMouseAsync() {
513 return input_source() == INPUT_SOURCE_MOUSE && 519 return input_source() == INPUT_SOURCE_MOUSE &&
514 ui_controls::SendMouseEvents(ui_controls::LEFT, ui_controls::UP); 520 ui_controls::SendMouseEvents(ui_controls::LEFT, ui_controls::UP);
(...skipping 14 matching lines...) Expand all
529 } 535 }
530 } 536 }
531 537
532 void AddBlankTabAndShow(Browser* browser) { 538 void AddBlankTabAndShow(Browser* browser) {
533 InProcessBrowserTest::AddBlankTabAndShow(browser); 539 InProcessBrowserTest::AddBlankTabAndShow(browser);
534 } 540 }
535 541
536 Browser* browser() const { return InProcessBrowserTest::browser(); } 542 Browser* browser() const { return InProcessBrowserTest::browser(); }
537 543
538 private: 544 private:
539 #if defined(USE_ASH) && !defined(OS_WIN) // TODO(win_ash) 545 #if defined(OS_CHROMEOS)
540 scoped_ptr<aura::test::EventGenerator> event_generator_; 546 scoped_ptr<aura::test::EventGenerator> event_generator_;
541 #endif 547 #endif
542 548
543 DISALLOW_COPY_AND_ASSIGN(DetachToBrowserTabDragControllerTest); 549 DISALLOW_COPY_AND_ASSIGN(DetachToBrowserTabDragControllerTest);
544 }; 550 };
545 551
546 // Creates a browser with two tabs, drags the second to the first. 552 // Creates a browser with two tabs, drags the second to the first.
547 IN_PROC_BROWSER_TEST_P(DetachToBrowserTabDragControllerTest, DragInSameWindow) { 553 IN_PROC_BROWSER_TEST_P(DetachToBrowserTabDragControllerTest, DragInSameWindow) {
548 // TODO(sky): this won't work with touch as it requires a long press. 554 // TODO(sky): this won't work with touch as it requires a long press.
549 if (input_source() == INPUT_SOURCE_TOUCH) { 555 if (input_source() == INPUT_SOURCE_TOUCH) {
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after
644 EXPECT_FALSE(tab_strip2->GetWidget()->HasCapture()); 650 EXPECT_FALSE(tab_strip2->GetWidget()->HasCapture());
645 } 651 }
646 652
647 namespace { 653 namespace {
648 654
649 void DetachToOwnWindowStep2(DetachToBrowserTabDragControllerTest* test) { 655 void DetachToOwnWindowStep2(DetachToBrowserTabDragControllerTest* test) {
650 if (test->input_source() == INPUT_SOURCE_TOUCH) 656 if (test->input_source() == INPUT_SOURCE_TOUCH)
651 ASSERT_TRUE(test->ReleaseInput()); 657 ASSERT_TRUE(test->ReleaseInput());
652 } 658 }
653 659
654 #if defined(USE_ASH) && !defined(OS_WIN) // TODO(win_ash) 660 #if defined(OS_CHROMEOS)
655 bool IsWindowPositionManaged(aura::Window* window) { 661 bool IsWindowPositionManaged(aura::Window* window) {
656 return ash::wm::GetWindowState(window)->window_position_managed(); 662 return ash::wm::GetWindowState(window)->window_position_managed();
657 } 663 }
658 bool HasUserChangedWindowPositionOrSize(aura::Window* window) { 664 bool HasUserChangedWindowPositionOrSize(aura::Window* window) {
659 return ash::wm::GetWindowState(window)->bounds_changed_by_user(); 665 return ash::wm::GetWindowState(window)->bounds_changed_by_user();
660 } 666 }
661 #else 667 #else
662 bool IsWindowPositionManaged(gfx::NativeWindow window) { 668 bool IsWindowPositionManaged(gfx::NativeWindow window) {
663 return true; 669 return true;
664 } 670 }
(...skipping 246 matching lines...) Expand 10 before | Expand all | Expand 10 after
911 Browser* new_browser = browser_list->get(1); 917 Browser* new_browser = browser_list->get(1);
912 // This ends up closing the source window. 918 // This ends up closing the source window.
913 delete tab; 919 delete tab;
914 // Cancel the drag. 920 // Cancel the drag.
915 ui_controls::SendKeyPress(new_browser->window()->GetNativeWindow(), 921 ui_controls::SendKeyPress(new_browser->window()->GetNativeWindow(),
916 ui::VKEY_ESCAPE, false, false, false, false); 922 ui::VKEY_ESCAPE, false, false, false, false);
917 } 923 }
918 924
919 } // namespace 925 } // namespace
920 926
921 #if defined(OS_CHROMEOS) 927 #if defined(OS_CHROMEOS) || defined(OS_LINUX)
922 // TODO(sky,sad): Disabled as it fails due to resize locks with a real 928 // TODO(sky,sad): Disabled as it fails due to resize locks with a real
923 // compositor. crbug.com/331924 929 // compositor. crbug.com/331924
924 #define MAYBE_DeleteSourceDetached DISABLED_DeleteSourceDetached 930 #define MAYBE_DeleteSourceDetached DISABLED_DeleteSourceDetached
925 #else 931 #else
926 #define MAYBE_DeleteSourceDetached DeleteSourceDetached 932 #define MAYBE_DeleteSourceDetached DeleteSourceDetached
927 #endif 933 #endif
928 // Detaches a tab and while detached deletes a tab from the source so that the 934 // Detaches a tab and while detached deletes a tab from the source so that the
929 // source window closes then presses escape to cancel the drag. 935 // source window closes then presses escape to cancel the drag.
930 IN_PROC_BROWSER_TEST_P(DetachToBrowserTabDragControllerTest, 936 IN_PROC_BROWSER_TEST_P(DetachToBrowserTabDragControllerTest,
931 MAYBE_DeleteSourceDetached) { 937 MAYBE_DeleteSourceDetached) {
(...skipping 29 matching lines...) Expand all
961 void PressEscapeWhileDetachedStep2(const BrowserList* browser_list) { 967 void PressEscapeWhileDetachedStep2(const BrowserList* browser_list) {
962 ASSERT_EQ(2u, browser_list->size()); 968 ASSERT_EQ(2u, browser_list->size());
963 Browser* new_browser = browser_list->get(1); 969 Browser* new_browser = browser_list->get(1);
964 ui_controls::SendKeyPress( 970 ui_controls::SendKeyPress(
965 new_browser->window()->GetNativeWindow(), ui::VKEY_ESCAPE, false, false, 971 new_browser->window()->GetNativeWindow(), ui::VKEY_ESCAPE, false, false,
966 false, false); 972 false, false);
967 } 973 }
968 974
969 } // namespace 975 } // namespace
970 976
971 #if defined(OS_CHROMEOS) 977 #if defined(OS_CHROMEOS) || defined(OS_LINUX)
972 // TODO(sky,sad): Disabled as it fails due to resize locks with a real 978 // TODO(sky,sad): Disabled as it fails due to resize locks with a real
973 // compositor. crbug.com/331924 979 // compositor. crbug.com/331924
974 #define MAYBE_PressEscapeWhileDetached DISABLED_PressEscapeWhileDetached 980 #define MAYBE_PressEscapeWhileDetached DISABLED_PressEscapeWhileDetached
975 #else 981 #else
976 #define MAYBE_PressEscapeWhileDetached PressEscapeWhileDetached 982 #define MAYBE_PressEscapeWhileDetached PressEscapeWhileDetached
977 #endif 983 #endif
978 // This is disabled until NativeViewHost::Detach really detaches. 984 // This is disabled until NativeViewHost::Detach really detaches.
979 // Detaches a tab and while detached presses escape to revert the drag. 985 // Detaches a tab and while detached presses escape to revert the drag.
980 IN_PROC_BROWSER_TEST_P(DetachToBrowserTabDragControllerTest, 986 IN_PROC_BROWSER_TEST_P(DetachToBrowserTabDragControllerTest,
981 MAYBE_PressEscapeWhileDetached) { 987 MAYBE_PressEscapeWhileDetached) {
(...skipping 352 matching lines...) Expand 10 before | Expand all | Expand 10 after
1334 const BrowserList* browser_list) { 1340 const BrowserList* browser_list) {
1335 ASSERT_TRUE(TabDragController::IsActive()); 1341 ASSERT_TRUE(TabDragController::IsActive());
1336 ASSERT_EQ(2u, browser_list->size()); 1342 ASSERT_EQ(2u, browser_list->size());
1337 1343
1338 // Add another tab. This should trigger exiting the nested loop. 1344 // Add another tab. This should trigger exiting the nested loop.
1339 test->AddBlankTabAndShow(browser_list->GetLastActive()); 1345 test->AddBlankTabAndShow(browser_list->GetLastActive());
1340 } 1346 }
1341 1347
1342 } // namespace 1348 } // namespace
1343 1349
1344 #if defined(OS_CHROMEOS) 1350 #if defined(OS_CHROMEOS) || defined(OS_LINUX)
1345 // TODO(sky,sad): Disabled as it fails due to resize locks with a real 1351 // TODO(sky,sad): Disabled as it fails due to resize locks with a real
1346 // compositor. crbug.com/331924 1352 // compositor. crbug.com/331924
1347 #define MAYBE_CancelOnNewTabWhenDragging DISABLED_CancelOnNewTabWhenDragging 1353 #define MAYBE_CancelOnNewTabWhenDragging DISABLED_CancelOnNewTabWhenDragging
1348 #else 1354 #else
1349 #define MAYBE_CancelOnNewTabWhenDragging CancelOnNewTabWhenDragging 1355 #define MAYBE_CancelOnNewTabWhenDragging CancelOnNewTabWhenDragging
1350 #endif 1356 #endif
1351 // Adds another tab, detaches into separate window, adds another tab and 1357 // Adds another tab, detaches into separate window, adds another tab and
1352 // verifies the run loop ends. 1358 // verifies the run loop ends.
1353 IN_PROC_BROWSER_TEST_P(DetachToBrowserTabDragControllerTest, 1359 IN_PROC_BROWSER_TEST_P(DetachToBrowserTabDragControllerTest,
1354 MAYBE_CancelOnNewTabWhenDragging) { 1360 MAYBE_CancelOnNewTabWhenDragging) {
(...skipping 14 matching lines...) Expand all
1369 // Should be two windows and not dragging. 1375 // Should be two windows and not dragging.
1370 ASSERT_FALSE(TabDragController::IsActive()); 1376 ASSERT_FALSE(TabDragController::IsActive());
1371 ASSERT_EQ(2u, native_browser_list->size()); 1377 ASSERT_EQ(2u, native_browser_list->size());
1372 for (chrome::BrowserIterator it; !it.done(); it.Next()) { 1378 for (chrome::BrowserIterator it; !it.done(); it.Next()) {
1373 EXPECT_FALSE(GetIsDragged(*it)); 1379 EXPECT_FALSE(GetIsDragged(*it));
1374 // Should not be maximized 1380 // Should not be maximized
1375 EXPECT_FALSE(it->window()->IsMaximized()); 1381 EXPECT_FALSE(it->window()->IsMaximized());
1376 } 1382 }
1377 } 1383 }
1378 1384
1379 #if defined(USE_ASH) && !defined(OS_WIN) // TODO(win_ash) 1385 #if defined(OS_CHROMEOS)
1380 1386 // TODO(sky,sad): A number of tests below are disabled as they fail due to
1387 // resize locks with a real compositor. crbug.com/331924
1381 namespace { 1388 namespace {
1382 1389
1383 void DragInMaximizedWindowStep2(DetachToBrowserTabDragControllerTest* test, 1390 void DragInMaximizedWindowStep2(DetachToBrowserTabDragControllerTest* test,
1384 Browser* browser, 1391 Browser* browser,
1385 TabStrip* tab_strip, 1392 TabStrip* tab_strip,
1386 const BrowserList* browser_list) { 1393 const BrowserList* browser_list) {
1387 // There should be another browser. 1394 // There should be another browser.
1388 ASSERT_EQ(2u, browser_list->size()); 1395 ASSERT_EQ(2u, browser_list->size());
1389 Browser* new_browser = browser_list->get(1); 1396 Browser* new_browser = browser_list->get(1);
1390 EXPECT_NE(browser, new_browser); 1397 EXPECT_NE(browser, new_browser);
1391 ASSERT_TRUE(new_browser->window()->IsActive()); 1398 ASSERT_TRUE(new_browser->window()->IsActive());
1392 TabStrip* tab_strip2 = GetTabStripForBrowser(new_browser); 1399 TabStrip* tab_strip2 = GetTabStripForBrowser(new_browser);
1393 1400
1394 ASSERT_TRUE(tab_strip2->IsDragSessionActive()); 1401 ASSERT_TRUE(tab_strip2->IsDragSessionActive());
1395 ASSERT_FALSE(tab_strip->IsDragSessionActive()); 1402 ASSERT_FALSE(tab_strip->IsDragSessionActive());
1396 1403
1397 // Both windows should be visible. 1404 // Both windows should be visible.
1398 EXPECT_TRUE(tab_strip->GetWidget()->IsVisible()); 1405 EXPECT_TRUE(tab_strip->GetWidget()->IsVisible());
1399 EXPECT_TRUE(tab_strip2->GetWidget()->IsVisible()); 1406 EXPECT_TRUE(tab_strip2->GetWidget()->IsVisible());
1400 1407
1401 // Stops dragging. 1408 // Stops dragging.
1402 ASSERT_TRUE(test->ReleaseInput()); 1409 ASSERT_TRUE(test->ReleaseInput());
1403 } 1410 }
1404 1411
1405 } // namespace 1412 } // namespace
1406 1413
1407 #if defined(OS_CHROMEOS)
1408 // TODO(sky,sad): Disabled as it fails due to resize locks with a real
1409 // compositor. crbug.com/331924
1410 #define MAYBE_DragInMaximizedWindow DISABLED_DragInMaximizedWindow
1411 #else
1412 #define MAYBE_DragInMaximizedWindow DragInMaximizedWindow
1413 #endif
1414 // Creates a browser with two tabs, maximizes it, drags the tab out. 1414 // Creates a browser with two tabs, maximizes it, drags the tab out.
1415 IN_PROC_BROWSER_TEST_P(DetachToBrowserTabDragControllerTest, 1415 IN_PROC_BROWSER_TEST_P(DetachToBrowserTabDragControllerTest,
1416 MAYBE_DragInMaximizedWindow) { 1416 DISABLED_DragInMaximizedWindow) {
1417 AddTabAndResetBrowser(browser()); 1417 AddTabAndResetBrowser(browser());
1418 browser()->window()->Maximize(); 1418 browser()->window()->Maximize();
1419 1419
1420 TabStrip* tab_strip = GetTabStripForBrowser(browser()); 1420 TabStrip* tab_strip = GetTabStripForBrowser(browser());
1421 1421
1422 // Move to the first tab and drag it enough so that it detaches. 1422 // Move to the first tab and drag it enough so that it detaches.
1423 gfx::Point tab_0_center( 1423 gfx::Point tab_0_center(
1424 GetCenterInScreenCoordinates(tab_strip->tab_at(0))); 1424 GetCenterInScreenCoordinates(tab_strip->tab_at(0)));
1425 ASSERT_TRUE(PressInput(tab_0_center)); 1425 ASSERT_TRUE(PressInput(tab_0_center));
1426 ASSERT_TRUE(DragInputToNotifyWhenDone( 1426 ASSERT_TRUE(DragInputToNotifyWhenDone(
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after
1490 void DragSingleTabToSeparateWindowInSecondDisplayStep2( 1490 void DragSingleTabToSeparateWindowInSecondDisplayStep2(
1491 DetachToBrowserTabDragControllerTest* test, 1491 DetachToBrowserTabDragControllerTest* test,
1492 const gfx::Point& target_point) { 1492 const gfx::Point& target_point) {
1493 ASSERT_TRUE(test->DragInputToNotifyWhenDone( 1493 ASSERT_TRUE(test->DragInputToNotifyWhenDone(
1494 target_point.x(), target_point.y(), 1494 target_point.x(), target_point.y(),
1495 base::Bind(&DragSingleTabToSeparateWindowInSecondDisplayStep3, test))); 1495 base::Bind(&DragSingleTabToSeparateWindowInSecondDisplayStep3, test)));
1496 } 1496 }
1497 1497
1498 } // namespace 1498 } // namespace
1499 1499
1500 #if defined(OS_CHROMEOS)
1501 // TODO(sky,sad): Disabled as it fails due to resize locks with a real
1502 // compositor. crbug.com/331924
1503 #define MAYBE_DragSingleTabToSeparateWindowInSecondDisplay \
1504 DISABLED_DragSingleTabToSeparateWindowInSecondDisplay
1505 #else
1506 #define MAYBE_DragSingleTabToSeparateWindowInSecondDisplay \
1507 DragSingleTabToSeparateWindowInSecondDisplay
1508 #endif
1509 // Drags from browser to a second display and releases input. 1500 // Drags from browser to a second display and releases input.
1510 IN_PROC_BROWSER_TEST_P(DetachToBrowserInSeparateDisplayTabDragControllerTest, 1501 IN_PROC_BROWSER_TEST_P(DetachToBrowserInSeparateDisplayTabDragControllerTest,
1511 MAYBE_DragSingleTabToSeparateWindowInSecondDisplay) { 1502 DISABLED_DragSingleTabToSeparateWindowInSecondDisplay) {
1512 // Add another tab. 1503 // Add another tab.
1513 AddTabAndResetBrowser(browser()); 1504 AddTabAndResetBrowser(browser());
1514 TabStrip* tab_strip = GetTabStripForBrowser(browser()); 1505 TabStrip* tab_strip = GetTabStripForBrowser(browser());
1515 1506
1516 // Move to the first tab and drag it enough so that it detaches. 1507 // Move to the first tab and drag it enough so that it detaches.
1517 // Then drag it to the final destination on the second screen. 1508 // Then drag it to the final destination on the second screen.
1518 gfx::Point tab_0_center(GetCenterInScreenCoordinates(tab_strip->tab_at(0))); 1509 gfx::Point tab_0_center(GetCenterInScreenCoordinates(tab_strip->tab_at(0)));
1519 ASSERT_TRUE(PressInput(tab_0_center)); 1510 ASSERT_TRUE(PressInput(tab_0_center));
1520 ASSERT_TRUE(DragInputToNotifyWhenDone( 1511 ASSERT_TRUE(DragInputToNotifyWhenDone(
1521 tab_0_center.x(), tab_0_center.y() + GetDetachY(tab_strip), 1512 tab_0_center.x(), tab_0_center.y() + GetDetachY(tab_strip),
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
1572 GetCenterInScreenCoordinates(target_tab_strip->tab_at(0))); 1563 GetCenterInScreenCoordinates(target_tab_strip->tab_at(0)));
1573 1564
1574 // Move it close to the beginning of the target tabstrip. 1565 // Move it close to the beginning of the target tabstrip.
1575 target_point.set_x( 1566 target_point.set_x(
1576 target_point.x() - target_tab_strip->tab_at(0)->width() / 2 + 10); 1567 target_point.x() - target_tab_strip->tab_at(0)->width() / 2 + 10);
1577 ASSERT_TRUE(test->DragInputToAsync(target_point)); 1568 ASSERT_TRUE(test->DragInputToAsync(target_point));
1578 } 1569 }
1579 1570
1580 } // namespace 1571 } // namespace
1581 1572
1582 #if defined(OS_CHROMEOS)
1583 // TODO(sky,sad): Disabled as it fails due to resize locks with a real
1584 // compositor. crbug.com/331924
1585 #define MAYBE_DragTabToWindowInSeparateDisplay \
1586 DISABLED_DragTabToWindowInSeparateDisplay
1587 #else
1588 #define MAYBE_DragTabToWindowInSeparateDisplay DragTabToWindowInSeparateDisplay
1589 #endif
1590 // Drags from browser to another browser on a second display and releases input. 1573 // Drags from browser to another browser on a second display and releases input.
1591 IN_PROC_BROWSER_TEST_P(DetachToBrowserInSeparateDisplayTabDragControllerTest, 1574 IN_PROC_BROWSER_TEST_P(DetachToBrowserInSeparateDisplayTabDragControllerTest,
1592 MAYBE_DragTabToWindowInSeparateDisplay) { 1575 DISABLED_DragTabToWindowInSeparateDisplay) {
1593 // Add another tab. 1576 // Add another tab.
1594 AddTabAndResetBrowser(browser()); 1577 AddTabAndResetBrowser(browser());
1595 TabStrip* tab_strip = GetTabStripForBrowser(browser()); 1578 TabStrip* tab_strip = GetTabStripForBrowser(browser());
1596 1579
1597 // Create another browser. 1580 // Create another browser.
1598 Browser* browser2 = CreateBrowser(browser()->profile()); 1581 Browser* browser2 = CreateBrowser(browser()->profile());
1599 TabStrip* tab_strip2 = GetTabStripForBrowser(browser2); 1582 TabStrip* tab_strip2 = GetTabStripForBrowser(browser2);
1600 ResetIDs(browser2->tab_strip_model(), 100); 1583 ResetIDs(browser2->tab_strip_model(), 100);
1601 1584
1602 // Move the second browser to the second display. 1585 // Move the second browser to the second display.
(...skipping 27 matching lines...) Expand all
1630 ASSERT_FALSE(tab_strip->IsDragSessionActive()); 1613 ASSERT_FALSE(tab_strip->IsDragSessionActive());
1631 ASSERT_FALSE(TabDragController::IsActive()); 1614 ASSERT_FALSE(TabDragController::IsActive());
1632 EXPECT_EQ("0 100", IDString(browser2->tab_strip_model())); 1615 EXPECT_EQ("0 100", IDString(browser2->tab_strip_model()));
1633 EXPECT_EQ("1", IDString(browser()->tab_strip_model())); 1616 EXPECT_EQ("1", IDString(browser()->tab_strip_model()));
1634 1617
1635 // Both windows should not be maximized 1618 // Both windows should not be maximized
1636 EXPECT_FALSE(browser()->window()->IsMaximized()); 1619 EXPECT_FALSE(browser()->window()->IsMaximized());
1637 EXPECT_FALSE(browser2->window()->IsMaximized()); 1620 EXPECT_FALSE(browser2->window()->IsMaximized());
1638 } 1621 }
1639 1622
1640 #if defined(OS_CHROMEOS)
1641 // TODO(sky,sad): Disabled as it fails due to resize locks with a real
1642 // compositor. crbug.com/331924
1643 #define MAYBE_DragTabToWindowOnSecondDisplay \
1644 DISABLED_DragTabToWindowOnSecondDisplay
1645 #else
1646 #define MAYBE_DragTabToWindowOnSecondDisplay DragTabToWindowOnSecondDisplay
1647 #endif
1648 // Drags from browser to another browser on a second display and releases input. 1623 // Drags from browser to another browser on a second display and releases input.
1649 IN_PROC_BROWSER_TEST_P(DetachToBrowserInSeparateDisplayTabDragControllerTest, 1624 IN_PROC_BROWSER_TEST_P(DetachToBrowserInSeparateDisplayTabDragControllerTest,
1650 MAYBE_DragTabToWindowOnSecondDisplay) { 1625 DISABLED_DragTabToWindowOnSecondDisplay) {
1651 // Add another tab. 1626 // Add another tab.
1652 AddTabAndResetBrowser(browser()); 1627 AddTabAndResetBrowser(browser());
1653 TabStrip* tab_strip = GetTabStripForBrowser(browser()); 1628 TabStrip* tab_strip = GetTabStripForBrowser(browser());
1654 1629
1655 // Create another browser. 1630 // Create another browser.
1656 Browser* browser2 = CreateBrowser(browser()->profile()); 1631 Browser* browser2 = CreateBrowser(browser()->profile());
1657 TabStrip* tab_strip2 = GetTabStripForBrowser(browser2); 1632 TabStrip* tab_strip2 = GetTabStripForBrowser(browser2);
1658 ResetIDs(browser2->tab_strip_model(), 100); 1633 ResetIDs(browser2->tab_strip_model(), 100);
1659 1634
1660 // Move both browsers to the second display. 1635 // Move both browsers to the second display.
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
1700 ASSERT_FALSE(tab_strip->IsDragSessionActive()); 1675 ASSERT_FALSE(tab_strip->IsDragSessionActive());
1701 ASSERT_FALSE(TabDragController::IsActive()); 1676 ASSERT_FALSE(TabDragController::IsActive());
1702 EXPECT_EQ("0 100", IDString(browser2->tab_strip_model())); 1677 EXPECT_EQ("0 100", IDString(browser2->tab_strip_model()));
1703 EXPECT_EQ("1", IDString(browser()->tab_strip_model())); 1678 EXPECT_EQ("1", IDString(browser()->tab_strip_model()));
1704 1679
1705 // Both windows should not be maximized 1680 // Both windows should not be maximized
1706 EXPECT_FALSE(browser()->window()->IsMaximized()); 1681 EXPECT_FALSE(browser()->window()->IsMaximized());
1707 EXPECT_FALSE(browser2->window()->IsMaximized()); 1682 EXPECT_FALSE(browser2->window()->IsMaximized());
1708 } 1683 }
1709 1684
1710 #if defined(OS_CHROMEOS)
1711 // TODO(sky,sad): Disabled as it fails due to resize locks with a real
1712 // compositor. crbug.com/331924
1713 #define MAYBE_DragMaxTabToNonMaxWindowInSeparateDisplay \
1714 DISABLED_DragMaxTabToNonMaxWindowInSeparateDisplay
1715 #else
1716 #define MAYBE_DragMaxTabToNonMaxWindowInSeparateDisplay \
1717 DragMaxTabToNonMaxWindowInSeparateDisplay
1718 #endif
1719 // Drags from a maximized browser to another non-maximized browser on a second 1685 // Drags from a maximized browser to another non-maximized browser on a second
1720 // display and releases input. 1686 // display and releases input.
1721 IN_PROC_BROWSER_TEST_P(DetachToBrowserInSeparateDisplayTabDragControllerTest, 1687 IN_PROC_BROWSER_TEST_P(DetachToBrowserInSeparateDisplayTabDragControllerTest,
1722 MAYBE_DragMaxTabToNonMaxWindowInSeparateDisplay) { 1688 DISABLED_DragMaxTabToNonMaxWindowInSeparateDisplay) {
1723 // Add another tab. 1689 // Add another tab.
1724 AddTabAndResetBrowser(browser()); 1690 AddTabAndResetBrowser(browser());
1725 browser()->window()->Maximize(); 1691 browser()->window()->Maximize();
1726 TabStrip* tab_strip = GetTabStripForBrowser(browser()); 1692 TabStrip* tab_strip = GetTabStripForBrowser(browser());
1727 1693
1728 // Create another browser on the second display. 1694 // Create another browser on the second display.
1729 aura::Window::Windows roots = ash::Shell::GetAllRootWindows(); 1695 aura::Window::Windows roots = ash::Shell::GetAllRootWindows();
1730 ASSERT_EQ(2u, roots.size()); 1696 ASSERT_EQ(2u, roots.size());
1731 aura::Window* first_root = roots[0]; 1697 aura::Window* first_root = roots[0];
1732 aura::Window* second_root = roots[1]; 1698 aura::Window* second_root = roots[1];
1733 gfx::Rect work_area = gfx::Screen::GetNativeScreen()->GetDisplayNearestWindow( 1699 gfx::Rect work_area = gfx::Screen::GetNativeScreen()->GetDisplayNearestWindow(
1734 second_root).work_area(); 1700 second_root).work_area();
1735 work_area.Inset(20,20,20,60); 1701 work_area.Inset(20, 20, 20, 60);
1736 Browser::CreateParams params(browser()->profile(), 1702 Browser::CreateParams params(browser()->profile(),
1737 browser()->host_desktop_type()); 1703 browser()->host_desktop_type());
1738 params.initial_show_state = ui::SHOW_STATE_NORMAL; 1704 params.initial_show_state = ui::SHOW_STATE_NORMAL;
1739 params.initial_bounds = work_area; 1705 params.initial_bounds = work_area;
1740 Browser* browser2 = new Browser(params); 1706 Browser* browser2 = new Browser(params);
1741 AddBlankTabAndShow(browser2); 1707 AddBlankTabAndShow(browser2);
1742 1708
1743 TabStrip* tab_strip2 = GetTabStripForBrowser(browser2); 1709 TabStrip* tab_strip2 = GetTabStripForBrowser(browser2);
1744 ResetIDs(browser2->tab_strip_model(), 100); 1710 ResetIDs(browser2->tab_strip_model(), 100);
1745 1711
(...skipping 30 matching lines...) Expand all
1776 ASSERT_FALSE(tab_strip->IsDragSessionActive()); 1742 ASSERT_FALSE(tab_strip->IsDragSessionActive());
1777 ASSERT_FALSE(TabDragController::IsActive()); 1743 ASSERT_FALSE(TabDragController::IsActive());
1778 EXPECT_EQ("0 100", IDString(browser2->tab_strip_model())); 1744 EXPECT_EQ("0 100", IDString(browser2->tab_strip_model()));
1779 EXPECT_EQ("1", IDString(browser()->tab_strip_model())); 1745 EXPECT_EQ("1", IDString(browser()->tab_strip_model()));
1780 1746
1781 // Source browser should still be maximized, target should not 1747 // Source browser should still be maximized, target should not
1782 EXPECT_TRUE(browser()->window()->IsMaximized()); 1748 EXPECT_TRUE(browser()->window()->IsMaximized());
1783 EXPECT_FALSE(browser2->window()->IsMaximized()); 1749 EXPECT_FALSE(browser2->window()->IsMaximized());
1784 } 1750 }
1785 1751
1786 // Immersive fullscreen is Ash only. However, Windows Ash does not support
1787 // multiple displays.
1788 #if defined(OS_CHROMEOS)
1789 // TODO(sky,sad): Disabled as it fails due to resize locks with a real
1790 // compositor. crbug.com/331924
1791 #define MAYBE_DragTabToImmersiveBrowserOnSeparateDisplay \
1792 DISABLED_DragTabToImmersiveBrowserOnSeparateDisplay
1793 // Drags from a restored browser to an immersive fullscreen browser on a 1752 // Drags from a restored browser to an immersive fullscreen browser on a
1794 // second display and releases input. 1753 // second display and releases input.
1795 IN_PROC_BROWSER_TEST_P(DetachToBrowserInSeparateDisplayTabDragControllerTest, 1754 IN_PROC_BROWSER_TEST_P(DetachToBrowserInSeparateDisplayTabDragControllerTest,
1796 MAYBE_DragTabToImmersiveBrowserOnSeparateDisplay) { 1755 DISABLED_DragTabToImmersiveBrowserOnSeparateDisplay) {
1797 // Add another tab. 1756 // Add another tab.
1798 AddTabAndResetBrowser(browser()); 1757 AddTabAndResetBrowser(browser());
1799 TabStrip* tab_strip = GetTabStripForBrowser(browser()); 1758 TabStrip* tab_strip = GetTabStripForBrowser(browser());
1800 1759
1801 // Create another browser. 1760 // Create another browser.
1802 Browser* browser2 = CreateBrowser(browser()->profile()); 1761 Browser* browser2 = CreateBrowser(browser()->profile());
1803 TabStrip* tab_strip2 = GetTabStripForBrowser(browser2); 1762 TabStrip* tab_strip2 = GetTabStripForBrowser(browser2);
1804 ResetIDs(browser2->tab_strip_model(), 100); 1763 ResetIDs(browser2->tab_strip_model(), 100);
1805 1764
1806 // Move the second browser to the second display. 1765 // Move the second browser to the second display.
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
1859 // The first browser window should not be in immersive fullscreen. 1818 // The first browser window should not be in immersive fullscreen.
1860 // browser2 should still be in immersive fullscreen, but the top chrome should 1819 // browser2 should still be in immersive fullscreen, but the top chrome should
1861 // no longer be revealed. 1820 // no longer be revealed.
1862 BrowserView* browser_view = BrowserView::GetBrowserViewForBrowser(browser()); 1821 BrowserView* browser_view = BrowserView::GetBrowserViewForBrowser(browser());
1863 EXPECT_FALSE(browser_view->immersive_mode_controller()->IsEnabled()); 1822 EXPECT_FALSE(browser_view->immersive_mode_controller()->IsEnabled());
1864 1823
1865 EXPECT_TRUE(immersive_controller2->IsEnabled()); 1824 EXPECT_TRUE(immersive_controller2->IsEnabled());
1866 EXPECT_FALSE(immersive_controller2->IsRevealed()); 1825 EXPECT_FALSE(immersive_controller2->IsRevealed());
1867 EXPECT_TRUE(tab_strip2->IsImmersiveStyle()); 1826 EXPECT_TRUE(tab_strip2->IsImmersiveStyle());
1868 } 1827 }
1869 #endif // OS_CHROMEOS
1870 1828
1871 // Subclass of DetachToBrowserTabDragControllerTest that 1829 // Subclass of DetachToBrowserTabDragControllerTest that
1872 // creates multiple displays with different device scale factors. 1830 // creates multiple displays with different device scale factors.
1873 class DifferentDeviceScaleFactorDisplayTabDragControllerTest 1831 class DifferentDeviceScaleFactorDisplayTabDragControllerTest
1874 : public DetachToBrowserTabDragControllerTest { 1832 : public DetachToBrowserTabDragControllerTest {
1875 public: 1833 public:
1876 DifferentDeviceScaleFactorDisplayTabDragControllerTest() {} 1834 DifferentDeviceScaleFactorDisplayTabDragControllerTest() {}
1877 virtual ~DifferentDeviceScaleFactorDisplayTabDragControllerTest() {} 1835 virtual ~DifferentDeviceScaleFactorDisplayTabDragControllerTest() {}
1878 1836
1879 virtual void SetUpCommandLine(CommandLine* command_line) OVERRIDE { 1837 virtual void SetUpCommandLine(CommandLine* command_line) OVERRIDE {
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after
1939 } else { 1897 } else {
1940 // Finishes a serise of CursorDeviceScaleFactorStep calls and ends drag. 1898 // Finishes a serise of CursorDeviceScaleFactorStep calls and ends drag.
1941 EXPECT_EQ(1.0f, test->GetCursorDeviceScaleFactor()); 1899 EXPECT_EQ(1.0f, test->GetCursorDeviceScaleFactor());
1942 ASSERT_TRUE(ui_test_utils::SendMouseEventsSync( 1900 ASSERT_TRUE(ui_test_utils::SendMouseEventsSync(
1943 ui_controls::LEFT, ui_controls::UP)); 1901 ui_controls::LEFT, ui_controls::UP));
1944 } 1902 }
1945 } 1903 }
1946 1904
1947 } // namespace 1905 } // namespace
1948 1906
1949 #if defined(OS_CHROMEOS)
1950 // TODO(sky,sad): Disabled as it fails due to resize locks with a real
1951 // compositor. crbug.com/331924
1952 #define MAYBE_CursorDeviceScaleFactor DISABLED_CursorDeviceScaleFactor
1953 #else
1954 #define MAYBE_CursorDeviceScaleFactor CursorDeviceScaleFactor
1955 #endif
1956 // Verifies cursor's device scale factor is updated when a tab is moved across 1907 // Verifies cursor's device scale factor is updated when a tab is moved across
1957 // displays with different device scale factors (http://crbug.com/154183). 1908 // displays with different device scale factors (http://crbug.com/154183).
1958 IN_PROC_BROWSER_TEST_P(DifferentDeviceScaleFactorDisplayTabDragControllerTest, 1909 IN_PROC_BROWSER_TEST_P(DifferentDeviceScaleFactorDisplayTabDragControllerTest,
1959 MAYBE_CursorDeviceScaleFactor) { 1910 DISABLED_CursorDeviceScaleFactor) {
1960 // Add another tab. 1911 // Add another tab.
1961 AddTabAndResetBrowser(browser()); 1912 AddTabAndResetBrowser(browser());
1962 TabStrip* tab_strip = GetTabStripForBrowser(browser()); 1913 TabStrip* tab_strip = GetTabStripForBrowser(browser());
1963 1914
1964 // Move the second browser to the second display. 1915 // Move the second browser to the second display.
1965 aura::Window::Windows roots = ash::Shell::GetAllRootWindows(); 1916 aura::Window::Windows roots = ash::Shell::GetAllRootWindows();
1966 ASSERT_EQ(2u, roots.size()); 1917 ASSERT_EQ(2u, roots.size());
1967 1918
1968 // Move to the first tab and drag it enough so that it detaches. 1919 // Move to the first tab and drag it enough so that it detaches.
1969 gfx::Point tab_0_center(GetCenterInScreenCoordinates(tab_strip->tab_at(0))); 1920 gfx::Point tab_0_center(GetCenterInScreenCoordinates(tab_strip->tab_at(0)));
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after
2040 new_browser->window()->GetNativeWindow()->GetRootWindow()); 1991 new_browser->window()->GetNativeWindow()->GetRootWindow());
2041 1992
2042 ASSERT_TRUE(test->DragTabAndExecuteTaskWhenDone( 1993 ASSERT_TRUE(test->DragTabAndExecuteTaskWhenDone(
2043 final_destination, 1994 final_destination,
2044 base::Bind(&CancelDragTabToWindowInSeparateDisplayStep3, 1995 base::Bind(&CancelDragTabToWindowInSeparateDisplayStep3,
2045 tab_strip, browser_list))); 1996 tab_strip, browser_list)));
2046 } 1997 }
2047 1998
2048 } // namespace 1999 } // namespace
2049 2000
2050 #if defined(OS_CHROMEOS) || defined(OS_LINUX)
2051 // TODO(sky,sad): Disabled as it fails due to resize locks with a real
2052 // compositor. crbug.com/331924
2053 #define MAYBE_CancelDragTabToWindowIn2ndDisplay \
2054 DISABLED_CancelDragTabToWindowIn2ndDisplay
2055 #else
2056 #define MAYBE_CancelDragTabToWindowIn2ndDisplay \
2057 CancelDragTabToWindowIn2ndDisplay
2058 #endif
2059 // Drags from browser to a second display and releases input. 2001 // Drags from browser to a second display and releases input.
2060 IN_PROC_BROWSER_TEST_F( 2002 IN_PROC_BROWSER_TEST_F(
2061 DetachToBrowserInSeparateDisplayAndCancelTabDragControllerTest, 2003 DetachToBrowserInSeparateDisplayAndCancelTabDragControllerTest,
2062 MAYBE_CancelDragTabToWindowIn2ndDisplay) { 2004 DISABLED_CancelDragTabToWindowIn2ndDisplay) {
2063 // Add another tab. 2005 // Add another tab.
2064 AddTabAndResetBrowser(browser()); 2006 AddTabAndResetBrowser(browser());
2065 TabStrip* tab_strip = GetTabStripForBrowser(browser()); 2007 TabStrip* tab_strip = GetTabStripForBrowser(browser());
2066 2008
2067 EXPECT_EQ("0 1", IDString(browser()->tab_strip_model())); 2009 EXPECT_EQ("0 1", IDString(browser()->tab_strip_model()));
2068 2010
2069 // Move the second browser to the second display. 2011 // Move the second browser to the second display.
2070 aura::Window::Windows roots = ash::Shell::GetAllRootWindows(); 2012 aura::Window::Windows roots = ash::Shell::GetAllRootWindows();
2071 ASSERT_EQ(2u, roots.size()); 2013 ASSERT_EQ(2u, roots.size());
2072 gfx::Point final_destination = 2014 gfx::Point final_destination =
(...skipping 14 matching lines...) Expand all
2087 ASSERT_EQ(1u, native_browser_list->size()); 2029 ASSERT_EQ(1u, native_browser_list->size());
2088 ASSERT_FALSE(tab_strip->IsDragSessionActive()); 2030 ASSERT_FALSE(tab_strip->IsDragSessionActive());
2089 ASSERT_FALSE(TabDragController::IsActive()); 2031 ASSERT_FALSE(TabDragController::IsActive());
2090 EXPECT_EQ("0 1", IDString(browser()->tab_strip_model())); 2032 EXPECT_EQ("0 1", IDString(browser()->tab_strip_model()));
2091 2033
2092 // Release the mouse 2034 // Release the mouse
2093 ASSERT_TRUE(ui_test_utils::SendMouseEventsSync( 2035 ASSERT_TRUE(ui_test_utils::SendMouseEventsSync(
2094 ui_controls::LEFT, ui_controls::UP)); 2036 ui_controls::LEFT, ui_controls::UP));
2095 } 2037 }
2096 2038
2097 #if defined(OS_CHROMEOS) || defined(OS_LINUX)
2098 // TODO(sky,sad): Disabled as it fails due to resize locks with a real
2099 // compositor. crbug.com/331924
2100 #define MAYBE_CancelDragTabToWindowIn1stDisplay \
2101 DISABLED_CancelDragTabToWindowIn1stDisplay
2102 #else
2103 #define MAYBE_CancelDragTabToWindowIn1stDisplay \
2104 CancelDragTabToWindowIn1stDisplay
2105 #endif
2106 // Drags from browser from a second display to primary and releases input. 2039 // Drags from browser from a second display to primary and releases input.
2107 IN_PROC_BROWSER_TEST_F( 2040 IN_PROC_BROWSER_TEST_F(
2108 DetachToBrowserInSeparateDisplayAndCancelTabDragControllerTest, 2041 DetachToBrowserInSeparateDisplayAndCancelTabDragControllerTest,
2109 MAYBE_CancelDragTabToWindowIn1stDisplay) { 2042 DISABLED_CancelDragTabToWindowIn1stDisplay) {
2110 aura::Window::Windows roots = ash::Shell::GetAllRootWindows(); 2043 aura::Window::Windows roots = ash::Shell::GetAllRootWindows();
2111 ASSERT_EQ(2u, roots.size()); 2044 ASSERT_EQ(2u, roots.size());
2112 2045
2113 // Add another tab. 2046 // Add another tab.
2114 AddTabAndResetBrowser(browser()); 2047 AddTabAndResetBrowser(browser());
2115 TabStrip* tab_strip = GetTabStripForBrowser(browser()); 2048 TabStrip* tab_strip = GetTabStripForBrowser(browser());
2116 2049
2117 EXPECT_EQ("0 1", IDString(browser()->tab_strip_model())); 2050 EXPECT_EQ("0 1", IDString(browser()->tab_strip_model()));
2118 EXPECT_EQ(roots[0], browser()->window()->GetNativeWindow()->GetRootWindow()); 2051 EXPECT_EQ(roots[0], browser()->window()->GetNativeWindow()->GetRootWindow());
2119 2052
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
2155 ASSERT_TRUE(TabDragController::IsActive()); 2088 ASSERT_TRUE(TabDragController::IsActive());
2156 ASSERT_EQ(2u, test->native_browser_list->size()); 2089 ASSERT_EQ(2u, test->native_browser_list->size());
2157 Browser* new_browser = test->native_browser_list->get(1); 2090 Browser* new_browser = test->native_browser_list->get(1);
2158 ASSERT_TRUE(new_browser->window()->IsActive()); 2091 ASSERT_TRUE(new_browser->window()->IsActive());
2159 2092
2160 ASSERT_TRUE(test->PressInput2()); 2093 ASSERT_TRUE(test->PressInput2());
2161 } 2094 }
2162 2095
2163 } // namespace 2096 } // namespace
2164 2097
2165 #if defined(OS_CHROMEOS)
2166 // TODO(sky,sad): Disabled as it fails due to resize locks with a real
2167 // compositor. crbug.com/331924
2168 #define MAYBE_PressSecondFingerWhileDetached DISABLED_PressSecondFingerWhileDeta ched
2169 #else
2170 #define MAYBE_PressSecondFingerWhileDetached PressSecondFingerWhileDetached
2171 #endif
2172 // Detaches a tab and while detached presses a second finger. 2098 // Detaches a tab and while detached presses a second finger.
2173 IN_PROC_BROWSER_TEST_P(DetachToBrowserTabDragControllerTestTouch, 2099 IN_PROC_BROWSER_TEST_P(DetachToBrowserTabDragControllerTestTouch,
2174 MAYBE_PressSecondFingerWhileDetached) { 2100 DISABLED_PressSecondFingerWhileDetached) {
2175 gfx::Rect bounds(browser()->window()->GetBounds()); 2101 gfx::Rect bounds(browser()->window()->GetBounds());
2176 // Add another tab. 2102 // Add another tab.
2177 AddTabAndResetBrowser(browser()); 2103 AddTabAndResetBrowser(browser());
2178 TabStrip* tab_strip = GetTabStripForBrowser(browser()); 2104 TabStrip* tab_strip = GetTabStripForBrowser(browser());
2179 EXPECT_EQ("0 1", IDString(browser()->tab_strip_model())); 2105 EXPECT_EQ("0 1", IDString(browser()->tab_strip_model()));
2180 2106
2181 // Move to the first tab and drag it enough so that it detaches. 2107 // Move to the first tab and drag it enough so that it detaches.
2182 gfx::Point tab_0_center( 2108 gfx::Point tab_0_center(
2183 GetCenterInScreenCoordinates(tab_strip->tab_at(0))); 2109 GetCenterInScreenCoordinates(tab_strip->tab_at(0)));
2184 ASSERT_TRUE(PressInput(tab_0_center)); 2110 ASSERT_TRUE(PressInput(tab_0_center));
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
2227 ASSERT_TRUE(test->DragInputToNotifyWhenDone( 2153 ASSERT_TRUE(test->DragInputToNotifyWhenDone(
2228 target_point.x(), target_point.y(), 2154 target_point.x(), target_point.y(),
2229 base::Bind(&DetachToDockedWindowNextStep, 2155 base::Bind(&DetachToDockedWindowNextStep,
2230 test, 2156 test,
2231 gfx::Point(target_point.x(), 1 + target_point.y()), 2157 gfx::Point(target_point.x(), 1 + target_point.y()),
2232 iteration - 1))); 2158 iteration - 1)));
2233 } 2159 }
2234 2160
2235 } // namespace 2161 } // namespace
2236 2162
2237 #if defined(OS_CHROMEOS)
2238 // TODO(sky,sad): Disabled as it fails due to resize locks with a real
2239 // compositor. crbug.com/331924
2240 #define MAYBE_DetachToDockedWindowFromMaximizedWindow \
2241 DISABLED_DetachToDockedWindowFromMaximizedWindow
2242 #else
2243 #define MAYBE_DetachToDockedWindowFromMaximizedWindow \
2244 DetachToDockedWindowFromMaximizedWindow
2245 #endif
2246 // Drags from browser to separate window, docks that window and releases mouse. 2163 // Drags from browser to separate window, docks that window and releases mouse.
2247 IN_PROC_BROWSER_TEST_P(DetachToDockedTabDragControllerTest, 2164 IN_PROC_BROWSER_TEST_P(DetachToDockedTabDragControllerTest,
2248 MAYBE_DetachToDockedWindowFromMaximizedWindow) { 2165 DISABLED_DetachToDockedWindowFromMaximizedWindow) {
2249 // TODO(sky,sad): Disabled as it fails due to resize locks with a real 2166 // TODO(sky,sad): Disabled as it fails due to resize locks with a real
2250 // compositor. crbug.com/331924 2167 // compositor. crbug.com/331924
2251 if (docked_windows_enabled()) { 2168 if (docked_windows_enabled()) {
2252 VLOG(1) << "Test is DISABLED for docked windows."; 2169 VLOG(1) << "Test is DISABLED for docked windows.";
2253 return; 2170 return;
2254 } 2171 }
2255 2172
2256 // Maximize the initial browser window. 2173 // Maximize the initial browser window.
2257 browser()->window()->Maximize(); 2174 browser()->window()->Maximize();
2258 ASSERT_TRUE(browser()->window()->IsMaximized()); 2175 ASSERT_TRUE(browser()->window()->IsMaximized());
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
2308 // The new window should be docked and not snapped if docking is allowed. 2225 // The new window should be docked and not snapped if docking is allowed.
2309 EXPECT_TRUE(window_state->IsDocked()); 2226 EXPECT_TRUE(window_state->IsDocked());
2310 EXPECT_FALSE(window_state->IsSnapped()); 2227 EXPECT_FALSE(window_state->IsSnapped());
2311 } else { 2228 } else {
2312 // The new window should be snapped and not docked if docking is disabled. 2229 // The new window should be snapped and not docked if docking is disabled.
2313 EXPECT_FALSE(window_state->IsDocked()); 2230 EXPECT_FALSE(window_state->IsDocked());
2314 EXPECT_TRUE(window_state->IsSnapped()); 2231 EXPECT_TRUE(window_state->IsSnapped());
2315 } 2232 }
2316 } 2233 }
2317 2234
2318 2235 #endif // OS_CHROMEOS
2319 #endif
2320 2236
2321 #if defined(USE_ASH) && defined(OS_CHROMEOS) // TODO(win_ash,linux_ash) 2237 #if defined(USE_ASH) && defined(OS_CHROMEOS) // TODO(win_ash,linux_ash)
2322 INSTANTIATE_TEST_CASE_P(TabDragging, 2238 INSTANTIATE_TEST_CASE_P(TabDragging,
2323 DetachToBrowserInSeparateDisplayTabDragControllerTest, 2239 DetachToBrowserInSeparateDisplayTabDragControllerTest,
2324 ::testing::Values("mouse", "touch")); 2240 ::testing::Values("mouse", "touch"));
2325 INSTANTIATE_TEST_CASE_P(TabDragging, 2241 INSTANTIATE_TEST_CASE_P(TabDragging,
2326 DifferentDeviceScaleFactorDisplayTabDragControllerTest, 2242 DifferentDeviceScaleFactorDisplayTabDragControllerTest,
2327 ::testing::Values("mouse")); 2243 ::testing::Values("mouse"));
2328 INSTANTIATE_TEST_CASE_P(TabDragging, 2244 INSTANTIATE_TEST_CASE_P(TabDragging,
2329 DetachToBrowserTabDragControllerTest, 2245 DetachToBrowserTabDragControllerTest,
2330 ::testing::Values("mouse", "touch")); 2246 ::testing::Values("mouse", "touch"));
2331 INSTANTIATE_TEST_CASE_P(TabDragging, 2247 INSTANTIATE_TEST_CASE_P(TabDragging,
2332 DetachToDockedTabDragControllerTest, 2248 DetachToDockedTabDragControllerTest,
2333 ::testing::Values("mouse", "mouse docked")); 2249 ::testing::Values("mouse", "mouse docked"));
2334 INSTANTIATE_TEST_CASE_P(TabDragging, 2250 INSTANTIATE_TEST_CASE_P(TabDragging,
2335 DetachToBrowserTabDragControllerTestTouch, 2251 DetachToBrowserTabDragControllerTestTouch,
2336 ::testing::Values("touch", "touch docked")); 2252 ::testing::Values("touch", "touch docked"));
2337 #elif defined(USE_ASH) && !defined(OS_LINUX) // TODO(linux_ash) 2253 #elif defined(USE_ASH)
2338 INSTANTIATE_TEST_CASE_P(TabDragging, 2254 INSTANTIATE_TEST_CASE_P(TabDragging,
2339 DetachToBrowserTabDragControllerTest, 2255 DetachToBrowserTabDragControllerTest,
2340 ::testing::Values("mouse")); 2256 ::testing::Values("mouse"));
2341 #endif 2257 #endif
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698