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

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

Issue 2700523004: Remove docked windows entirely in M59. (Closed)
Patch Set: Rebase Created 3 years, 9 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
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 <stddef.h> 7 #include <stddef.h>
8 8
9 #include <algorithm> 9 #include <algorithm>
10 10
(...skipping 2429 matching lines...) Expand 10 before | Expand all | Expand 10 after
2440 // The drag should have been reverted. 2440 // The drag should have been reverted.
2441 ASSERT_EQ(1u, browser_list->size()); 2441 ASSERT_EQ(1u, browser_list->size());
2442 ASSERT_FALSE(tab_strip->IsDragSessionActive()); 2442 ASSERT_FALSE(tab_strip->IsDragSessionActive());
2443 ASSERT_FALSE(TabDragController::IsActive()); 2443 ASSERT_FALSE(TabDragController::IsActive());
2444 EXPECT_EQ("0 1", IDString(browser()->tab_strip_model())); 2444 EXPECT_EQ("0 1", IDString(browser()->tab_strip_model()));
2445 2445
2446 ASSERT_TRUE(ReleaseInput()); 2446 ASSERT_TRUE(ReleaseInput());
2447 ASSERT_TRUE(ReleaseInput2()); 2447 ASSERT_TRUE(ReleaseInput2());
2448 } 2448 }
2449 2449
2450 namespace {
2451
2452 void DetachToDockedWindowNextStep(
2453 DetachToBrowserTabDragControllerTest* test,
2454 const gfx::Point& target_point,
2455 int iteration) {
2456 ASSERT_EQ(2u, test->browser_list->size());
2457 Browser* new_browser = test->browser_list->get(1);
2458 ASSERT_TRUE(new_browser->window()->IsActive());
2459
2460 if (!iteration) {
2461 ASSERT_TRUE(test->ReleaseInput());
2462 return;
2463 }
2464 ASSERT_TRUE(test->DragInputToNotifyWhenDone(
2465 target_point.x(), target_point.y(),
2466 base::Bind(&DetachToDockedWindowNextStep,
2467 test,
2468 gfx::Point(target_point.x(), 1 + target_point.y()),
2469 iteration - 1)));
2470 }
2471
2472 } // namespace
2473
2474 // Drags from browser to separate window, docks that window and releases mouse.
2475 IN_PROC_BROWSER_TEST_P(DetachToBrowserTabDragControllerTest,
2476 DetachToDockedWindowFromMaximizedWindow) {
2477 // Enable docked windows for this test.
2478 base::CommandLine::ForCurrentProcess()->AppendSwitch(
2479 ash::switches::kAshEnableDockedWindows);
2480
2481 // Maximize the initial browser window.
2482 browser()->window()->Maximize();
2483 ASSERT_TRUE(browser()->window()->IsMaximized());
2484
2485 // Add another tab.
2486 AddTabAndResetBrowser(browser());
2487 TabStrip* tab_strip = GetTabStripForBrowser(browser());
2488
2489 // Move to the first tab and drag it enough so that it detaches.
2490 gfx::Point tab_0_center(
2491 GetCenterInScreenCoordinates(tab_strip->tab_at(0)));
2492 ASSERT_TRUE(PressInput(tab_0_center));
2493
2494 // The following matches kMovesBeforeAdjust in snap_sizer.cc
2495 const int kNumIterations = 25 * 5 + 10;
2496 ASSERT_TRUE(DragInputToNotifyWhenDone(
2497 tab_0_center.x(), tab_0_center.y() + GetDetachY(tab_strip),
2498 base::Bind(&DetachToDockedWindowNextStep, this,
2499 gfx::Point(0, tab_0_center.y() + GetDetachY(tab_strip)),
2500 kNumIterations)));
2501 // Continue dragging enough times to go through snapping sequence and dock
2502 // the window.
2503 QuitWhenNotDragging();
2504 // Should no longer be dragging.
2505 ASSERT_FALSE(tab_strip->IsDragSessionActive());
2506 ASSERT_FALSE(TabDragController::IsActive());
2507
2508 // There should now be another browser.
2509 ASSERT_EQ(2u, browser_list->size());
2510 Browser* new_browser = browser_list->get(1);
2511 ASSERT_TRUE(new_browser->window()->IsActive());
2512 TabStrip* tab_strip2 = GetTabStripForBrowser(new_browser);
2513 ASSERT_FALSE(tab_strip2->IsDragSessionActive());
2514
2515 EXPECT_EQ("0", IDString(new_browser->tab_strip_model()));
2516 EXPECT_EQ("1", IDString(browser()->tab_strip_model()));
2517
2518 // The bounds of the initial window should not have changed.
2519 EXPECT_TRUE(browser()->window()->IsMaximized());
2520
2521 EXPECT_FALSE(GetIsDragged(browser()));
2522 EXPECT_FALSE(GetIsDragged(new_browser));
2523 // After this both windows should still be manageable.
2524 EXPECT_TRUE(IsWindowPositionManaged(browser()->window()->GetNativeWindow()));
2525 EXPECT_TRUE(IsWindowPositionManaged(
2526 new_browser->window()->GetNativeWindow()));
2527
2528 ash::wm::WindowState* window_state =
2529 ash::wm::GetWindowState(new_browser->window()->GetNativeWindow());
2530 // The new window should not be maximized because it gets docked or snapped.
2531 EXPECT_FALSE(new_browser->window()->IsMaximized());
2532 // The new window should be docked and not snapped.
2533 EXPECT_TRUE(window_state->IsDocked());
2534 EXPECT_FALSE(window_state->IsSnapped());
2535 }
2536
2537 #endif // OS_CHROMEOS 2450 #endif // OS_CHROMEOS
2538 2451
2539 #if defined(USE_ASH) 2452 #if defined(USE_ASH)
2540 INSTANTIATE_TEST_CASE_P(TabDragging, 2453 INSTANTIATE_TEST_CASE_P(TabDragging,
2541 DetachToBrowserInSeparateDisplayTabDragControllerTest, 2454 DetachToBrowserInSeparateDisplayTabDragControllerTest,
2542 ::testing::Values("mouse", "touch")); 2455 ::testing::Values("mouse", "touch"));
2543 INSTANTIATE_TEST_CASE_P(TabDragging, 2456 INSTANTIATE_TEST_CASE_P(TabDragging,
2544 DifferentDeviceScaleFactorDisplayTabDragControllerTest, 2457 DifferentDeviceScaleFactorDisplayTabDragControllerTest,
2545 ::testing::Values("mouse")); 2458 ::testing::Values("mouse"));
2546 INSTANTIATE_TEST_CASE_P(TabDragging, 2459 INSTANTIATE_TEST_CASE_P(TabDragging,
2547 DetachToBrowserTabDragControllerTest, 2460 DetachToBrowserTabDragControllerTest,
2548 ::testing::Values("mouse", "touch")); 2461 ::testing::Values("mouse", "touch"));
2549 INSTANTIATE_TEST_CASE_P(TabDragging, 2462 INSTANTIATE_TEST_CASE_P(TabDragging,
2550 DetachToBrowserTabDragControllerTestTouch, 2463 DetachToBrowserTabDragControllerTestTouch,
2551 ::testing::Values("touch")); 2464 ::testing::Values("touch"));
2552 #else 2465 #else
2553 INSTANTIATE_TEST_CASE_P(TabDragging, 2466 INSTANTIATE_TEST_CASE_P(TabDragging,
2554 DetachToBrowserTabDragControllerTest, 2467 DetachToBrowserTabDragControllerTest,
2555 ::testing::Values("mouse")); 2468 ::testing::Values("mouse"));
2556 #endif 2469 #endif
OLDNEW
« no previous file with comments | « chrome/browser/ui/views/tabs/tab_drag_controller.cc ('k') | chrome/browser/ui/window_sizer/window_sizer.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698