| Index: chrome/test/base/interactive_test_utils.h
|
| diff --git a/chrome/test/base/interactive_test_utils.h b/chrome/test/base/interactive_test_utils.h
|
| index f0ccc770f2a8cfae8ca6437cdfc83364527badf7..e0cfdbe97775bb272a6f57213584908c22a12275 100644
|
| --- a/chrome/test/base/interactive_test_utils.h
|
| +++ b/chrome/test/base/interactive_test_utils.h
|
| @@ -8,10 +8,7 @@
|
| #include "chrome/browser/ui/view_ids.h"
|
| #include "chrome/test/base/ui_test_utils.h"
|
| #include "ui/base/test/ui_controls.h"
|
| -
|
| -namespace gfx {
|
| -class Point;
|
| -}
|
| +#include "ui/gfx/geometry/point.h"
|
|
|
| #if defined(TOOLKIT_VIEWS)
|
| namespace views {
|
| @@ -21,6 +18,45 @@ class View;
|
|
|
| namespace ui_test_utils {
|
|
|
| +#if defined(OS_MACOSX)
|
| +// Represents an operation in a sequence of simulated drag and drop events
|
| +// executed asynchronously by DragAndDropSequence.
|
| +class DragAndDropOperation {
|
| + public:
|
| + enum class Type {
|
| + Move,
|
| + MouseDown,
|
| + MouseUp
|
| + };
|
| +
|
| + static DragAndDropOperation Move(const gfx::Point& p);
|
| + static DragAndDropOperation MouseDown();
|
| + static DragAndDropOperation MouseUp();
|
| +
|
| + Type type() const { return type_; }
|
| + const gfx::Point& point() const { return point_; }
|
| +
|
| + private:
|
| + DragAndDropOperation(Type type, const gfx::Point& p)
|
| + : type_(type), point_(p) {}
|
| +
|
| + Type type_;
|
| + gfx::Point point_;
|
| +};
|
| +
|
| +// Performs a series of drag and drop operations while spinning a RunLoop on the
|
| +// main thread.
|
| +// BridgedNativeWidget::RunMoveLoop() creates a RunLoop, so we need to ensure
|
| +// that sequence is finished before trying to return from the function.
|
| +void DragAndDropSequence(const std::list<DragAndDropOperation>& operations);
|
| +
|
| +// Moves the mouse to the |from| position, presses left mouse button,
|
| +// then moves mouse to the |to| position and releases left mouse button.
|
| +// |steps| indicates number of intermediate points that are interpolated between
|
| +// |from| and |to|.
|
| +void DragAndDrop(const gfx::Point& from, const gfx::Point& to, int steps = 1);
|
| +#endif // OS_MACOSX
|
| +
|
| // Brings the native window for |browser| to the foreground. Returns true on
|
| // success.
|
| bool BringBrowserWindowToFront(const Browser* browser) WARN_UNUSED_RESULT;
|
|
|