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

Side by Side Diff: chrome/test/base/interactive_test_utils_common_views.cc

Issue 1669793002: mac_views_browser: fixed interactive_ui_tests compilation. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Review fixes Created 4 years, 10 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
(Empty)
1 // Copyright (c) 2016 The Chromium Authors. All rights reserved.
tapted 2016/02/07 23:15:30 nit: no (c)
themblsha 2016/02/08 17:08:58 Done. It appears that the (c) omission is relative
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 // Methods compiled on all toolkit-views platforms (including Mac).
6
7 #include "chrome/test/base/interactive_test_utils.h"
8
9 #include "ui/compositor/layer.h"
10 #include "ui/compositor/layer_animator.h"
11 #include "ui/views/view.h"
12 #include "ui/views/widget/widget.h"
13
14 namespace ui_test_utils {
15
16 void MoveMouseToCenterAndPress(views::View* view,
17 ui_controls::MouseButton button,
18 int state,
19 const base::Closure& closure) {
20 DCHECK(view);
21 DCHECK(view->GetWidget());
22 // Complete any in-progress animation before sending the events so that the
23 // mouse-event targetting happens reliably, and does not flake because of
24 // unreliable animation state.
25 ui::Layer* layer = view->GetWidget()->GetLayer();
26 if (layer) {
27 ui::LayerAnimator* animator = layer->GetAnimator();
28 if (animator && animator->is_animating())
29 animator->StopAnimating();
30 }
31
32 gfx::Point view_center(view->width() / 2, view->height() / 2);
33 views::View::ConvertPointToScreen(view, &view_center);
34 ui_controls::SendMouseMoveNotifyWhenDone(
35 view_center.x(),
36 view_center.y(),
37 base::Bind(&internal::ClickTask, button, state, closure));
38 }
39
40 } // namespace ui_test_utils
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698