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

Side by Side Diff: chrome/test/base/interactive_test_utils.h

Issue 1747803003: MacViews: Implement Tab Dragging (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Remove CGEvent-generating code from ui_controls_mac.mm Created 4 years, 6 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 #ifndef CHROME_TEST_BASE_INTERACTIVE_TEST_UTILS_H_ 5 #ifndef CHROME_TEST_BASE_INTERACTIVE_TEST_UTILS_H_
6 #define CHROME_TEST_BASE_INTERACTIVE_TEST_UTILS_H_ 6 #define CHROME_TEST_BASE_INTERACTIVE_TEST_UTILS_H_
7 7
8 #include "chrome/browser/ui/view_ids.h" 8 #include "chrome/browser/ui/view_ids.h"
9 #include "chrome/test/base/ui_test_utils.h" 9 #include "chrome/test/base/ui_test_utils.h"
10 #include "ui/base/test/ui_controls.h" 10 #include "ui/base/test/ui_controls.h"
11 11 #include "ui/gfx/geometry/point.h"
12 namespace gfx {
13 class Point;
14 }
15 12
16 #if defined(TOOLKIT_VIEWS) 13 #if defined(TOOLKIT_VIEWS)
17 namespace views { 14 namespace views {
18 class View; 15 class View;
19 } 16 }
20 #endif 17 #endif
21 18
22 namespace ui_test_utils { 19 namespace ui_test_utils {
23 20
21 #if defined(OS_MACOSX)
22 // Moves the mouse to the |from| position, presses left mouse button,
23 // then moves mouse to the |to| position and releases left mouse button.
24 // |steps| indicates number of intermediate points that are interpolated between
25 // |from| and |to|.
26 void DragAndDrop(const gfx::Point& from, const gfx::Point& to, int steps = 1);
tapted 2016/06/01 11:29:55 nit: move below DragAndDropSequnce (it's usually n
themblsha 2016/06/03 17:42:07 Done.
27
28 // Represents an operation in a sequence of simulated drag and drop events
29 // executed asynchronously by DragAndDropSequence.
30 class DragAndDropOperation {
31 public:
32 enum class Type {
33 Move,
34 MouseDown,
35 MouseUp
36 };
37
38 static DragAndDropOperation Move(const gfx::Point& p);
39 static DragAndDropOperation MouseDown();
40 static DragAndDropOperation MouseUp();
41
42 Type type() const { return type_; }
43 const gfx::Point& point() const { return point_; }
44
45 private:
46 DragAndDropOperation(Type type, const gfx::Point& p)
47 : type_(type), point_(p) {}
48
49 Type type_;
50 gfx::Point point_;
51 };
52
53 // Performs a series of drag and drop operations while spinning a RunLoop on the
54 // main thread. If there are nested eventloops on the main thread's queue, our
tapted 2016/06/01 11:29:55 I don't think we need the sentence "If there are n
themblsha 2016/06/03 17:42:07 Done.
55 // helper RunLoop won't quit and we'll get stuck.
56 // BridgedNativeWidget::RunMoveLoop() creates a RunLoop, so we need to ensure
57 // that sequence is finished before trying to return from the function.
58 void DragAndDropSequence(const std::list<DragAndDropOperation>& operations);
59 #endif // OS_MACOSX
60
24 // Brings the native window for |browser| to the foreground. Returns true on 61 // Brings the native window for |browser| to the foreground. Returns true on
25 // success. 62 // success.
26 bool BringBrowserWindowToFront(const Browser* browser) WARN_UNUSED_RESULT; 63 bool BringBrowserWindowToFront(const Browser* browser) WARN_UNUSED_RESULT;
27 64
28 // Returns true if the View is focused. 65 // Returns true if the View is focused.
29 bool IsViewFocused(const Browser* browser, ViewID vid); 66 bool IsViewFocused(const Browser* browser, ViewID vid);
30 67
31 // Simulates a mouse click on a View in the browser. 68 // Simulates a mouse click on a View in the browser.
32 void ClickOnView(const Browser* browser, ViewID vid); 69 void ClickOnView(const Browser* browser, ViewID vid);
33 70
(...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after
143 // ui_controls_linux.cc and ui_controls_mac.cc 180 // ui_controls_linux.cc and ui_controls_mac.cc
144 void ClickTask(ui_controls::MouseButton button, 181 void ClickTask(ui_controls::MouseButton button,
145 int state, 182 int state,
146 const base::Closure& followup); 183 const base::Closure& followup);
147 184
148 } // namespace internal 185 } // namespace internal
149 186
150 } // namespace ui_test_utils 187 } // namespace ui_test_utils
151 188
152 #endif // CHROME_TEST_BASE_INTERACTIVE_TEST_UTILS_H_ 189 #endif // CHROME_TEST_BASE_INTERACTIVE_TEST_UTILS_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698