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

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

Issue 2812623003: Reenable two interactive ui tests (Closed)
Patch Set: Modify the PressSecondFingerWhileDetached test Created 3 years, 8 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 <stddef.h> 7 #include <stddef.h>
8 8
9 #include <algorithm> 9 #include <algorithm>
10 10
(...skipping 2343 matching lines...) Expand 10 before | Expand all | Expand 10 after
2354 EXPECT_EQ("0 1", IDString(browser()->tab_strip_model())); 2354 EXPECT_EQ("0 1", IDString(browser()->tab_strip_model()));
2355 2355
2356 // Release the mouse 2356 // Release the mouse
2357 ASSERT_TRUE(ui_test_utils::SendMouseEventsSync( 2357 ASSERT_TRUE(ui_test_utils::SendMouseEventsSync(
2358 ui_controls::LEFT, ui_controls::UP)); 2358 ui_controls::LEFT, ui_controls::UP));
2359 } 2359 }
2360 2360
2361 // Drags from browser from a second display to primary and releases input. 2361 // Drags from browser from a second display to primary and releases input.
2362 IN_PROC_BROWSER_TEST_F( 2362 IN_PROC_BROWSER_TEST_F(
2363 DetachToBrowserInSeparateDisplayAndCancelTabDragControllerTest, 2363 DetachToBrowserInSeparateDisplayAndCancelTabDragControllerTest,
2364 DISABLED_CancelDragTabToWindowIn1stDisplay) { 2364 CancelDragTabToWindowIn1stDisplay) {
2365 aura::Window::Windows roots = ash::Shell::GetAllRootWindows(); 2365 aura::Window::Windows roots = ash::Shell::GetAllRootWindows();
2366 ASSERT_EQ(2u, roots.size()); 2366 ASSERT_EQ(2u, roots.size());
2367 2367
2368 // Add another tab. 2368 // Add another tab.
2369 AddTabAndResetBrowser(browser()); 2369 AddTabAndResetBrowser(browser());
2370 TabStrip* tab_strip = GetTabStripForBrowser(browser()); 2370 TabStrip* tab_strip = GetTabStripForBrowser(browser());
2371 2371
2372 EXPECT_EQ("0 1", IDString(browser()->tab_strip_model())); 2372 EXPECT_EQ("0 1", IDString(browser()->tab_strip_model()));
2373 EXPECT_EQ(roots[0], browser()->window()->GetNativeWindow()->GetRootWindow()); 2373 EXPECT_EQ(roots[0], browser()->window()->GetNativeWindow()->GetRootWindow());
2374 2374
(...skipping 24 matching lines...) Expand all
2399 ASSERT_FALSE(tab_strip->IsDragSessionActive()); 2399 ASSERT_FALSE(tab_strip->IsDragSessionActive());
2400 ASSERT_FALSE(TabDragController::IsActive()); 2400 ASSERT_FALSE(TabDragController::IsActive());
2401 EXPECT_EQ("0 1", IDString(browser()->tab_strip_model())); 2401 EXPECT_EQ("0 1", IDString(browser()->tab_strip_model()));
2402 2402
2403 // Release the mouse 2403 // Release the mouse
2404 ASSERT_TRUE(ui_test_utils::SendMouseEventsSync( 2404 ASSERT_TRUE(ui_test_utils::SendMouseEventsSync(
2405 ui_controls::LEFT, ui_controls::UP)); 2405 ui_controls::LEFT, ui_controls::UP));
2406 } 2406 }
2407 2407
2408 namespace { 2408 namespace {
2409 2409 void PressSecondFingerWhileDetachedStep3(
2410 void PressSecondFingerWhileDetachedStep2(
2411 DetachToBrowserTabDragControllerTest* test) { 2410 DetachToBrowserTabDragControllerTest* test) {
2412 ASSERT_TRUE(TabDragController::IsActive()); 2411 ASSERT_TRUE(TabDragController::IsActive());
2413 ASSERT_EQ(2u, test->browser_list->size()); 2412 ASSERT_EQ(2u, test->browser_list->size());
2414 Browser* new_browser = test->browser_list->get(1); 2413 Browser* new_browser = test->browser_list->get(1);
Peter Kasting 2017/04/11 02:15:24 Nit: Can just inline into next line (2 places)
weidongg 2017/04/11 02:57:43 Done.
2415 ASSERT_TRUE(new_browser->window()->IsActive()); 2414 ASSERT_TRUE(new_browser->window()->IsActive());
2416 2415
2416 ASSERT_TRUE(test->ReleaseInput());
2417 ASSERT_TRUE(test->ReleaseInput2());
2418 }
2419
2420 void PressSecondFingerWhileDetachedStep2(
2421 DetachToBrowserTabDragControllerTest* test,
2422 const gfx::Point& target_point) {
2423 ASSERT_TRUE(TabDragController::IsActive());
2424 ASSERT_EQ(2u, test->browser_list->size());
2425 Browser* new_browser = test->browser_list->get(1);
2426 ASSERT_TRUE(new_browser->window()->IsActive());
2427
2417 ASSERT_TRUE(test->PressInput2()); 2428 ASSERT_TRUE(test->PressInput2());
2429 // Continue dragging after adding a second finger.
Peter Kasting 2017/04/11 02:15:24 Nit: Put comment above line above
weidongg 2017/04/11 02:57:43 Done.
2430 ASSERT_TRUE(test->DragInputToNotifyWhenDone(
2431 target_point.x(), target_point.y(),
2432 base::Bind(&PressSecondFingerWhileDetachedStep3, test)));
2418 } 2433 }
2419 2434
2420 } // namespace 2435 } // namespace
2421 2436
2422 // Detaches a tab and while detached presses a second finger. 2437 // Detaches a tab and while detached presses a second finger.
2423 IN_PROC_BROWSER_TEST_P(DetachToBrowserTabDragControllerTestTouch, 2438 IN_PROC_BROWSER_TEST_P(DetachToBrowserTabDragControllerTestTouch,
2424 DISABLED_PressSecondFingerWhileDetached) { 2439 PressSecondFingerWhileDetached) {
2425 // Add another tab. 2440 // Add another tab.
2426 AddTabAndResetBrowser(browser()); 2441 AddTabAndResetBrowser(browser());
2427 TabStrip* tab_strip = GetTabStripForBrowser(browser()); 2442 TabStrip* tab_strip = GetTabStripForBrowser(browser());
2428 EXPECT_EQ("0 1", IDString(browser()->tab_strip_model())); 2443 EXPECT_EQ("0 1", IDString(browser()->tab_strip_model()));
2429 2444
2430 // Move to the first tab and drag it enough so that it detaches. 2445 // Move to the first tab and drag it enough so that it detaches.
2431 gfx::Point tab_0_center( 2446 gfx::Point tab_0_center(GetCenterInScreenCoordinates(tab_strip->tab_at(0)));
2432 GetCenterInScreenCoordinates(tab_strip->tab_at(0)));
2433 ASSERT_TRUE(PressInput(tab_0_center)); 2447 ASSERT_TRUE(PressInput(tab_0_center));
2434 ASSERT_TRUE(DragInputToDelayedNotifyWhenDone( 2448 ASSERT_TRUE(DragInputToNotifyWhenDone(
Peter Kasting 2017/04/11 02:15:24 If you're removing this call, remove the whole fun
weidongg 2017/04/11 02:57:43 Done.
2435 tab_0_center.x(), tab_0_center.y() + GetDetachY(tab_strip), 2449 tab_0_center.x(), tab_0_center.y() + GetDetachY(tab_strip),
2436 base::Bind(&PressSecondFingerWhileDetachedStep2, this), 2450 base::Bind(&PressSecondFingerWhileDetachedStep2, this,
2437 base::TimeDelta::FromMilliseconds(60))); 2451 gfx::Point(tab_0_center.x(),
2452 tab_0_center.y() + 2 * GetDetachY(tab_strip)))));
2438 QuitWhenNotDragging(); 2453 QuitWhenNotDragging();
2439 2454
2440 // The drag should have been reverted. 2455 // Should no longer be dragging.
2441 ASSERT_EQ(1u, browser_list->size());
2442 ASSERT_FALSE(tab_strip->IsDragSessionActive()); 2456 ASSERT_FALSE(tab_strip->IsDragSessionActive());
2443 ASSERT_FALSE(TabDragController::IsActive()); 2457 ASSERT_FALSE(TabDragController::IsActive());
2444 EXPECT_EQ("0 1", IDString(browser()->tab_strip_model()));
2445 2458
2446 ASSERT_TRUE(ReleaseInput()); 2459 // There should now be another browser.
2447 ASSERT_TRUE(ReleaseInput2()); 2460 ASSERT_EQ(2u, browser_list->size());
2461 Browser* new_browser = browser_list->get(1);
2462 ASSERT_TRUE(new_browser->window()->IsActive());
2463 TabStrip* tab_strip2 = GetTabStripForBrowser(new_browser);
2464 ASSERT_FALSE(tab_strip2->IsDragSessionActive());
2465
2466 EXPECT_EQ("0", IDString(new_browser->tab_strip_model()));
2467 EXPECT_EQ("1", IDString(browser()->tab_strip_model()));
2448 } 2468 }
2449 2469
2450 #endif // OS_CHROMEOS 2470 #endif // OS_CHROMEOS
2451 2471
2452 #if defined(USE_ASH) 2472 #if defined(USE_ASH)
2453 INSTANTIATE_TEST_CASE_P(TabDragging, 2473 INSTANTIATE_TEST_CASE_P(TabDragging,
2454 DetachToBrowserInSeparateDisplayTabDragControllerTest, 2474 DetachToBrowserInSeparateDisplayTabDragControllerTest,
2455 ::testing::Values("mouse", "touch")); 2475 ::testing::Values("mouse", "touch"));
2456 INSTANTIATE_TEST_CASE_P(TabDragging, 2476 INSTANTIATE_TEST_CASE_P(TabDragging,
2457 DifferentDeviceScaleFactorDisplayTabDragControllerTest, 2477 DifferentDeviceScaleFactorDisplayTabDragControllerTest,
2458 ::testing::Values("mouse")); 2478 ::testing::Values("mouse"));
2459 INSTANTIATE_TEST_CASE_P(TabDragging, 2479 INSTANTIATE_TEST_CASE_P(TabDragging,
2460 DetachToBrowserTabDragControllerTest, 2480 DetachToBrowserTabDragControllerTest,
2461 ::testing::Values("mouse", "touch")); 2481 ::testing::Values("mouse", "touch"));
2462 INSTANTIATE_TEST_CASE_P(TabDragging, 2482 INSTANTIATE_TEST_CASE_P(TabDragging,
2463 DetachToBrowserTabDragControllerTestTouch, 2483 DetachToBrowserTabDragControllerTestTouch,
2464 ::testing::Values("touch")); 2484 ::testing::Values("touch"));
2465 #else 2485 #else
2466 INSTANTIATE_TEST_CASE_P(TabDragging, 2486 INSTANTIATE_TEST_CASE_P(TabDragging,
2467 DetachToBrowserTabDragControllerTest, 2487 DetachToBrowserTabDragControllerTest,
2468 ::testing::Values("mouse")); 2488 ::testing::Values("mouse"));
2469 #endif 2489 #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