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

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

Issue 682763002: Standardize usage of virtual/override/final specifiers. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase Created 6 years, 1 month 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 <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 51 matching lines...) Expand 10 before | Expand all | Expand 10 after
62 62
63 namespace { 63 namespace {
64 64
65 const char kTabDragControllerInteractiveUITestUserDataKey[] = 65 const char kTabDragControllerInteractiveUITestUserDataKey[] =
66 "TabDragControllerInteractiveUITestUserData"; 66 "TabDragControllerInteractiveUITestUserData";
67 67
68 class TabDragControllerInteractiveUITestUserData 68 class TabDragControllerInteractiveUITestUserData
69 : public base::SupportsUserData::Data { 69 : public base::SupportsUserData::Data {
70 public: 70 public:
71 explicit TabDragControllerInteractiveUITestUserData(int id) : id_(id) {} 71 explicit TabDragControllerInteractiveUITestUserData(int id) : id_(id) {}
72 virtual ~TabDragControllerInteractiveUITestUserData() {} 72 ~TabDragControllerInteractiveUITestUserData() override {}
73 int id() { return id_; } 73 int id() { return id_; }
74 74
75 private: 75 private:
76 int id_; 76 int id_;
77 }; 77 };
78 78
79 } // namespace 79 } // namespace
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 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 ~QuitDraggingObserver() override {}
98 98
99 content::NotificationRegistrar registrar_; 99 content::NotificationRegistrar registrar_;
100 100
101 DISALLOW_COPY_AND_ASSIGN(QuitDraggingObserver); 101 DISALLOW_COPY_AND_ASSIGN(QuitDraggingObserver);
102 }; 102 };
103 103
104 gfx::Point GetCenterInScreenCoordinates(const views::View* view) { 104 gfx::Point GetCenterInScreenCoordinates(const views::View* view) {
105 gfx::Point center(view->width() / 2, view->height() / 2); 105 gfx::Point center(view->width() / 2, view->height() / 2);
106 views::View::ConvertPointToScreen(view, &center); 106 views::View::ConvertPointToScreen(view, &center);
107 return center; 107 return center;
(...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after
211 } 211 }
212 212
213 } // namespace 213 } // namespace
214 214
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 ~ScreenEventGeneratorDelegate() override {}
222 222
223 // EventGeneratorDelegateAura overrides: 223 // EventGeneratorDelegateAura overrides:
224 virtual aura::WindowTreeHost* GetHostAt( 224 aura::WindowTreeHost* GetHostAt(const gfx::Point& point) const override {
225 const gfx::Point& point) const override {
226 return root_window_->GetHost(); 225 return root_window_->GetHost();
227 } 226 }
228 227
229 virtual aura::client::ScreenPositionClient* GetScreenPositionClient( 228 aura::client::ScreenPositionClient* GetScreenPositionClient(
230 const aura::Window* window) const override { 229 const aura::Window* window) const override {
231 return aura::client::GetScreenPositionClient(root_window_); 230 return aura::client::GetScreenPositionClient(root_window_);
232 } 231 }
233 232
234 private: 233 private:
235 aura::Window* root_window_; 234 aura::Window* root_window_;
236 235
237 DISALLOW_COPY_AND_ASSIGN(ScreenEventGeneratorDelegate); 236 DISALLOW_COPY_AND_ASSIGN(ScreenEventGeneratorDelegate);
238 }; 237 };
239 238
240 #endif 239 #endif
241 240
242 #if !defined(OS_CHROMEOS) 241 #if !defined(OS_CHROMEOS)
243 242
244 // Following classes verify a crash scenario. Specifically on Windows when focus 243 // Following classes verify a crash scenario. Specifically on Windows when focus
245 // changes it can trigger capture being lost. This was causing a crash in tab 244 // changes it can trigger capture being lost. This was causing a crash in tab
246 // dragging as it wasn't set up to handle this scenario. These classes 245 // dragging as it wasn't set up to handle this scenario. These classes
247 // synthesize this scenario. 246 // synthesize this scenario.
248 247
249 // Allows making ClearNativeFocus() invoke ReleaseCapture(). 248 // Allows making ClearNativeFocus() invoke ReleaseCapture().
250 class TestDesktopBrowserFrameAura : public DesktopBrowserFrameAura { 249 class TestDesktopBrowserFrameAura : public DesktopBrowserFrameAura {
251 public: 250 public:
252 TestDesktopBrowserFrameAura( 251 TestDesktopBrowserFrameAura(
253 BrowserFrame* browser_frame, 252 BrowserFrame* browser_frame,
254 BrowserView* browser_view) 253 BrowserView* browser_view)
255 : DesktopBrowserFrameAura(browser_frame, browser_view), 254 : DesktopBrowserFrameAura(browser_frame, browser_view),
256 release_capture_(false) {} 255 release_capture_(false) {}
257 virtual ~TestDesktopBrowserFrameAura() {} 256 ~TestDesktopBrowserFrameAura() override {}
258 257
259 void ReleaseCaptureOnNextClear() { 258 void ReleaseCaptureOnNextClear() {
260 release_capture_ = true; 259 release_capture_ = true;
261 } 260 }
262 261
263 virtual void ClearNativeFocus() override { 262 void ClearNativeFocus() override {
264 views::DesktopNativeWidgetAura::ClearNativeFocus(); 263 views::DesktopNativeWidgetAura::ClearNativeFocus();
265 if (release_capture_) { 264 if (release_capture_) {
266 release_capture_ = false; 265 release_capture_ = false;
267 GetWidget()->ReleaseCapture(); 266 GetWidget()->ReleaseCapture();
268 } 267 }
269 } 268 }
270 269
271 private: 270 private:
272 // If true ReleaseCapture() is invoked in ClearNativeFocus(). 271 // If true ReleaseCapture() is invoked in ClearNativeFocus().
273 bool release_capture_; 272 bool release_capture_;
274 273
275 DISALLOW_COPY_AND_ASSIGN(TestDesktopBrowserFrameAura); 274 DISALLOW_COPY_AND_ASSIGN(TestDesktopBrowserFrameAura);
276 }; 275 };
277 276
278 // Factory for creating a TestDesktopBrowserFrameAura. 277 // Factory for creating a TestDesktopBrowserFrameAura.
279 class TestNativeBrowserFrameFactory : public NativeBrowserFrameFactory { 278 class TestNativeBrowserFrameFactory : public NativeBrowserFrameFactory {
280 public: 279 public:
281 TestNativeBrowserFrameFactory() {} 280 TestNativeBrowserFrameFactory() {}
282 virtual ~TestNativeBrowserFrameFactory() {} 281 ~TestNativeBrowserFrameFactory() override {}
283 282
284 virtual NativeBrowserFrame* Create( 283 NativeBrowserFrame* Create(BrowserFrame* browser_frame,
285 BrowserFrame* browser_frame, 284 BrowserView* browser_view) override {
286 BrowserView* browser_view) override {
287 return new TestDesktopBrowserFrameAura(browser_frame, browser_view); 285 return new TestDesktopBrowserFrameAura(browser_frame, browser_view);
288 } 286 }
289 287
290 private: 288 private:
291 DISALLOW_COPY_AND_ASSIGN(TestNativeBrowserFrameFactory); 289 DISALLOW_COPY_AND_ASSIGN(TestNativeBrowserFrameFactory);
292 }; 290 };
293 291
294 class TabDragCaptureLostTest : public TabDragControllerTest { 292 class TabDragCaptureLostTest : public TabDragControllerTest {
295 public: 293 public:
296 TabDragCaptureLostTest() { 294 TabDragCaptureLostTest() {
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after
351 } 349 }
352 350
353 #endif 351 #endif
354 352
355 class DetachToBrowserTabDragControllerTest 353 class DetachToBrowserTabDragControllerTest
356 : public TabDragControllerTest, 354 : public TabDragControllerTest,
357 public ::testing::WithParamInterface<const char*> { 355 public ::testing::WithParamInterface<const char*> {
358 public: 356 public:
359 DetachToBrowserTabDragControllerTest() {} 357 DetachToBrowserTabDragControllerTest() {}
360 358
361 virtual void SetUpOnMainThread() override { 359 void SetUpOnMainThread() override {
362 #if defined(OS_CHROMEOS) 360 #if defined(OS_CHROMEOS)
363 event_generator_.reset( 361 event_generator_.reset(
364 new ui::test::EventGenerator(ash::Shell::GetPrimaryRootWindow())); 362 new ui::test::EventGenerator(ash::Shell::GetPrimaryRootWindow()));
365 #endif 363 #endif
366 } 364 }
367 365
368 InputSource input_source() const { 366 InputSource input_source() const {
369 return strstr(GetParam(), "mouse") ? 367 return strstr(GetParam(), "mouse") ?
370 INPUT_SOURCE_MOUSE : INPUT_SOURCE_TOUCH; 368 INPUT_SOURCE_MOUSE : INPUT_SOURCE_TOUCH;
371 } 369 }
(...skipping 1838 matching lines...) Expand 10 before | Expand all | Expand 10 after
2210 DetachToBrowserTabDragControllerTest, 2208 DetachToBrowserTabDragControllerTest,
2211 ::testing::Values("mouse", "touch")); 2209 ::testing::Values("mouse", "touch"));
2212 INSTANTIATE_TEST_CASE_P(TabDragging, 2210 INSTANTIATE_TEST_CASE_P(TabDragging,
2213 DetachToBrowserTabDragControllerTestTouch, 2211 DetachToBrowserTabDragControllerTestTouch,
2214 ::testing::Values("touch")); 2212 ::testing::Values("touch"));
2215 #elif defined(USE_ASH) 2213 #elif defined(USE_ASH)
2216 INSTANTIATE_TEST_CASE_P(TabDragging, 2214 INSTANTIATE_TEST_CASE_P(TabDragging,
2217 DetachToBrowserTabDragControllerTest, 2215 DetachToBrowserTabDragControllerTest,
2218 ::testing::Values("mouse")); 2216 ::testing::Values("mouse"));
2219 #endif 2217 #endif
OLDNEW
« no previous file with comments | « chrome/browser/ui/views/tabs/tab_drag_controller_interactive_uitest.h ('k') | chrome/browser/ui/views/tabs/tab_strip.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698