OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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/autofill/autofill_popup_base_view.h" | 5 #include "chrome/browser/ui/views/autofill/autofill_popup_base_view.h" |
6 | 6 |
7 #include "chrome/browser/ui/autofill/autofill_popup_view_delegate.h" | 7 #include "chrome/browser/ui/autofill/autofill_popup_view_delegate.h" |
8 #include "chrome/browser/ui/browser.h" | 8 #include "chrome/browser/ui/browser.h" |
9 #include "chrome/browser/ui/browser_window.h" | 9 #include "chrome/browser/ui/browser_window.h" |
10 #include "chrome/test/base/in_process_browser_test.h" | 10 #include "chrome/test/base/in_process_browser_test.h" |
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
63 ui::EventTimeForNow(), | 63 ui::EventTimeForNow(), |
64 ui::GestureEventDetails(type, 0, 0), | 64 ui::GestureEventDetails(type, 0, 0), |
65 0); | 65 0); |
66 } | 66 } |
67 | 67 |
68 void SimulateGesture(ui::GestureEvent* event) { | 68 void SimulateGesture(ui::GestureEvent* event) { |
69 view_->OnGestureEvent(event); | 69 view_->OnGestureEvent(event); |
70 } | 70 } |
71 | 71 |
72 protected: | 72 protected: |
73 MockAutofillPopupViewDelegate mock_delegate_; | 73 testing::NiceMock<MockAutofillPopupViewDelegate> mock_delegate_; |
74 AutofillPopupBaseView* view_; | 74 AutofillPopupBaseView* view_; |
75 }; | 75 }; |
76 | 76 |
77 // Flaky on Win only. http://crbug.com/376299 | 77 // Flaky on Win only. http://crbug.com/376299 |
78 #if defined(OS_WIN) | 78 #if defined(OS_WIN) |
79 #define MAYBE_GestureTest DISABLED_GestureTest | 79 #define MAYBE_GestureTest DISABLED_GestureTest |
80 #else | 80 #else |
81 #define MAYBE_GestureTest GestureTest | 81 #define MAYBE_GestureTest GestureTest |
82 #endif | 82 #endif |
83 | 83 |
(...skipping 21 matching lines...) Expand all Loading... |
105 // Tapping will accept the selection. | 105 // Tapping will accept the selection. |
106 ui::GestureEvent tap_event = CreateGestureEvent(ui::ET_GESTURE_TAP, point); | 106 ui::GestureEvent tap_event = CreateGestureEvent(ui::ET_GESTURE_TAP, point); |
107 SimulateGesture(&tap_event); | 107 SimulateGesture(&tap_event); |
108 | 108 |
109 // Tapping outside the bounds clears any selection. | 109 // Tapping outside the bounds clears any selection. |
110 ui::GestureEvent outside_tap = CreateGestureEvent(ui::ET_GESTURE_TAP, | 110 ui::GestureEvent outside_tap = CreateGestureEvent(ui::ET_GESTURE_TAP, |
111 gfx::Point(100, 100)); | 111 gfx::Point(100, 100)); |
112 SimulateGesture(&outside_tap); | 112 SimulateGesture(&outside_tap); |
113 } | 113 } |
114 | 114 |
| 115 IN_PROC_BROWSER_TEST_F(AutofillPopupBaseViewTest, DoubleClickTest) { |
| 116 gfx::Rect bounds(0, 0, 5, 5); |
| 117 gfx::Point point = bounds.CenterPoint(); |
| 118 EXPECT_CALL(mock_delegate_, popup_bounds()).WillRepeatedly(ReturnRef(bounds)); |
| 119 |
| 120 ShowView(); |
| 121 |
| 122 ui::MouseEvent mouse_down(ui::ET_MOUSE_PRESSED, |
| 123 gfx::Point(0, 0), |
| 124 gfx::Point(0, 0), |
| 125 0, 0); |
| 126 EXPECT_TRUE(static_cast<views::View*>(view_)->OnMousePressed(mouse_down)); |
| 127 |
| 128 // Ignore double clicks. |
| 129 mouse_down.SetClickCount(2); |
| 130 EXPECT_FALSE(static_cast<views::View*>(view_)->OnMousePressed(mouse_down)); |
| 131 } |
| 132 |
115 } // namespace autofill | 133 } // namespace autofill |
OLD | NEW |