| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "chrome/browser/ui/views/tabs/tab_drag_controller_interactive_uitest.h" | 5 #include "chrome/browser/ui/views/tabs/tab_drag_controller_interactive_uitest.h" |
| 6 | 6 |
| 7 #include <stddef.h> | 7 #include <stddef.h> |
| 8 | 8 |
| 9 #include <algorithm> | 9 #include <algorithm> |
| 10 | 10 |
| (...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 104 } | 104 } |
| 105 | 105 |
| 106 private: | 106 private: |
| 107 ~QuitDraggingObserver() override {} | 107 ~QuitDraggingObserver() override {} |
| 108 | 108 |
| 109 content::NotificationRegistrar registrar_; | 109 content::NotificationRegistrar registrar_; |
| 110 | 110 |
| 111 DISALLOW_COPY_AND_ASSIGN(QuitDraggingObserver); | 111 DISALLOW_COPY_AND_ASSIGN(QuitDraggingObserver); |
| 112 }; | 112 }; |
| 113 | 113 |
| 114 gfx::Point GetCenterInScreenCoordinates(const views::View* view) { | |
| 115 gfx::Point center(view->width() / 2, view->height() / 2); | |
| 116 views::View::ConvertPointToScreen(view, ¢er); | |
| 117 return center; | |
| 118 } | |
| 119 | |
| 120 void SetID(WebContents* web_contents, int id) { | 114 void SetID(WebContents* web_contents, int id) { |
| 121 web_contents->SetUserData(&kTabDragControllerInteractiveUITestUserDataKey, | 115 web_contents->SetUserData(&kTabDragControllerInteractiveUITestUserDataKey, |
| 122 new TabDragControllerInteractiveUITestUserData(id)); | 116 new TabDragControllerInteractiveUITestUserData(id)); |
| 123 } | 117 } |
| 124 | 118 |
| 125 void ResetIDs(TabStripModel* model, int start) { | 119 void ResetIDs(TabStripModel* model, int start) { |
| 126 for (int i = 0; i < model->count(); ++i) | 120 for (int i = 0; i < model->count(); ++i) |
| 127 SetID(model->GetWebContentsAt(i), start + i); | 121 SetID(model->GetWebContentsAt(i), start + i); |
| 128 } | 122 } |
| 129 | 123 |
| (...skipping 20 matching lines...) Expand all Loading... |
| 150 new QuitDraggingObserver(); // QuitDraggingObserver deletes itself. | 144 new QuitDraggingObserver(); // QuitDraggingObserver deletes itself. |
| 151 } | 145 } |
| 152 | 146 |
| 153 TabStrip* GetTabStripForBrowser(Browser* browser) { | 147 TabStrip* GetTabStripForBrowser(Browser* browser) { |
| 154 BrowserView* browser_view = BrowserView::GetBrowserViewForBrowser(browser); | 148 BrowserView* browser_view = BrowserView::GetBrowserViewForBrowser(browser); |
| 155 return static_cast<TabStrip*>(browser_view->tabstrip()); | 149 return static_cast<TabStrip*>(browser_view->tabstrip()); |
| 156 } | 150 } |
| 157 | 151 |
| 158 } // namespace test | 152 } // namespace test |
| 159 | 153 |
| 160 using test::GetCenterInScreenCoordinates; | 154 using ui_test_utils::GetCenterInScreenCoordinates; |
| 161 using test::SetID; | 155 using test::SetID; |
| 162 using test::ResetIDs; | 156 using test::ResetIDs; |
| 163 using test::IDString; | 157 using test::IDString; |
| 164 using test::GetTabStripForBrowser; | 158 using test::GetTabStripForBrowser; |
| 165 | 159 |
| 166 TabDragControllerTest::TabDragControllerTest() | 160 TabDragControllerTest::TabDragControllerTest() |
| 167 : browser_list(BrowserList::GetInstance()) {} | 161 : browser_list(BrowserList::GetInstance()) {} |
| 168 | 162 |
| 169 TabDragControllerTest::~TabDragControllerTest() { | 163 TabDragControllerTest::~TabDragControllerTest() { |
| 170 } | 164 } |
| (...skipping 2191 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2362 DetachToBrowserTabDragControllerTest, | 2356 DetachToBrowserTabDragControllerTest, |
| 2363 ::testing::Values("mouse", "touch")); | 2357 ::testing::Values("mouse", "touch")); |
| 2364 INSTANTIATE_TEST_CASE_P(TabDragging, | 2358 INSTANTIATE_TEST_CASE_P(TabDragging, |
| 2365 DetachToBrowserTabDragControllerTestTouch, | 2359 DetachToBrowserTabDragControllerTestTouch, |
| 2366 ::testing::Values("touch")); | 2360 ::testing::Values("touch")); |
| 2367 #elif defined(USE_ASH) | 2361 #elif defined(USE_ASH) |
| 2368 INSTANTIATE_TEST_CASE_P(TabDragging, | 2362 INSTANTIATE_TEST_CASE_P(TabDragging, |
| 2369 DetachToBrowserTabDragControllerTest, | 2363 DetachToBrowserTabDragControllerTest, |
| 2370 ::testing::Values("mouse")); | 2364 ::testing::Values("mouse")); |
| 2371 #endif | 2365 #endif |
| OLD | NEW |