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 "components/autofill/renderer/page_click_listener.h" | 6 #include "components/autofill/renderer/page_click_listener.h" |
7 #include "components/autofill/renderer/page_click_tracker.h" | 7 #include "components/autofill/renderer/page_click_tracker.h" |
8 #include "content/public/renderer/render_view.h" | 8 #include "content/public/renderer/render_view.h" |
9 #include "content/public/test/render_view_test.h" | 9 #include "content/public/test/render_view_test.h" |
10 #include "testing/gtest/include/gtest/gtest.h" | 10 #include "testing/gtest/include/gtest/gtest.h" |
11 #include "third_party/WebKit/public/platform/WebSize.h" | 11 #include "third_party/WebKit/public/platform/WebSize.h" |
12 #include "third_party/WebKit/Source/WebKit/chromium/public/WebDocument.h" | 12 #include "third_party/WebKit/Source/WebKit/chromium/public/WebDocument.h" |
13 #include "third_party/WebKit/Source/WebKit/chromium/public/WebInputElement.h" | 13 #include "third_party/WebKit/Source/WebKit/chromium/public/WebInputElement.h" |
14 #include "third_party/WebKit/Source/WebKit/chromium/public/WebView.h" | 14 #include "third_party/WebKit/Source/WebKit/chromium/public/WebView.h" |
15 #include "ui/base/keycodes/keyboard_codes.h" | 15 #include "ui/base/keycodes/keyboard_codes.h" |
16 | 16 |
17 namespace autofill { | 17 namespace autofill { |
18 | 18 |
19 class TestPageClickListener : public PageClickListener { | 19 class TestPageClickListener : public PageClickListener { |
20 public: | 20 public: |
21 TestPageClickListener() | 21 TestPageClickListener() |
22 : input_element_clicked_called_(false), | 22 : input_element_clicked_called_(false), |
23 input_element_lost_focus_called_(false), | 23 input_element_lost_focus_called_(false), |
24 was_focused_(false), | 24 was_focused_(false), |
25 is_focused_(false) { | 25 is_focused_(false) { |
26 } | 26 } |
27 | 27 |
28 virtual void InputElementClicked(const WebKit::WebInputElement& element, | 28 virtual void InputElementClicked( |
29 bool was_focused, | 29 const WebKit::WebInputElement& element, |
30 bool is_focused) OVERRIDE { | 30 bool was_focused, |
| 31 bool is_focused, |
| 32 InputEventSource input_event_source) OVERRIDE { |
31 input_element_clicked_called_ = true; | 33 input_element_clicked_called_ = true; |
32 element_clicked_ = element; | 34 element_clicked_ = element; |
33 was_focused_ = was_focused; | 35 was_focused_ = was_focused; |
34 is_focused_ = is_focused; | 36 is_focused_ = is_focused; |
35 } | 37 } |
36 | 38 |
37 virtual void InputElementLostFocus() OVERRIDE { | 39 virtual void InputElementLostFocus() OVERRIDE { |
38 input_element_lost_focus_called_ = true; | 40 input_element_lost_focus_called_ = true; |
39 } | 41 } |
40 | 42 |
(...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
148 EXPECT_TRUE(test_listener_.input_element_lost_focus_called_); | 150 EXPECT_TRUE(test_listener_.input_element_lost_focus_called_); |
149 test_listener_.ClearResults(); | 151 test_listener_.ClearResults(); |
150 | 152 |
151 // Click on a text field while the button has focus and ensure no lost focus | 153 // Click on a text field while the button has focus and ensure no lost focus |
152 // notification is sent. | 154 // notification is sent. |
153 EXPECT_TRUE(SimulateElementClick("text_1")); | 155 EXPECT_TRUE(SimulateElementClick("text_1")); |
154 EXPECT_FALSE(test_listener_.input_element_lost_focus_called_); | 156 EXPECT_FALSE(test_listener_.input_element_lost_focus_called_); |
155 } | 157 } |
156 | 158 |
157 } // namespace autofill | 159 } // namespace autofill |
OLD | NEW |