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

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: Update Defines and Disabled Tests Created 6 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« 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>
jonross 2014/05/27 17:44:27 Cpplint
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
39 #if defined(USE_AURA) && !defined(OS_CHROMEOS) 41 #if defined(USE_AURA) && !defined(OS_CHROMEOS)
40 #include "chrome/browser/ui/views/frame/desktop_browser_frame_aura.h" 42 #include "chrome/browser/ui/views/frame/desktop_browser_frame_aura.h"
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"
51 #include "ash/shell_init_params.h"
49 #include "ash/test/cursor_manager_test_api.h" 52 #include "ash/test/cursor_manager_test_api.h"
53 #include "ash/test/test_shell_delegate.h"
50 #include "ash/wm/coordinate_conversion.h" 54 #include "ash/wm/coordinate_conversion.h"
51 #include "ash/wm/window_state.h"
jonross 2014/05/27 17:44:27 cpplint
52 #include "ash/wm/window_util.h" 55 #include "ash/wm/window_util.h"
53 #include "chrome/browser/ui/views/frame/immersive_mode_controller.h" 56 #include "chrome/browser/ui/views/frame/immersive_mode_controller.h"
54 #include "ui/aura/client/screen_position_client.h" 57 #include "ui/aura/client/screen_position_client.h"
55 #include "ui/aura/test/event_generator.h" 58 #include "ui/aura/test/event_generator.h"
56 #include "ui/aura/window_event_dispatcher.h" 59 #include "ui/aura/window_event_dispatcher.h"
57 #endif 60 #endif
58 61
59 using content::WebContents; 62 using content::WebContents;
60 63
61 namespace test { 64 namespace test {
(...skipping 265 matching lines...) Expand 10 before | Expand all | Expand 10 after
327 TabStrip* tab_strip = GetTabStripForBrowser(browser()); 330 TabStrip* tab_strip = GetTabStripForBrowser(browser());
328 331
329 Tab* tab1 = tab_strip->tab_at(1); 332 Tab* tab1 = tab_strip->tab_at(1);
330 gfx::Point tab_1_center(tab1->width() / 2, tab1->height() / 2); 333 gfx::Point tab_1_center(tab1->width() / 2, tab1->height() / 2);
331 334
332 ui::GestureEvent gesture_begin(ui::ET_GESTURE_BEGIN, tab_1_center.x(), 335 ui::GestureEvent gesture_begin(ui::ET_GESTURE_BEGIN, tab_1_center.x(),
333 tab_1_center.x(), 0, base::TimeDelta(), 336 tab_1_center.x(), 0, base::TimeDelta(),
334 ui::GestureEventDetails(ui::ET_GESTURE_BEGIN, 0.0f, 0.0f), 0); 337 ui::GestureEventDetails(ui::ET_GESTURE_BEGIN, 0.0f, 0.0f), 0);
335 tab_strip->MaybeStartDrag(tab1, gesture_begin, 338 tab_strip->MaybeStartDrag(tab1, gesture_begin,
336 tab_strip->GetSelectionModel()); 339 tab_strip->GetSelectionModel());
337 //tab_strip->tab_at(1)->OnGestureEvent(&gesture_begin); 340 // tab_strip->tab_at(1)->OnGestureEvent(&gesture_begin);
jonross 2014/05/27 17:44:27 cpplint
pkotwicz 2014/05/28 00:32:03 Can't we just get rid of this line?
jonross 2014/05/28 14:55:57 Done.
338 EXPECT_TRUE(TabDragController::IsActive()); 341 EXPECT_TRUE(TabDragController::IsActive());
339 342
340 ui::GestureEvent gesture_end(ui::ET_GESTURE_END, tab_1_center.x(), 343 ui::GestureEvent gesture_end(ui::ET_GESTURE_END, tab_1_center.x(),
341 tab_1_center.x(), 0, base::TimeDelta(), 344 tab_1_center.x(), 0, base::TimeDelta(),
342 ui::GestureEventDetails(ui::ET_GESTURE_END, 0.0f, 0.0f), 0); 345 ui::GestureEventDetails(ui::ET_GESTURE_END, 0.0f, 0.0f), 0);
343 tab_strip->OnGestureEvent(&gesture_end); 346 tab_strip->OnGestureEvent(&gesture_end);
344 EXPECT_FALSE(TabDragController::IsActive()); 347 EXPECT_FALSE(TabDragController::IsActive());
345 EXPECT_FALSE(tab_strip->IsDragSessionActive()); 348 EXPECT_FALSE(tab_strip->IsDragSessionActive());
346 } 349 }
347 350
348 #endif 351 #endif
349 352
350 class DetachToBrowserTabDragControllerTest 353 class DetachToBrowserTabDragControllerTest
351 : public TabDragControllerTest, 354 : public TabDragControllerTest,
352 public ::testing::WithParamInterface<const char*> { 355 public ::testing::WithParamInterface<const char*> {
353 public: 356 public:
354 DetachToBrowserTabDragControllerTest() {} 357 DetachToBrowserTabDragControllerTest() {}
355 358
356 virtual void SetUpCommandLine(CommandLine* command_line) OVERRIDE { 359 virtual void SetUpCommandLine(CommandLine* command_line) OVERRIDE {
357 #if defined(USE_ASH) && !defined(OS_WIN) // TODO(win_ash) 360 #if defined(OS_CHROMEOS)
358 if (!docked_windows_enabled()) { 361 if (!docked_windows_enabled()) {
359 CommandLine::ForCurrentProcess()->AppendSwitch( 362 CommandLine::ForCurrentProcess()->AppendSwitch(
360 ash::switches::kAshDisableDockedWindows); 363 ash::switches::kAshDisableDockedWindows);
361 } 364 }
362 #endif 365 #endif
363 } 366 }
364 367
365 virtual void SetUpOnMainThread() OVERRIDE { 368 virtual void SetUpOnMainThread() OVERRIDE {
366 #if defined(USE_ASH) && !defined(OS_WIN) // TODO(win_ash) 369 #if defined(OS_CHROMEOS)
pkotwicz 2014/05/28 00:32:03 Can this new code be removed?
jonross 2014/05/28 14:55:57 With this now restricted to chrome os, yes. Done.
370 if (!ash::Shell::HasInstance()) {
371 ash::ShellInitParams params;
372 // Owned by ash::Shell
373 params.delegate = new ash::test::TestShellDelegate;
374 params.context_factory = ui::ContextFactory::GetInstance();
375 ash::Shell::CreateInstance(params);
376 }
367 event_generator_.reset(new aura::test::EventGenerator( 377 event_generator_.reset(new aura::test::EventGenerator(
368 ash::Shell::GetPrimaryRootWindow())); 378 ash::Shell::GetPrimaryRootWindow()));
369 #endif 379 #endif
370 } 380 }
371 381
382 virtual void TearDownOnMainThread() OVERRIDE {
383 #if defined(OS_CHROMEOS)
384 event_generator_.reset();
385 ash::Shell::DeleteInstance();
386 #endif
387 }
388
372 InputSource input_source() const { 389 InputSource input_source() const {
373 return strstr(GetParam(), "mouse") ? 390 return strstr(GetParam(), "mouse") ?
374 INPUT_SOURCE_MOUSE : INPUT_SOURCE_TOUCH; 391 INPUT_SOURCE_MOUSE : INPUT_SOURCE_TOUCH;
375 } 392 }
376 393
377 bool docked_windows_enabled() const { 394 bool docked_windows_enabled() const {
378 return (strstr(GetParam(), "docked") != NULL); 395 return (strstr(GetParam(), "docked") != NULL);
379 } 396 }
380 397
381 // Set root window from a point in screen coordinates 398 // Set root window from a point in screen coordinates
382 void SetEventGeneratorRootWindow(const gfx::Point& point) { 399 void SetEventGeneratorRootWindow(const gfx::Point& point) {
383 if (input_source() == INPUT_SOURCE_MOUSE) 400 if (input_source() == INPUT_SOURCE_MOUSE)
384 return; 401 return;
385 #if defined(USE_ASH) && !defined(OS_WIN) // TODO(win_ash) 402 #if defined(OS_CHROMEOS)
386 event_generator_.reset(new aura::test::EventGenerator( 403 event_generator_.reset(new aura::test::EventGenerator(
387 new ScreenEventGeneratorDelegate(ash::wm::GetRootWindowAt(point)))); 404 new ScreenEventGeneratorDelegate(ash::wm::GetRootWindowAt(point))));
388 #endif 405 #endif
389 } 406 }
390 407
391 // The following methods update one of the mouse or touch input depending upon 408 // The following methods update one of the mouse or touch input depending upon
392 // the InputSource. 409 // the InputSource.
393 bool PressInput(const gfx::Point& location) { 410 bool PressInput(const gfx::Point& location) {
394 if (input_source() == INPUT_SOURCE_MOUSE) { 411 if (input_source() == INPUT_SOURCE_MOUSE) {
395 return ui_test_utils::SendMouseMoveSync(location) && 412 return ui_test_utils::SendMouseMoveSync(location) &&
396 ui_test_utils::SendMouseEventsSync( 413 ui_test_utils::SendMouseEventsSync(
397 ui_controls::LEFT, ui_controls::DOWN); 414 ui_controls::LEFT, ui_controls::DOWN);
398 } 415 }
399 #if defined(USE_ASH) && !defined(OS_WIN) // TODO(win_ash) 416 #if defined(OS_CHROMEOS)
400 event_generator_->set_current_location(location); 417 event_generator_->set_current_location(location);
401 event_generator_->PressTouch(); 418 event_generator_->PressTouch();
402 #else 419 #else
403 NOTREACHED(); 420 NOTREACHED();
404 #endif 421 #endif
405 return true; 422 return true;
406 } 423 }
407 424
408 bool PressInput2() { 425 bool PressInput2() {
409 // Second touch input is only used for touch sequence tests. 426 // Second touch input is only used for touch sequence tests.
410 EXPECT_EQ(INPUT_SOURCE_TOUCH, input_source()); 427 EXPECT_EQ(INPUT_SOURCE_TOUCH, input_source());
411 #if defined(USE_ASH) && !defined(OS_WIN) // TODO(win_ash) 428 #if defined(OS_CHROMEOS)
412 event_generator_->set_current_location( 429 event_generator_->set_current_location(
413 event_generator_->current_location()); 430 event_generator_->current_location());
414 event_generator_->PressTouchId(1); 431 event_generator_->PressTouchId(1);
415 #else 432 #else
416 NOTREACHED(); 433 NOTREACHED();
417 #endif 434 #endif
418 return true; 435 return true;
419 } 436 }
420 437
421 bool DragInputTo(const gfx::Point& location) { 438 bool DragInputTo(const gfx::Point& location) {
422 if (input_source() == INPUT_SOURCE_MOUSE) 439 if (input_source() == INPUT_SOURCE_MOUSE)
423 return ui_test_utils::SendMouseMoveSync(location); 440 return ui_test_utils::SendMouseMoveSync(location);
424 #if defined(USE_ASH) && !defined(OS_WIN) // TODO(win_ash) 441 #if defined(OS_CHROMEOS)
425 event_generator_->MoveTouch(location); 442 event_generator_->MoveTouch(location);
426 #else 443 #else
427 NOTREACHED(); 444 NOTREACHED();
428 #endif 445 #endif
429 return true; 446 return true;
430 } 447 }
431 448
432 bool DragInputToAsync(const gfx::Point& location) { 449 bool DragInputToAsync(const gfx::Point& location) {
433 if (input_source() == INPUT_SOURCE_MOUSE) 450 if (input_source() == INPUT_SOURCE_MOUSE)
434 return ui_controls::SendMouseMove(location.x(), location.y()); 451 return ui_controls::SendMouseMove(location.x(), location.y());
435 #if defined(USE_ASH) && !defined(OS_WIN) // TODO(win_ash) 452 #if defined(OS_CHROMEOS)
436 event_generator_->MoveTouch(location); 453 event_generator_->MoveTouch(location);
437 #else 454 #else
438 NOTREACHED(); 455 NOTREACHED();
439 #endif 456 #endif
440 return true; 457 return true;
441 } 458 }
442 459
443 bool DragInputToNotifyWhenDone(int x, 460 bool DragInputToNotifyWhenDone(int x,
444 int y, 461 int y,
445 const base::Closure& task) { 462 const base::Closure& task) {
446 if (input_source() == INPUT_SOURCE_MOUSE) 463 if (input_source() == INPUT_SOURCE_MOUSE)
447 return ui_controls::SendMouseMoveNotifyWhenDone(x, y, task); 464 return ui_controls::SendMouseMoveNotifyWhenDone(x, y, task);
448 #if defined(USE_ASH) && !defined(OS_WIN) // TODO(win_ash) 465 #if defined(OS_CHROMEOS)
449 base::MessageLoop::current()->PostTask(FROM_HERE, task); 466 base::MessageLoop::current()->PostTask(FROM_HERE, task);
450 event_generator_->MoveTouch(gfx::Point(x, y)); 467 event_generator_->MoveTouch(gfx::Point(x, y));
451 #else 468 #else
452 NOTREACHED(); 469 NOTREACHED();
453 #endif 470 #endif
454 return true; 471 return true;
455 } 472 }
456 473
457 bool DragInputToDelayedNotifyWhenDone(int x, 474 bool DragInputToDelayedNotifyWhenDone(int x,
458 int y, 475 int y,
459 const base::Closure& task, 476 const base::Closure& task,
460 base::TimeDelta delay) { 477 base::TimeDelta delay) {
461 if (input_source() == INPUT_SOURCE_MOUSE) 478 if (input_source() == INPUT_SOURCE_MOUSE)
462 return ui_controls::SendMouseMoveNotifyWhenDone(x, y, task); 479 return ui_controls::SendMouseMoveNotifyWhenDone(x, y, task);
463 #if defined(USE_ASH) && !defined(OS_WIN) // TODO(win_ash) 480 #if defined(OS_CHROMEOS)
464 base::MessageLoop::current()->PostDelayedTask(FROM_HERE, task, delay); 481 base::MessageLoop::current()->PostDelayedTask(FROM_HERE, task, delay);
465 event_generator_->MoveTouch(gfx::Point(x, y)); 482 event_generator_->MoveTouch(gfx::Point(x, y));
466 #else 483 #else
467 NOTREACHED(); 484 NOTREACHED();
468 #endif 485 #endif
469 return true; 486 return true;
470 } 487 }
471 488
472 bool DragInput2ToNotifyWhenDone(int x, 489 bool DragInput2ToNotifyWhenDone(int x,
473 int y, 490 int y,
474 const base::Closure& task) { 491 const base::Closure& task) {
475 if (input_source() == INPUT_SOURCE_MOUSE) 492 if (input_source() == INPUT_SOURCE_MOUSE)
476 return ui_controls::SendMouseMoveNotifyWhenDone(x, y, task); 493 return ui_controls::SendMouseMoveNotifyWhenDone(x, y, task);
477 #if defined(USE_ASH) && !defined(OS_WIN) // TODO(win_ash) 494 #if defined(OS_CHROMEOS)
478 base::MessageLoop::current()->PostTask(FROM_HERE, task); 495 base::MessageLoop::current()->PostTask(FROM_HERE, task);
479 event_generator_->MoveTouchId(gfx::Point(x, y), 1); 496 event_generator_->MoveTouchId(gfx::Point(x, y), 1);
480 #else 497 #else
481 NOTREACHED(); 498 NOTREACHED();
482 #endif 499 #endif
483 return true; 500 return true;
484 } 501 }
485 502
486 bool ReleaseInput() { 503 bool ReleaseInput() {
487 if (input_source() == INPUT_SOURCE_MOUSE) { 504 if (input_source() == INPUT_SOURCE_MOUSE) {
488 return ui_test_utils::SendMouseEventsSync( 505 return ui_test_utils::SendMouseEventsSync(
489 ui_controls::LEFT, ui_controls::UP); 506 ui_controls::LEFT, ui_controls::UP);
490 } 507 }
491 #if defined(USE_ASH) && !defined(OS_WIN) // TODO(win_ash) 508 #if defined(OS_CHROMEOS)
492 event_generator_->ReleaseTouch(); 509 event_generator_->ReleaseTouch();
493 #else 510 #else
494 NOTREACHED(); 511 NOTREACHED();
495 #endif 512 #endif
496 return true; 513 return true;
497 } 514 }
498 515
499 bool ReleaseInput2() { 516 bool ReleaseInput2() {
500 if (input_source() == INPUT_SOURCE_MOUSE) { 517 if (input_source() == INPUT_SOURCE_MOUSE) {
501 return ui_test_utils::SendMouseEventsSync( 518 return ui_test_utils::SendMouseEventsSync(
502 ui_controls::LEFT, ui_controls::UP); 519 ui_controls::LEFT, ui_controls::UP);
503 } 520 }
504 #if defined(USE_ASH) && !defined(OS_WIN) // TODO(win_ash) 521 #if defined(OS_CHROMEOS)
505 event_generator_->ReleaseTouchId(1); 522 event_generator_->ReleaseTouchId(1);
506 #else 523 #else
507 NOTREACHED(); 524 NOTREACHED();
508 #endif 525 #endif
509 return true; 526 return true;
510 } 527 }
511 528
512 bool ReleaseMouseAsync() { 529 bool ReleaseMouseAsync() {
513 return input_source() == INPUT_SOURCE_MOUSE && 530 return input_source() == INPUT_SOURCE_MOUSE &&
514 ui_controls::SendMouseEvents(ui_controls::LEFT, ui_controls::UP); 531 ui_controls::SendMouseEvents(ui_controls::LEFT, ui_controls::UP);
(...skipping 14 matching lines...) Expand all
529 } 546 }
530 } 547 }
531 548
532 void AddBlankTabAndShow(Browser* browser) { 549 void AddBlankTabAndShow(Browser* browser) {
533 InProcessBrowserTest::AddBlankTabAndShow(browser); 550 InProcessBrowserTest::AddBlankTabAndShow(browser);
534 } 551 }
535 552
536 Browser* browser() const { return InProcessBrowserTest::browser(); } 553 Browser* browser() const { return InProcessBrowserTest::browser(); }
537 554
538 private: 555 private:
539 #if defined(USE_ASH) && !defined(OS_WIN) // TODO(win_ash) 556 #if defined(OS_CHROMEOS)
540 scoped_ptr<aura::test::EventGenerator> event_generator_; 557 scoped_ptr<aura::test::EventGenerator> event_generator_;
541 #endif 558 #endif
542 559
543 DISALLOW_COPY_AND_ASSIGN(DetachToBrowserTabDragControllerTest); 560 DISALLOW_COPY_AND_ASSIGN(DetachToBrowserTabDragControllerTest);
544 }; 561 };
545 562
546 // Creates a browser with two tabs, drags the second to the first. 563 // Creates a browser with two tabs, drags the second to the first.
547 IN_PROC_BROWSER_TEST_P(DetachToBrowserTabDragControllerTest, DragInSameWindow) { 564 IN_PROC_BROWSER_TEST_P(DetachToBrowserTabDragControllerTest, DragInSameWindow) {
548 // TODO(sky): this won't work with touch as it requires a long press. 565 // TODO(sky): this won't work with touch as it requires a long press.
549 if (input_source() == INPUT_SOURCE_TOUCH) { 566 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()); 661 EXPECT_FALSE(tab_strip2->GetWidget()->HasCapture());
645 } 662 }
646 663
647 namespace { 664 namespace {
648 665
649 void DetachToOwnWindowStep2(DetachToBrowserTabDragControllerTest* test) { 666 void DetachToOwnWindowStep2(DetachToBrowserTabDragControllerTest* test) {
650 if (test->input_source() == INPUT_SOURCE_TOUCH) 667 if (test->input_source() == INPUT_SOURCE_TOUCH)
651 ASSERT_TRUE(test->ReleaseInput()); 668 ASSERT_TRUE(test->ReleaseInput());
652 } 669 }
653 670
654 #if defined(USE_ASH) && !defined(OS_WIN) // TODO(win_ash) 671 #if defined(OS_CHROMEOS)
655 bool IsWindowPositionManaged(aura::Window* window) { 672 bool IsWindowPositionManaged(aura::Window* window) {
656 return ash::wm::GetWindowState(window)->window_position_managed(); 673 return ash::wm::GetWindowState(window)->window_position_managed();
657 } 674 }
658 bool HasUserChangedWindowPositionOrSize(aura::Window* window) { 675 bool HasUserChangedWindowPositionOrSize(aura::Window* window) {
659 return ash::wm::GetWindowState(window)->bounds_changed_by_user(); 676 return ash::wm::GetWindowState(window)->bounds_changed_by_user();
660 } 677 }
661 #else 678 #else
662 bool IsWindowPositionManaged(gfx::NativeWindow window) { 679 bool IsWindowPositionManaged(gfx::NativeWindow window) {
663 return true; 680 return true;
664 } 681 }
(...skipping 246 matching lines...) Expand 10 before | Expand all | Expand 10 after
911 Browser* new_browser = browser_list->get(1); 928 Browser* new_browser = browser_list->get(1);
912 // This ends up closing the source window. 929 // This ends up closing the source window.
913 delete tab; 930 delete tab;
914 // Cancel the drag. 931 // Cancel the drag.
915 ui_controls::SendKeyPress(new_browser->window()->GetNativeWindow(), 932 ui_controls::SendKeyPress(new_browser->window()->GetNativeWindow(),
916 ui::VKEY_ESCAPE, false, false, false, false); 933 ui::VKEY_ESCAPE, false, false, false, false);
917 } 934 }
918 935
919 } // namespace 936 } // namespace
920 937
921 #if defined(OS_CHROMEOS) 938 #if defined(OS_CHROMEOS) || defined(OS_LINUX)
922 // TODO(sky,sad): Disabled as it fails due to resize locks with a real 939 // TODO(sky,sad): Disabled as it fails due to resize locks with a real
923 // compositor. crbug.com/331924 940 // compositor. crbug.com/331924
924 #define MAYBE_DeleteSourceDetached DISABLED_DeleteSourceDetached 941 #define MAYBE_DeleteSourceDetached DISABLED_DeleteSourceDetached
925 #else 942 #else
926 #define MAYBE_DeleteSourceDetached DeleteSourceDetached 943 #define MAYBE_DeleteSourceDetached DeleteSourceDetached
927 #endif 944 #endif
928 // Detaches a tab and while detached deletes a tab from the source so that the 945 // 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. 946 // source window closes then presses escape to cancel the drag.
930 IN_PROC_BROWSER_TEST_P(DetachToBrowserTabDragControllerTest, 947 IN_PROC_BROWSER_TEST_P(DetachToBrowserTabDragControllerTest,
931 MAYBE_DeleteSourceDetached) { 948 MAYBE_DeleteSourceDetached) {
(...skipping 29 matching lines...) Expand all
961 void PressEscapeWhileDetachedStep2(const BrowserList* browser_list) { 978 void PressEscapeWhileDetachedStep2(const BrowserList* browser_list) {
962 ASSERT_EQ(2u, browser_list->size()); 979 ASSERT_EQ(2u, browser_list->size());
963 Browser* new_browser = browser_list->get(1); 980 Browser* new_browser = browser_list->get(1);
964 ui_controls::SendKeyPress( 981 ui_controls::SendKeyPress(
965 new_browser->window()->GetNativeWindow(), ui::VKEY_ESCAPE, false, false, 982 new_browser->window()->GetNativeWindow(), ui::VKEY_ESCAPE, false, false,
966 false, false); 983 false, false);
967 } 984 }
968 985
969 } // namespace 986 } // namespace
970 987
971 #if defined(OS_CHROMEOS) 988 #if defined(OS_CHROMEOS) || defined(OS_LINUX)
972 // TODO(sky,sad): Disabled as it fails due to resize locks with a real 989 // TODO(sky,sad): Disabled as it fails due to resize locks with a real
973 // compositor. crbug.com/331924 990 // compositor. crbug.com/331924
974 #define MAYBE_PressEscapeWhileDetached DISABLED_PressEscapeWhileDetached 991 #define MAYBE_PressEscapeWhileDetached DISABLED_PressEscapeWhileDetached
975 #else 992 #else
976 #define MAYBE_PressEscapeWhileDetached PressEscapeWhileDetached 993 #define MAYBE_PressEscapeWhileDetached PressEscapeWhileDetached
977 #endif 994 #endif
978 // This is disabled until NativeViewHost::Detach really detaches. 995 // This is disabled until NativeViewHost::Detach really detaches.
979 // Detaches a tab and while detached presses escape to revert the drag. 996 // Detaches a tab and while detached presses escape to revert the drag.
980 IN_PROC_BROWSER_TEST_P(DetachToBrowserTabDragControllerTest, 997 IN_PROC_BROWSER_TEST_P(DetachToBrowserTabDragControllerTest,
981 MAYBE_PressEscapeWhileDetached) { 998 MAYBE_PressEscapeWhileDetached) {
(...skipping 352 matching lines...) Expand 10 before | Expand all | Expand 10 after
1334 const BrowserList* browser_list) { 1351 const BrowserList* browser_list) {
1335 ASSERT_TRUE(TabDragController::IsActive()); 1352 ASSERT_TRUE(TabDragController::IsActive());
1336 ASSERT_EQ(2u, browser_list->size()); 1353 ASSERT_EQ(2u, browser_list->size());
1337 1354
1338 // Add another tab. This should trigger exiting the nested loop. 1355 // Add another tab. This should trigger exiting the nested loop.
1339 test->AddBlankTabAndShow(browser_list->GetLastActive()); 1356 test->AddBlankTabAndShow(browser_list->GetLastActive());
1340 } 1357 }
1341 1358
1342 } // namespace 1359 } // namespace
1343 1360
1344 #if defined(OS_CHROMEOS) 1361 #if defined(OS_CHROMEOS) || defined(OS_LINUX)
1345 // TODO(sky,sad): Disabled as it fails due to resize locks with a real 1362 // TODO(sky,sad): Disabled as it fails due to resize locks with a real
1346 // compositor. crbug.com/331924 1363 // compositor. crbug.com/331924
1347 #define MAYBE_CancelOnNewTabWhenDragging DISABLED_CancelOnNewTabWhenDragging 1364 #define MAYBE_CancelOnNewTabWhenDragging DISABLED_CancelOnNewTabWhenDragging
1348 #else 1365 #else
1349 #define MAYBE_CancelOnNewTabWhenDragging CancelOnNewTabWhenDragging 1366 #define MAYBE_CancelOnNewTabWhenDragging CancelOnNewTabWhenDragging
1350 #endif 1367 #endif
1351 // Adds another tab, detaches into separate window, adds another tab and 1368 // Adds another tab, detaches into separate window, adds another tab and
1352 // verifies the run loop ends. 1369 // verifies the run loop ends.
1353 IN_PROC_BROWSER_TEST_P(DetachToBrowserTabDragControllerTest, 1370 IN_PROC_BROWSER_TEST_P(DetachToBrowserTabDragControllerTest,
1354 MAYBE_CancelOnNewTabWhenDragging) { 1371 MAYBE_CancelOnNewTabWhenDragging) {
(...skipping 14 matching lines...) Expand all
1369 // Should be two windows and not dragging. 1386 // Should be two windows and not dragging.
1370 ASSERT_FALSE(TabDragController::IsActive()); 1387 ASSERT_FALSE(TabDragController::IsActive());
1371 ASSERT_EQ(2u, native_browser_list->size()); 1388 ASSERT_EQ(2u, native_browser_list->size());
1372 for (chrome::BrowserIterator it; !it.done(); it.Next()) { 1389 for (chrome::BrowserIterator it; !it.done(); it.Next()) {
1373 EXPECT_FALSE(GetIsDragged(*it)); 1390 EXPECT_FALSE(GetIsDragged(*it));
1374 // Should not be maximized 1391 // Should not be maximized
1375 EXPECT_FALSE(it->window()->IsMaximized()); 1392 EXPECT_FALSE(it->window()->IsMaximized());
1376 } 1393 }
1377 } 1394 }
1378 1395
1379 #if defined(USE_ASH) && !defined(OS_WIN) // TODO(win_ash) 1396 #if defined(OS_CHROMEOS)
1380 1397 // TODO(sky,sad): A number of tests below are disabled as they fail due to
1398 // resize locks with a real compositor. crbug.com/331924
1381 namespace { 1399 namespace {
1382 1400
1383 void DragInMaximizedWindowStep2(DetachToBrowserTabDragControllerTest* test, 1401 void DragInMaximizedWindowStep2(DetachToBrowserTabDragControllerTest* test,
1384 Browser* browser, 1402 Browser* browser,
1385 TabStrip* tab_strip, 1403 TabStrip* tab_strip,
1386 const BrowserList* browser_list) { 1404 const BrowserList* browser_list) {
1387 // There should be another browser. 1405 // There should be another browser.
1388 ASSERT_EQ(2u, browser_list->size()); 1406 ASSERT_EQ(2u, browser_list->size());
1389 Browser* new_browser = browser_list->get(1); 1407 Browser* new_browser = browser_list->get(1);
1390 EXPECT_NE(browser, new_browser); 1408 EXPECT_NE(browser, new_browser);
1391 ASSERT_TRUE(new_browser->window()->IsActive()); 1409 ASSERT_TRUE(new_browser->window()->IsActive());
1392 TabStrip* tab_strip2 = GetTabStripForBrowser(new_browser); 1410 TabStrip* tab_strip2 = GetTabStripForBrowser(new_browser);
1393 1411
1394 ASSERT_TRUE(tab_strip2->IsDragSessionActive()); 1412 ASSERT_TRUE(tab_strip2->IsDragSessionActive());
1395 ASSERT_FALSE(tab_strip->IsDragSessionActive()); 1413 ASSERT_FALSE(tab_strip->IsDragSessionActive());
1396 1414
1397 // Both windows should be visible. 1415 // Both windows should be visible.
1398 EXPECT_TRUE(tab_strip->GetWidget()->IsVisible()); 1416 EXPECT_TRUE(tab_strip->GetWidget()->IsVisible());
1399 EXPECT_TRUE(tab_strip2->GetWidget()->IsVisible()); 1417 EXPECT_TRUE(tab_strip2->GetWidget()->IsVisible());
1400 1418
1401 // Stops dragging. 1419 // Stops dragging.
1402 ASSERT_TRUE(test->ReleaseInput()); 1420 ASSERT_TRUE(test->ReleaseInput());
1403 } 1421 }
1404 1422
1405 } // namespace 1423 } // namespace
1406 1424
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. 1425 // Creates a browser with two tabs, maximizes it, drags the tab out.
1415 IN_PROC_BROWSER_TEST_P(DetachToBrowserTabDragControllerTest, 1426 IN_PROC_BROWSER_TEST_P(DetachToBrowserTabDragControllerTest,
1416 MAYBE_DragInMaximizedWindow) { 1427 DISABLED_DragInMaximizedWindow) {
1417 AddTabAndResetBrowser(browser()); 1428 AddTabAndResetBrowser(browser());
1418 browser()->window()->Maximize(); 1429 browser()->window()->Maximize();
1419 1430
1420 TabStrip* tab_strip = GetTabStripForBrowser(browser()); 1431 TabStrip* tab_strip = GetTabStripForBrowser(browser());
1421 1432
1422 // Move to the first tab and drag it enough so that it detaches. 1433 // Move to the first tab and drag it enough so that it detaches.
1423 gfx::Point tab_0_center( 1434 gfx::Point tab_0_center(
1424 GetCenterInScreenCoordinates(tab_strip->tab_at(0))); 1435 GetCenterInScreenCoordinates(tab_strip->tab_at(0)));
1425 ASSERT_TRUE(PressInput(tab_0_center)); 1436 ASSERT_TRUE(PressInput(tab_0_center));
1426 ASSERT_TRUE(DragInputToNotifyWhenDone( 1437 ASSERT_TRUE(DragInputToNotifyWhenDone(
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after
1490 void DragSingleTabToSeparateWindowInSecondDisplayStep2( 1501 void DragSingleTabToSeparateWindowInSecondDisplayStep2(
1491 DetachToBrowserTabDragControllerTest* test, 1502 DetachToBrowserTabDragControllerTest* test,
1492 const gfx::Point& target_point) { 1503 const gfx::Point& target_point) {
1493 ASSERT_TRUE(test->DragInputToNotifyWhenDone( 1504 ASSERT_TRUE(test->DragInputToNotifyWhenDone(
1494 target_point.x(), target_point.y(), 1505 target_point.x(), target_point.y(),
1495 base::Bind(&DragSingleTabToSeparateWindowInSecondDisplayStep3, test))); 1506 base::Bind(&DragSingleTabToSeparateWindowInSecondDisplayStep3, test)));
1496 } 1507 }
1497 1508
1498 } // namespace 1509 } // namespace
1499 1510
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. 1511 // Drags from browser to a second display and releases input.
1510 IN_PROC_BROWSER_TEST_P(DetachToBrowserInSeparateDisplayTabDragControllerTest, 1512 IN_PROC_BROWSER_TEST_P(DetachToBrowserInSeparateDisplayTabDragControllerTest,
1511 MAYBE_DragSingleTabToSeparateWindowInSecondDisplay) { 1513 DISABLED_DragSingleTabToSeparateWindowInSecondDisplay) {
1512 // Add another tab. 1514 // Add another tab.
1513 AddTabAndResetBrowser(browser()); 1515 AddTabAndResetBrowser(browser());
1514 TabStrip* tab_strip = GetTabStripForBrowser(browser()); 1516 TabStrip* tab_strip = GetTabStripForBrowser(browser());
1515 1517
1516 // Move to the first tab and drag it enough so that it detaches. 1518 // 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. 1519 // Then drag it to the final destination on the second screen.
1518 gfx::Point tab_0_center(GetCenterInScreenCoordinates(tab_strip->tab_at(0))); 1520 gfx::Point tab_0_center(GetCenterInScreenCoordinates(tab_strip->tab_at(0)));
1519 ASSERT_TRUE(PressInput(tab_0_center)); 1521 ASSERT_TRUE(PressInput(tab_0_center));
1520 ASSERT_TRUE(DragInputToNotifyWhenDone( 1522 ASSERT_TRUE(DragInputToNotifyWhenDone(
1521 tab_0_center.x(), tab_0_center.y() + GetDetachY(tab_strip), 1523 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))); 1574 GetCenterInScreenCoordinates(target_tab_strip->tab_at(0)));
1573 1575
1574 // Move it close to the beginning of the target tabstrip. 1576 // Move it close to the beginning of the target tabstrip.
1575 target_point.set_x( 1577 target_point.set_x(
1576 target_point.x() - target_tab_strip->tab_at(0)->width() / 2 + 10); 1578 target_point.x() - target_tab_strip->tab_at(0)->width() / 2 + 10);
1577 ASSERT_TRUE(test->DragInputToAsync(target_point)); 1579 ASSERT_TRUE(test->DragInputToAsync(target_point));
1578 } 1580 }
1579 1581
1580 } // namespace 1582 } // namespace
1581 1583
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. 1584 // Drags from browser to another browser on a second display and releases input.
1591 IN_PROC_BROWSER_TEST_P(DetachToBrowserInSeparateDisplayTabDragControllerTest, 1585 IN_PROC_BROWSER_TEST_P(DetachToBrowserInSeparateDisplayTabDragControllerTest,
1592 MAYBE_DragTabToWindowInSeparateDisplay) { 1586 DISABLED_DragTabToWindowInSeparateDisplay) {
1593 // Add another tab. 1587 // Add another tab.
1594 AddTabAndResetBrowser(browser()); 1588 AddTabAndResetBrowser(browser());
1595 TabStrip* tab_strip = GetTabStripForBrowser(browser()); 1589 TabStrip* tab_strip = GetTabStripForBrowser(browser());
1596 1590
1597 // Create another browser. 1591 // Create another browser.
1598 Browser* browser2 = CreateBrowser(browser()->profile()); 1592 Browser* browser2 = CreateBrowser(browser()->profile());
1599 TabStrip* tab_strip2 = GetTabStripForBrowser(browser2); 1593 TabStrip* tab_strip2 = GetTabStripForBrowser(browser2);
1600 ResetIDs(browser2->tab_strip_model(), 100); 1594 ResetIDs(browser2->tab_strip_model(), 100);
1601 1595
1602 // Move the second browser to the second display. 1596 // Move the second browser to the second display.
(...skipping 27 matching lines...) Expand all
1630 ASSERT_FALSE(tab_strip->IsDragSessionActive()); 1624 ASSERT_FALSE(tab_strip->IsDragSessionActive());
1631 ASSERT_FALSE(TabDragController::IsActive()); 1625 ASSERT_FALSE(TabDragController::IsActive());
1632 EXPECT_EQ("0 100", IDString(browser2->tab_strip_model())); 1626 EXPECT_EQ("0 100", IDString(browser2->tab_strip_model()));
1633 EXPECT_EQ("1", IDString(browser()->tab_strip_model())); 1627 EXPECT_EQ("1", IDString(browser()->tab_strip_model()));
1634 1628
1635 // Both windows should not be maximized 1629 // Both windows should not be maximized
1636 EXPECT_FALSE(browser()->window()->IsMaximized()); 1630 EXPECT_FALSE(browser()->window()->IsMaximized());
1637 EXPECT_FALSE(browser2->window()->IsMaximized()); 1631 EXPECT_FALSE(browser2->window()->IsMaximized());
1638 } 1632 }
1639 1633
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. 1634 // Drags from browser to another browser on a second display and releases input.
1649 IN_PROC_BROWSER_TEST_P(DetachToBrowserInSeparateDisplayTabDragControllerTest, 1635 IN_PROC_BROWSER_TEST_P(DetachToBrowserInSeparateDisplayTabDragControllerTest,
1650 MAYBE_DragTabToWindowOnSecondDisplay) { 1636 DISABLED_DragTabToWindowOnSecondDisplay) {
1651 // Add another tab. 1637 // Add another tab.
1652 AddTabAndResetBrowser(browser()); 1638 AddTabAndResetBrowser(browser());
1653 TabStrip* tab_strip = GetTabStripForBrowser(browser()); 1639 TabStrip* tab_strip = GetTabStripForBrowser(browser());
1654 1640
1655 // Create another browser. 1641 // Create another browser.
1656 Browser* browser2 = CreateBrowser(browser()->profile()); 1642 Browser* browser2 = CreateBrowser(browser()->profile());
1657 TabStrip* tab_strip2 = GetTabStripForBrowser(browser2); 1643 TabStrip* tab_strip2 = GetTabStripForBrowser(browser2);
1658 ResetIDs(browser2->tab_strip_model(), 100); 1644 ResetIDs(browser2->tab_strip_model(), 100);
1659 1645
1660 // Move both browsers to the second display. 1646 // 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()); 1686 ASSERT_FALSE(tab_strip->IsDragSessionActive());
1701 ASSERT_FALSE(TabDragController::IsActive()); 1687 ASSERT_FALSE(TabDragController::IsActive());
1702 EXPECT_EQ("0 100", IDString(browser2->tab_strip_model())); 1688 EXPECT_EQ("0 100", IDString(browser2->tab_strip_model()));
1703 EXPECT_EQ("1", IDString(browser()->tab_strip_model())); 1689 EXPECT_EQ("1", IDString(browser()->tab_strip_model()));
1704 1690
1705 // Both windows should not be maximized 1691 // Both windows should not be maximized
1706 EXPECT_FALSE(browser()->window()->IsMaximized()); 1692 EXPECT_FALSE(browser()->window()->IsMaximized());
1707 EXPECT_FALSE(browser2->window()->IsMaximized()); 1693 EXPECT_FALSE(browser2->window()->IsMaximized());
1708 } 1694 }
1709 1695
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 1696 // Drags from a maximized browser to another non-maximized browser on a second
1720 // display and releases input. 1697 // display and releases input.
1721 IN_PROC_BROWSER_TEST_P(DetachToBrowserInSeparateDisplayTabDragControllerTest, 1698 IN_PROC_BROWSER_TEST_P(DetachToBrowserInSeparateDisplayTabDragControllerTest,
1722 MAYBE_DragMaxTabToNonMaxWindowInSeparateDisplay) { 1699 DISABLED_DragMaxTabToNonMaxWindowInSeparateDisplay) {
1723 // Add another tab. 1700 // Add another tab.
1724 AddTabAndResetBrowser(browser()); 1701 AddTabAndResetBrowser(browser());
1725 browser()->window()->Maximize(); 1702 browser()->window()->Maximize();
1726 TabStrip* tab_strip = GetTabStripForBrowser(browser()); 1703 TabStrip* tab_strip = GetTabStripForBrowser(browser());
1727 1704
1728 // Create another browser on the second display. 1705 // Create another browser on the second display.
1729 aura::Window::Windows roots = ash::Shell::GetAllRootWindows(); 1706 aura::Window::Windows roots = ash::Shell::GetAllRootWindows();
1730 ASSERT_EQ(2u, roots.size()); 1707 ASSERT_EQ(2u, roots.size());
1731 aura::Window* first_root = roots[0]; 1708 aura::Window* first_root = roots[0];
1732 aura::Window* second_root = roots[1]; 1709 aura::Window* second_root = roots[1];
1733 gfx::Rect work_area = gfx::Screen::GetNativeScreen()->GetDisplayNearestWindow( 1710 gfx::Rect work_area = gfx::Screen::GetNativeScreen()->GetDisplayNearestWindow(
1734 second_root).work_area(); 1711 second_root).work_area();
1735 work_area.Inset(20,20,20,60); 1712 work_area.Inset(20, 20, 20, 60);
jonross 2014/05/27 17:44:27 cpplint
1736 Browser::CreateParams params(browser()->profile(), 1713 Browser::CreateParams params(browser()->profile(),
1737 browser()->host_desktop_type()); 1714 browser()->host_desktop_type());
1738 params.initial_show_state = ui::SHOW_STATE_NORMAL; 1715 params.initial_show_state = ui::SHOW_STATE_NORMAL;
1739 params.initial_bounds = work_area; 1716 params.initial_bounds = work_area;
1740 Browser* browser2 = new Browser(params); 1717 Browser* browser2 = new Browser(params);
1741 AddBlankTabAndShow(browser2); 1718 AddBlankTabAndShow(browser2);
1742 1719
1743 TabStrip* tab_strip2 = GetTabStripForBrowser(browser2); 1720 TabStrip* tab_strip2 = GetTabStripForBrowser(browser2);
1744 ResetIDs(browser2->tab_strip_model(), 100); 1721 ResetIDs(browser2->tab_strip_model(), 100);
1745 1722
(...skipping 30 matching lines...) Expand all
1776 ASSERT_FALSE(tab_strip->IsDragSessionActive()); 1753 ASSERT_FALSE(tab_strip->IsDragSessionActive());
1777 ASSERT_FALSE(TabDragController::IsActive()); 1754 ASSERT_FALSE(TabDragController::IsActive());
1778 EXPECT_EQ("0 100", IDString(browser2->tab_strip_model())); 1755 EXPECT_EQ("0 100", IDString(browser2->tab_strip_model()));
1779 EXPECT_EQ("1", IDString(browser()->tab_strip_model())); 1756 EXPECT_EQ("1", IDString(browser()->tab_strip_model()));
1780 1757
1781 // Source browser should still be maximized, target should not 1758 // Source browser should still be maximized, target should not
1782 EXPECT_TRUE(browser()->window()->IsMaximized()); 1759 EXPECT_TRUE(browser()->window()->IsMaximized());
1783 EXPECT_FALSE(browser2->window()->IsMaximized()); 1760 EXPECT_FALSE(browser2->window()->IsMaximized());
1784 } 1761 }
1785 1762
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 1763 // Drags from a restored browser to an immersive fullscreen browser on a
1794 // second display and releases input. 1764 // second display and releases input.
1795 IN_PROC_BROWSER_TEST_P(DetachToBrowserInSeparateDisplayTabDragControllerTest, 1765 IN_PROC_BROWSER_TEST_P(DetachToBrowserInSeparateDisplayTabDragControllerTest,
1796 MAYBE_DragTabToImmersiveBrowserOnSeparateDisplay) { 1766 DISABLED_DragTabToImmersiveBrowserOnSeparateDisplay) {
1797 // Add another tab. 1767 // Add another tab.
1798 AddTabAndResetBrowser(browser()); 1768 AddTabAndResetBrowser(browser());
1799 TabStrip* tab_strip = GetTabStripForBrowser(browser()); 1769 TabStrip* tab_strip = GetTabStripForBrowser(browser());
1800 1770
1801 // Create another browser. 1771 // Create another browser.
1802 Browser* browser2 = CreateBrowser(browser()->profile()); 1772 Browser* browser2 = CreateBrowser(browser()->profile());
1803 TabStrip* tab_strip2 = GetTabStripForBrowser(browser2); 1773 TabStrip* tab_strip2 = GetTabStripForBrowser(browser2);
1804 ResetIDs(browser2->tab_strip_model(), 100); 1774 ResetIDs(browser2->tab_strip_model(), 100);
1805 1775
1806 // Move the second browser to the second display. 1776 // 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. 1829 // The first browser window should not be in immersive fullscreen.
1860 // browser2 should still be in immersive fullscreen, but the top chrome should 1830 // browser2 should still be in immersive fullscreen, but the top chrome should
1861 // no longer be revealed. 1831 // no longer be revealed.
1862 BrowserView* browser_view = BrowserView::GetBrowserViewForBrowser(browser()); 1832 BrowserView* browser_view = BrowserView::GetBrowserViewForBrowser(browser());
1863 EXPECT_FALSE(browser_view->immersive_mode_controller()->IsEnabled()); 1833 EXPECT_FALSE(browser_view->immersive_mode_controller()->IsEnabled());
1864 1834
1865 EXPECT_TRUE(immersive_controller2->IsEnabled()); 1835 EXPECT_TRUE(immersive_controller2->IsEnabled());
1866 EXPECT_FALSE(immersive_controller2->IsRevealed()); 1836 EXPECT_FALSE(immersive_controller2->IsRevealed());
1867 EXPECT_TRUE(tab_strip2->IsImmersiveStyle()); 1837 EXPECT_TRUE(tab_strip2->IsImmersiveStyle());
1868 } 1838 }
1869 #endif // OS_CHROMEOS
1870 1839
1871 // Subclass of DetachToBrowserTabDragControllerTest that 1840 // Subclass of DetachToBrowserTabDragControllerTest that
1872 // creates multiple displays with different device scale factors. 1841 // creates multiple displays with different device scale factors.
1873 class DifferentDeviceScaleFactorDisplayTabDragControllerTest 1842 class DifferentDeviceScaleFactorDisplayTabDragControllerTest
1874 : public DetachToBrowserTabDragControllerTest { 1843 : public DetachToBrowserTabDragControllerTest {
1875 public: 1844 public:
1876 DifferentDeviceScaleFactorDisplayTabDragControllerTest() {} 1845 DifferentDeviceScaleFactorDisplayTabDragControllerTest() {}
1877 virtual ~DifferentDeviceScaleFactorDisplayTabDragControllerTest() {} 1846 virtual ~DifferentDeviceScaleFactorDisplayTabDragControllerTest() {}
1878 1847
1879 virtual void SetUpCommandLine(CommandLine* command_line) OVERRIDE { 1848 virtual void SetUpCommandLine(CommandLine* command_line) OVERRIDE {
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after
1939 } else { 1908 } else {
1940 // Finishes a serise of CursorDeviceScaleFactorStep calls and ends drag. 1909 // Finishes a serise of CursorDeviceScaleFactorStep calls and ends drag.
1941 EXPECT_EQ(1.0f, test->GetCursorDeviceScaleFactor()); 1910 EXPECT_EQ(1.0f, test->GetCursorDeviceScaleFactor());
1942 ASSERT_TRUE(ui_test_utils::SendMouseEventsSync( 1911 ASSERT_TRUE(ui_test_utils::SendMouseEventsSync(
1943 ui_controls::LEFT, ui_controls::UP)); 1912 ui_controls::LEFT, ui_controls::UP));
1944 } 1913 }
1945 } 1914 }
1946 1915
1947 } // namespace 1916 } // namespace
1948 1917
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 1918 // 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). 1919 // displays with different device scale factors (http://crbug.com/154183).
1958 IN_PROC_BROWSER_TEST_P(DifferentDeviceScaleFactorDisplayTabDragControllerTest, 1920 IN_PROC_BROWSER_TEST_P(DifferentDeviceScaleFactorDisplayTabDragControllerTest,
1959 MAYBE_CursorDeviceScaleFactor) { 1921 DISABLED_CursorDeviceScaleFactor) {
1960 // Add another tab. 1922 // Add another tab.
1961 AddTabAndResetBrowser(browser()); 1923 AddTabAndResetBrowser(browser());
1962 TabStrip* tab_strip = GetTabStripForBrowser(browser()); 1924 TabStrip* tab_strip = GetTabStripForBrowser(browser());
1963 1925
1964 // Move the second browser to the second display. 1926 // Move the second browser to the second display.
1965 aura::Window::Windows roots = ash::Shell::GetAllRootWindows(); 1927 aura::Window::Windows roots = ash::Shell::GetAllRootWindows();
1966 ASSERT_EQ(2u, roots.size()); 1928 ASSERT_EQ(2u, roots.size());
1967 1929
1968 // Move to the first tab and drag it enough so that it detaches. 1930 // 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))); 1931 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()); 2002 new_browser->window()->GetNativeWindow()->GetRootWindow());
2041 2003
2042 ASSERT_TRUE(test->DragTabAndExecuteTaskWhenDone( 2004 ASSERT_TRUE(test->DragTabAndExecuteTaskWhenDone(
2043 final_destination, 2005 final_destination,
2044 base::Bind(&CancelDragTabToWindowInSeparateDisplayStep3, 2006 base::Bind(&CancelDragTabToWindowInSeparateDisplayStep3,
2045 tab_strip, browser_list))); 2007 tab_strip, browser_list)));
2046 } 2008 }
2047 2009
2048 } // namespace 2010 } // namespace
2049 2011
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. 2012 // Drags from browser to a second display and releases input.
2060 IN_PROC_BROWSER_TEST_F( 2013 IN_PROC_BROWSER_TEST_F(
2061 DetachToBrowserInSeparateDisplayAndCancelTabDragControllerTest, 2014 DetachToBrowserInSeparateDisplayAndCancelTabDragControllerTest,
2062 MAYBE_CancelDragTabToWindowIn2ndDisplay) { 2015 DISABLED_CancelDragTabToWindowIn2ndDisplay) {
2063 // Add another tab. 2016 // Add another tab.
2064 AddTabAndResetBrowser(browser()); 2017 AddTabAndResetBrowser(browser());
2065 TabStrip* tab_strip = GetTabStripForBrowser(browser()); 2018 TabStrip* tab_strip = GetTabStripForBrowser(browser());
2066 2019
2067 EXPECT_EQ("0 1", IDString(browser()->tab_strip_model())); 2020 EXPECT_EQ("0 1", IDString(browser()->tab_strip_model()));
2068 2021
2069 // Move the second browser to the second display. 2022 // Move the second browser to the second display.
2070 aura::Window::Windows roots = ash::Shell::GetAllRootWindows(); 2023 aura::Window::Windows roots = ash::Shell::GetAllRootWindows();
2071 ASSERT_EQ(2u, roots.size()); 2024 ASSERT_EQ(2u, roots.size());
2072 gfx::Point final_destination = 2025 gfx::Point final_destination =
(...skipping 14 matching lines...) Expand all
2087 ASSERT_EQ(1u, native_browser_list->size()); 2040 ASSERT_EQ(1u, native_browser_list->size());
2088 ASSERT_FALSE(tab_strip->IsDragSessionActive()); 2041 ASSERT_FALSE(tab_strip->IsDragSessionActive());
2089 ASSERT_FALSE(TabDragController::IsActive()); 2042 ASSERT_FALSE(TabDragController::IsActive());
2090 EXPECT_EQ("0 1", IDString(browser()->tab_strip_model())); 2043 EXPECT_EQ("0 1", IDString(browser()->tab_strip_model()));
2091 2044
2092 // Release the mouse 2045 // Release the mouse
2093 ASSERT_TRUE(ui_test_utils::SendMouseEventsSync( 2046 ASSERT_TRUE(ui_test_utils::SendMouseEventsSync(
2094 ui_controls::LEFT, ui_controls::UP)); 2047 ui_controls::LEFT, ui_controls::UP));
2095 } 2048 }
2096 2049
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. 2050 // Drags from browser from a second display to primary and releases input.
2107 IN_PROC_BROWSER_TEST_F( 2051 IN_PROC_BROWSER_TEST_F(
2108 DetachToBrowserInSeparateDisplayAndCancelTabDragControllerTest, 2052 DetachToBrowserInSeparateDisplayAndCancelTabDragControllerTest,
2109 MAYBE_CancelDragTabToWindowIn1stDisplay) { 2053 DISABLED_CancelDragTabToWindowIn1stDisplay) {
2110 aura::Window::Windows roots = ash::Shell::GetAllRootWindows(); 2054 aura::Window::Windows roots = ash::Shell::GetAllRootWindows();
2111 ASSERT_EQ(2u, roots.size()); 2055 ASSERT_EQ(2u, roots.size());
2112 2056
2113 // Add another tab. 2057 // Add another tab.
2114 AddTabAndResetBrowser(browser()); 2058 AddTabAndResetBrowser(browser());
2115 TabStrip* tab_strip = GetTabStripForBrowser(browser()); 2059 TabStrip* tab_strip = GetTabStripForBrowser(browser());
2116 2060
2117 EXPECT_EQ("0 1", IDString(browser()->tab_strip_model())); 2061 EXPECT_EQ("0 1", IDString(browser()->tab_strip_model()));
2118 EXPECT_EQ(roots[0], browser()->window()->GetNativeWindow()->GetRootWindow()); 2062 EXPECT_EQ(roots[0], browser()->window()->GetNativeWindow()->GetRootWindow());
2119 2063
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
2155 ASSERT_TRUE(TabDragController::IsActive()); 2099 ASSERT_TRUE(TabDragController::IsActive());
2156 ASSERT_EQ(2u, test->native_browser_list->size()); 2100 ASSERT_EQ(2u, test->native_browser_list->size());
2157 Browser* new_browser = test->native_browser_list->get(1); 2101 Browser* new_browser = test->native_browser_list->get(1);
2158 ASSERT_TRUE(new_browser->window()->IsActive()); 2102 ASSERT_TRUE(new_browser->window()->IsActive());
2159 2103
2160 ASSERT_TRUE(test->PressInput2()); 2104 ASSERT_TRUE(test->PressInput2());
2161 } 2105 }
2162 2106
2163 } // namespace 2107 } // namespace
2164 2108
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. 2109 // Detaches a tab and while detached presses a second finger.
2173 IN_PROC_BROWSER_TEST_P(DetachToBrowserTabDragControllerTestTouch, 2110 IN_PROC_BROWSER_TEST_P(DetachToBrowserTabDragControllerTestTouch,
2174 MAYBE_PressSecondFingerWhileDetached) { 2111 DISABLED_PressSecondFingerWhileDetached) {
2175 gfx::Rect bounds(browser()->window()->GetBounds()); 2112 gfx::Rect bounds(browser()->window()->GetBounds());
2176 // Add another tab. 2113 // Add another tab.
2177 AddTabAndResetBrowser(browser()); 2114 AddTabAndResetBrowser(browser());
2178 TabStrip* tab_strip = GetTabStripForBrowser(browser()); 2115 TabStrip* tab_strip = GetTabStripForBrowser(browser());
2179 EXPECT_EQ("0 1", IDString(browser()->tab_strip_model())); 2116 EXPECT_EQ("0 1", IDString(browser()->tab_strip_model()));
2180 2117
2181 // Move to the first tab and drag it enough so that it detaches. 2118 // Move to the first tab and drag it enough so that it detaches.
2182 gfx::Point tab_0_center( 2119 gfx::Point tab_0_center(
2183 GetCenterInScreenCoordinates(tab_strip->tab_at(0))); 2120 GetCenterInScreenCoordinates(tab_strip->tab_at(0)));
2184 ASSERT_TRUE(PressInput(tab_0_center)); 2121 ASSERT_TRUE(PressInput(tab_0_center));
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
2227 ASSERT_TRUE(test->DragInputToNotifyWhenDone( 2164 ASSERT_TRUE(test->DragInputToNotifyWhenDone(
2228 target_point.x(), target_point.y(), 2165 target_point.x(), target_point.y(),
2229 base::Bind(&DetachToDockedWindowNextStep, 2166 base::Bind(&DetachToDockedWindowNextStep,
2230 test, 2167 test,
2231 gfx::Point(target_point.x(), 1 + target_point.y()), 2168 gfx::Point(target_point.x(), 1 + target_point.y()),
2232 iteration - 1))); 2169 iteration - 1)));
2233 } 2170 }
2234 2171
2235 } // namespace 2172 } // namespace
2236 2173
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. 2174 // Drags from browser to separate window, docks that window and releases mouse.
2247 IN_PROC_BROWSER_TEST_P(DetachToDockedTabDragControllerTest, 2175 IN_PROC_BROWSER_TEST_P(DetachToDockedTabDragControllerTest,
2248 MAYBE_DetachToDockedWindowFromMaximizedWindow) { 2176 DISABLED_DetachToDockedWindowFromMaximizedWindow) {
2249 // TODO(sky,sad): Disabled as it fails due to resize locks with a real 2177 // TODO(sky,sad): Disabled as it fails due to resize locks with a real
2250 // compositor. crbug.com/331924 2178 // compositor. crbug.com/331924
2251 if (docked_windows_enabled()) { 2179 if (docked_windows_enabled()) {
2252 VLOG(1) << "Test is DISABLED for docked windows."; 2180 VLOG(1) << "Test is DISABLED for docked windows.";
2253 return; 2181 return;
2254 } 2182 }
2255 2183
2256 // Maximize the initial browser window. 2184 // Maximize the initial browser window.
2257 browser()->window()->Maximize(); 2185 browser()->window()->Maximize();
2258 ASSERT_TRUE(browser()->window()->IsMaximized()); 2186 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. 2236 // The new window should be docked and not snapped if docking is allowed.
2309 EXPECT_TRUE(window_state->IsDocked()); 2237 EXPECT_TRUE(window_state->IsDocked());
2310 EXPECT_FALSE(window_state->IsSnapped()); 2238 EXPECT_FALSE(window_state->IsSnapped());
2311 } else { 2239 } else {
2312 // The new window should be snapped and not docked if docking is disabled. 2240 // The new window should be snapped and not docked if docking is disabled.
2313 EXPECT_FALSE(window_state->IsDocked()); 2241 EXPECT_FALSE(window_state->IsDocked());
2314 EXPECT_TRUE(window_state->IsSnapped()); 2242 EXPECT_TRUE(window_state->IsSnapped());
2315 } 2243 }
2316 } 2244 }
2317 2245
2318 2246 #endif // OS_CHROMEOS
2319 #endif
2320 2247
2321 #if defined(USE_ASH) && defined(OS_CHROMEOS) // TODO(win_ash,linux_ash) 2248 #if defined(USE_ASH) && defined(OS_CHROMEOS) // TODO(win_ash,linux_ash)
2322 INSTANTIATE_TEST_CASE_P(TabDragging, 2249 INSTANTIATE_TEST_CASE_P(TabDragging,
2323 DetachToBrowserInSeparateDisplayTabDragControllerTest, 2250 DetachToBrowserInSeparateDisplayTabDragControllerTest,
2324 ::testing::Values("mouse", "touch")); 2251 ::testing::Values("mouse", "touch"));
2325 INSTANTIATE_TEST_CASE_P(TabDragging, 2252 INSTANTIATE_TEST_CASE_P(TabDragging,
2326 DifferentDeviceScaleFactorDisplayTabDragControllerTest, 2253 DifferentDeviceScaleFactorDisplayTabDragControllerTest,
2327 ::testing::Values("mouse")); 2254 ::testing::Values("mouse"));
2328 INSTANTIATE_TEST_CASE_P(TabDragging, 2255 INSTANTIATE_TEST_CASE_P(TabDragging,
2329 DetachToBrowserTabDragControllerTest, 2256 DetachToBrowserTabDragControllerTest,
2330 ::testing::Values("mouse", "touch")); 2257 ::testing::Values("mouse", "touch"));
2331 INSTANTIATE_TEST_CASE_P(TabDragging, 2258 INSTANTIATE_TEST_CASE_P(TabDragging,
2332 DetachToDockedTabDragControllerTest, 2259 DetachToDockedTabDragControllerTest,
2333 ::testing::Values("mouse", "mouse docked")); 2260 ::testing::Values("mouse", "mouse docked"));
2334 INSTANTIATE_TEST_CASE_P(TabDragging, 2261 INSTANTIATE_TEST_CASE_P(TabDragging,
2335 DetachToBrowserTabDragControllerTestTouch, 2262 DetachToBrowserTabDragControllerTestTouch,
2336 ::testing::Values("touch", "touch docked")); 2263 ::testing::Values("touch", "touch docked"));
2337 #elif defined(USE_ASH) && !defined(OS_LINUX) // TODO(linux_ash) 2264 #elif defined(USE_ASH) // TODO(linux_ash)
pkotwicz 2014/05/28 00:32:03 Remove TODO
jonross 2014/05/28 14:55:57 Done.
2338 INSTANTIATE_TEST_CASE_P(TabDragging, 2265 INSTANTIATE_TEST_CASE_P(TabDragging,
2339 DetachToBrowserTabDragControllerTest, 2266 DetachToBrowserTabDragControllerTest,
2340 ::testing::Values("mouse")); 2267 ::testing::Values("mouse"));
2341 #endif 2268 #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