OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 "base/basictypes.h" | 5 #include "base/basictypes.h" |
6 #include "chrome/test/base/chrome_render_view_test.h" | 6 #include "chrome/test/base/chrome_render_view_test.h" |
7 #include "components/autofill/content/renderer/page_click_listener.h" | 7 #include "components/autofill/content/renderer/page_click_listener.h" |
8 #include "components/autofill/content/renderer/page_click_tracker.h" | 8 #include "components/autofill/content/renderer/page_click_tracker.h" |
9 #include "content/public/renderer/render_view.h" | 9 #include "content/public/renderer/render_view.h" |
10 #include "testing/gtest/include/gtest/gtest.h" | 10 #include "testing/gtest/include/gtest/gtest.h" |
(...skipping 171 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
182 EXPECT_TRUE(test_listener_.form_control_element_clicked_called_); | 182 EXPECT_TRUE(test_listener_.form_control_element_clicked_called_); |
183 EXPECT_FALSE(test_listener_.was_focused_); | 183 EXPECT_FALSE(test_listener_.was_focused_); |
184 EXPECT_TRUE(text_ == test_listener_.form_control_element_clicked_); | 184 EXPECT_TRUE(text_ == test_listener_.form_control_element_clicked_); |
185 test_listener_.ClearResults(); | 185 test_listener_.ClearResults(); |
186 | 186 |
187 // Click the disabled element. | 187 // Click the disabled element. |
188 EXPECT_TRUE(SimulateElementClick("button_2")); | 188 EXPECT_TRUE(SimulateElementClick("button_2")); |
189 EXPECT_FALSE(test_listener_.form_control_element_clicked_called_); | 189 EXPECT_FALSE(test_listener_.form_control_element_clicked_called_); |
190 } | 190 } |
191 | 191 |
| 192 TEST_F(PageClickTrackerTest, PageClickTrackerTapNearEdgeIsPageClick) { |
| 193 EXPECT_NE(text_, text_.document().focusedElement()); |
| 194 // Tap outside of element bounds, but tap width is overlapping the field. |
| 195 gfx::Rect element_bounds = GetElementBounds("text_1"); |
| 196 SimulateRectTap(element_bounds - |
| 197 gfx::Vector2d(element_bounds.width() / 2 + 1, 0)); |
| 198 EXPECT_TRUE(test_listener_.form_control_element_clicked_called_); |
| 199 EXPECT_FALSE(test_listener_.was_focused_); |
| 200 EXPECT_TRUE(text_ == test_listener_.form_control_element_clicked_); |
| 201 } |
| 202 |
192 } // namespace autofill | 203 } // namespace autofill |
OLD | NEW |