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 <algorithm> | 7 #include <algorithm> |
8 | 8 |
9 #include "ash/wm/window_state.h" | 9 #include "ash/wm/window_state.h" |
10 #include "base/bind.h" | 10 #include "base/bind.h" |
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
80 | 80 |
81 class QuitDraggingObserver : public content::NotificationObserver { | 81 class QuitDraggingObserver : public content::NotificationObserver { |
82 public: | 82 public: |
83 QuitDraggingObserver() { | 83 QuitDraggingObserver() { |
84 registrar_.Add(this, chrome::NOTIFICATION_TAB_DRAG_LOOP_DONE, | 84 registrar_.Add(this, chrome::NOTIFICATION_TAB_DRAG_LOOP_DONE, |
85 content::NotificationService::AllSources()); | 85 content::NotificationService::AllSources()); |
86 } | 86 } |
87 | 87 |
88 virtual void Observe(int type, | 88 virtual void Observe(int type, |
89 const content::NotificationSource& source, | 89 const content::NotificationSource& source, |
90 const content::NotificationDetails& details) OVERRIDE { | 90 const content::NotificationDetails& details) override { |
91 DCHECK_EQ(chrome::NOTIFICATION_TAB_DRAG_LOOP_DONE, type); | 91 DCHECK_EQ(chrome::NOTIFICATION_TAB_DRAG_LOOP_DONE, type); |
92 base::MessageLoopForUI::current()->Quit(); | 92 base::MessageLoopForUI::current()->Quit(); |
93 delete this; | 93 delete this; |
94 } | 94 } |
95 | 95 |
96 private: | 96 private: |
97 virtual ~QuitDraggingObserver() {} | 97 virtual ~QuitDraggingObserver() {} |
98 | 98 |
99 content::NotificationRegistrar registrar_; | 99 content::NotificationRegistrar registrar_; |
100 | 100 |
(...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
215 #if defined(USE_ASH) && !defined(OS_WIN) // TODO(win_ash) | 215 #if defined(USE_ASH) && !defined(OS_WIN) // TODO(win_ash) |
216 class ScreenEventGeneratorDelegate | 216 class ScreenEventGeneratorDelegate |
217 : public aura::test::EventGeneratorDelegateAura { | 217 : public aura::test::EventGeneratorDelegateAura { |
218 public: | 218 public: |
219 explicit ScreenEventGeneratorDelegate(aura::Window* root_window) | 219 explicit ScreenEventGeneratorDelegate(aura::Window* root_window) |
220 : root_window_(root_window) {} | 220 : root_window_(root_window) {} |
221 virtual ~ScreenEventGeneratorDelegate() {} | 221 virtual ~ScreenEventGeneratorDelegate() {} |
222 | 222 |
223 // EventGeneratorDelegateAura overrides: | 223 // EventGeneratorDelegateAura overrides: |
224 virtual aura::WindowTreeHost* GetHostAt( | 224 virtual aura::WindowTreeHost* GetHostAt( |
225 const gfx::Point& point) const OVERRIDE { | 225 const gfx::Point& point) const override { |
226 return root_window_->GetHost(); | 226 return root_window_->GetHost(); |
227 } | 227 } |
228 | 228 |
229 virtual aura::client::ScreenPositionClient* GetScreenPositionClient( | 229 virtual aura::client::ScreenPositionClient* GetScreenPositionClient( |
230 const aura::Window* window) const OVERRIDE { | 230 const aura::Window* window) const override { |
231 return aura::client::GetScreenPositionClient(root_window_); | 231 return aura::client::GetScreenPositionClient(root_window_); |
232 } | 232 } |
233 | 233 |
234 private: | 234 private: |
235 aura::Window* root_window_; | 235 aura::Window* root_window_; |
236 | 236 |
237 DISALLOW_COPY_AND_ASSIGN(ScreenEventGeneratorDelegate); | 237 DISALLOW_COPY_AND_ASSIGN(ScreenEventGeneratorDelegate); |
238 }; | 238 }; |
239 | 239 |
240 #endif | 240 #endif |
(...skipping 12 matching lines...) Expand all Loading... |
253 BrowserFrame* browser_frame, | 253 BrowserFrame* browser_frame, |
254 BrowserView* browser_view) | 254 BrowserView* browser_view) |
255 : DesktopBrowserFrameAura(browser_frame, browser_view), | 255 : DesktopBrowserFrameAura(browser_frame, browser_view), |
256 release_capture_(false) {} | 256 release_capture_(false) {} |
257 virtual ~TestDesktopBrowserFrameAura() {} | 257 virtual ~TestDesktopBrowserFrameAura() {} |
258 | 258 |
259 void ReleaseCaptureOnNextClear() { | 259 void ReleaseCaptureOnNextClear() { |
260 release_capture_ = true; | 260 release_capture_ = true; |
261 } | 261 } |
262 | 262 |
263 virtual void ClearNativeFocus() OVERRIDE { | 263 virtual void ClearNativeFocus() override { |
264 views::DesktopNativeWidgetAura::ClearNativeFocus(); | 264 views::DesktopNativeWidgetAura::ClearNativeFocus(); |
265 if (release_capture_) { | 265 if (release_capture_) { |
266 release_capture_ = false; | 266 release_capture_ = false; |
267 GetWidget()->ReleaseCapture(); | 267 GetWidget()->ReleaseCapture(); |
268 } | 268 } |
269 } | 269 } |
270 | 270 |
271 private: | 271 private: |
272 // If true ReleaseCapture() is invoked in ClearNativeFocus(). | 272 // If true ReleaseCapture() is invoked in ClearNativeFocus(). |
273 bool release_capture_; | 273 bool release_capture_; |
274 | 274 |
275 DISALLOW_COPY_AND_ASSIGN(TestDesktopBrowserFrameAura); | 275 DISALLOW_COPY_AND_ASSIGN(TestDesktopBrowserFrameAura); |
276 }; | 276 }; |
277 | 277 |
278 // Factory for creating a TestDesktopBrowserFrameAura. | 278 // Factory for creating a TestDesktopBrowserFrameAura. |
279 class TestNativeBrowserFrameFactory : public NativeBrowserFrameFactory { | 279 class TestNativeBrowserFrameFactory : public NativeBrowserFrameFactory { |
280 public: | 280 public: |
281 TestNativeBrowserFrameFactory() {} | 281 TestNativeBrowserFrameFactory() {} |
282 virtual ~TestNativeBrowserFrameFactory() {} | 282 virtual ~TestNativeBrowserFrameFactory() {} |
283 | 283 |
284 virtual NativeBrowserFrame* Create( | 284 virtual NativeBrowserFrame* Create( |
285 BrowserFrame* browser_frame, | 285 BrowserFrame* browser_frame, |
286 BrowserView* browser_view) OVERRIDE { | 286 BrowserView* browser_view) override { |
287 return new TestDesktopBrowserFrameAura(browser_frame, browser_view); | 287 return new TestDesktopBrowserFrameAura(browser_frame, browser_view); |
288 } | 288 } |
289 | 289 |
290 private: | 290 private: |
291 DISALLOW_COPY_AND_ASSIGN(TestNativeBrowserFrameFactory); | 291 DISALLOW_COPY_AND_ASSIGN(TestNativeBrowserFrameFactory); |
292 }; | 292 }; |
293 | 293 |
294 class TabDragCaptureLostTest : public TabDragControllerTest { | 294 class TabDragCaptureLostTest : public TabDragControllerTest { |
295 public: | 295 public: |
296 TabDragCaptureLostTest() { | 296 TabDragCaptureLostTest() { |
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
351 } | 351 } |
352 | 352 |
353 #endif | 353 #endif |
354 | 354 |
355 class DetachToBrowserTabDragControllerTest | 355 class DetachToBrowserTabDragControllerTest |
356 : public TabDragControllerTest, | 356 : public TabDragControllerTest, |
357 public ::testing::WithParamInterface<const char*> { | 357 public ::testing::WithParamInterface<const char*> { |
358 public: | 358 public: |
359 DetachToBrowserTabDragControllerTest() {} | 359 DetachToBrowserTabDragControllerTest() {} |
360 | 360 |
361 virtual void SetUpOnMainThread() OVERRIDE { | 361 virtual void SetUpOnMainThread() override { |
362 #if defined(OS_CHROMEOS) | 362 #if defined(OS_CHROMEOS) |
363 event_generator_.reset( | 363 event_generator_.reset( |
364 new ui::test::EventGenerator(ash::Shell::GetPrimaryRootWindow())); | 364 new ui::test::EventGenerator(ash::Shell::GetPrimaryRootWindow())); |
365 #endif | 365 #endif |
366 } | 366 } |
367 | 367 |
368 InputSource input_source() const { | 368 InputSource input_source() const { |
369 return strstr(GetParam(), "mouse") ? | 369 return strstr(GetParam(), "mouse") ? |
370 INPUT_SOURCE_MOUSE : INPUT_SOURCE_TOUCH; | 370 INPUT_SOURCE_MOUSE : INPUT_SOURCE_TOUCH; |
371 } | 371 } |
(...skipping 1063 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1435 } | 1435 } |
1436 | 1436 |
1437 // Subclass of DetachToBrowserTabDragControllerTest that | 1437 // Subclass of DetachToBrowserTabDragControllerTest that |
1438 // creates multiple displays. | 1438 // creates multiple displays. |
1439 class DetachToBrowserInSeparateDisplayTabDragControllerTest | 1439 class DetachToBrowserInSeparateDisplayTabDragControllerTest |
1440 : public DetachToBrowserTabDragControllerTest { | 1440 : public DetachToBrowserTabDragControllerTest { |
1441 public: | 1441 public: |
1442 DetachToBrowserInSeparateDisplayTabDragControllerTest() {} | 1442 DetachToBrowserInSeparateDisplayTabDragControllerTest() {} |
1443 virtual ~DetachToBrowserInSeparateDisplayTabDragControllerTest() {} | 1443 virtual ~DetachToBrowserInSeparateDisplayTabDragControllerTest() {} |
1444 | 1444 |
1445 virtual void SetUpCommandLine(CommandLine* command_line) OVERRIDE { | 1445 virtual void SetUpCommandLine(CommandLine* command_line) override { |
1446 DetachToBrowserTabDragControllerTest::SetUpCommandLine(command_line); | 1446 DetachToBrowserTabDragControllerTest::SetUpCommandLine(command_line); |
1447 // Make screens sufficiently wide to host 2 browsers side by side. | 1447 // Make screens sufficiently wide to host 2 browsers side by side. |
1448 command_line->AppendSwitchASCII("ash-host-window-bounds", | 1448 command_line->AppendSwitchASCII("ash-host-window-bounds", |
1449 "0+0-600x600,601+0-600x600"); | 1449 "0+0-600x600,601+0-600x600"); |
1450 } | 1450 } |
1451 | 1451 |
1452 private: | 1452 private: |
1453 DISALLOW_COPY_AND_ASSIGN( | 1453 DISALLOW_COPY_AND_ASSIGN( |
1454 DetachToBrowserInSeparateDisplayTabDragControllerTest); | 1454 DetachToBrowserInSeparateDisplayTabDragControllerTest); |
1455 }; | 1455 }; |
(...skipping 357 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1813 } | 1813 } |
1814 | 1814 |
1815 // Subclass of DetachToBrowserTabDragControllerTest that | 1815 // Subclass of DetachToBrowserTabDragControllerTest that |
1816 // creates multiple displays with different device scale factors. | 1816 // creates multiple displays with different device scale factors. |
1817 class DifferentDeviceScaleFactorDisplayTabDragControllerTest | 1817 class DifferentDeviceScaleFactorDisplayTabDragControllerTest |
1818 : public DetachToBrowserTabDragControllerTest { | 1818 : public DetachToBrowserTabDragControllerTest { |
1819 public: | 1819 public: |
1820 DifferentDeviceScaleFactorDisplayTabDragControllerTest() {} | 1820 DifferentDeviceScaleFactorDisplayTabDragControllerTest() {} |
1821 virtual ~DifferentDeviceScaleFactorDisplayTabDragControllerTest() {} | 1821 virtual ~DifferentDeviceScaleFactorDisplayTabDragControllerTest() {} |
1822 | 1822 |
1823 virtual void SetUpCommandLine(CommandLine* command_line) OVERRIDE { | 1823 virtual void SetUpCommandLine(CommandLine* command_line) override { |
1824 DetachToBrowserTabDragControllerTest::SetUpCommandLine(command_line); | 1824 DetachToBrowserTabDragControllerTest::SetUpCommandLine(command_line); |
1825 command_line->AppendSwitchASCII("ash-host-window-bounds", | 1825 command_line->AppendSwitchASCII("ash-host-window-bounds", |
1826 "400x400,0+400-800x800*2"); | 1826 "400x400,0+400-800x800*2"); |
1827 } | 1827 } |
1828 | 1828 |
1829 float GetCursorDeviceScaleFactor() const { | 1829 float GetCursorDeviceScaleFactor() const { |
1830 ash::test::CursorManagerTestApi cursor_test_api( | 1830 ash::test::CursorManagerTestApi cursor_test_api( |
1831 ash::Shell::GetInstance()->cursor_manager()); | 1831 ash::Shell::GetInstance()->cursor_manager()); |
1832 return cursor_test_api.GetCurrentCursor().device_scale_factor(); | 1832 return cursor_test_api.GetCurrentCursor().device_scale_factor(); |
1833 } | 1833 } |
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1912 QuitWhenNotDragging(); | 1912 QuitWhenNotDragging(); |
1913 } | 1913 } |
1914 | 1914 |
1915 namespace { | 1915 namespace { |
1916 | 1916 |
1917 class DetachToBrowserInSeparateDisplayAndCancelTabDragControllerTest | 1917 class DetachToBrowserInSeparateDisplayAndCancelTabDragControllerTest |
1918 : public TabDragControllerTest { | 1918 : public TabDragControllerTest { |
1919 public: | 1919 public: |
1920 DetachToBrowserInSeparateDisplayAndCancelTabDragControllerTest() {} | 1920 DetachToBrowserInSeparateDisplayAndCancelTabDragControllerTest() {} |
1921 | 1921 |
1922 virtual void SetUpCommandLine(CommandLine* command_line) OVERRIDE { | 1922 virtual void SetUpCommandLine(CommandLine* command_line) override { |
1923 TabDragControllerTest::SetUpCommandLine(command_line); | 1923 TabDragControllerTest::SetUpCommandLine(command_line); |
1924 command_line->AppendSwitchASCII("ash-host-window-bounds", | 1924 command_line->AppendSwitchASCII("ash-host-window-bounds", |
1925 "0+0-250x250,251+0-250x250"); | 1925 "0+0-250x250,251+0-250x250"); |
1926 } | 1926 } |
1927 | 1927 |
1928 bool Press(const gfx::Point& position) { | 1928 bool Press(const gfx::Point& position) { |
1929 return ui_test_utils::SendMouseMoveSync(position) && | 1929 return ui_test_utils::SendMouseMoveSync(position) && |
1930 ui_test_utils::SendMouseEventsSync(ui_controls::LEFT, | 1930 ui_test_utils::SendMouseEventsSync(ui_controls::LEFT, |
1931 ui_controls::DOWN); | 1931 ui_controls::DOWN); |
1932 } | 1932 } |
(...skipping 277 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2210 DetachToBrowserTabDragControllerTest, | 2210 DetachToBrowserTabDragControllerTest, |
2211 ::testing::Values("mouse", "touch")); | 2211 ::testing::Values("mouse", "touch")); |
2212 INSTANTIATE_TEST_CASE_P(TabDragging, | 2212 INSTANTIATE_TEST_CASE_P(TabDragging, |
2213 DetachToBrowserTabDragControllerTestTouch, | 2213 DetachToBrowserTabDragControllerTestTouch, |
2214 ::testing::Values("touch")); | 2214 ::testing::Values("touch")); |
2215 #elif defined(USE_ASH) | 2215 #elif defined(USE_ASH) |
2216 INSTANTIATE_TEST_CASE_P(TabDragging, | 2216 INSTANTIATE_TEST_CASE_P(TabDragging, |
2217 DetachToBrowserTabDragControllerTest, | 2217 DetachToBrowserTabDragControllerTest, |
2218 ::testing::Values("mouse")); | 2218 ::testing::Values("mouse")); |
2219 #endif | 2219 #endif |
OLD | NEW |