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

Side by Side Diff: chrome/renderer/autofill/page_click_tracker_browsertest.cc

Issue 165233003: Replace WebDocument::focusedNode to focusedElement (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebased with latest Created 6 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
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/content/renderer/page_click_listener.h" 6 #include "components/autofill/content/renderer/page_click_listener.h"
7 #include "components/autofill/content/renderer/page_click_tracker.h" 7 #include "components/autofill/content/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"
(...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after
120 EXPECT_TRUE(text_ == test_listener_.element_clicked_); 120 EXPECT_TRUE(text_ == test_listener_.element_clicked_);
121 test_listener_.ClearResults(); 121 test_listener_.ClearResults();
122 122
123 // Click the button, no notification should happen (this is not a text-input). 123 // Click the button, no notification should happen (this is not a text-input).
124 EXPECT_TRUE(SimulateElementClick("button")); 124 EXPECT_TRUE(SimulateElementClick("button"));
125 EXPECT_FALSE(test_listener_.input_element_clicked_called_); 125 EXPECT_FALSE(test_listener_.input_element_clicked_called_);
126 } 126 }
127 127
128 TEST_F(PageClickTrackerTest, PageClickTrackerInputFocusLost) { 128 TEST_F(PageClickTrackerTest, PageClickTrackerInputFocusLost) {
129 // Gain focus on the text field by using tab. 129 // Gain focus on the text field by using tab.
130 EXPECT_NE(text_, text_.document().focusedNode()); 130 EXPECT_NE(text_, text_.document().focusedElement());
131 SendKeyPress(ui::VKEY_TAB); 131 SendKeyPress(ui::VKEY_TAB);
132 EXPECT_EQ(text_, text_.document().focusedNode()); 132 EXPECT_EQ(text_, text_.document().focusedElement());
133 EXPECT_FALSE(test_listener_.input_element_lost_focus_called_); 133 EXPECT_FALSE(test_listener_.input_element_lost_focus_called_);
134 134
135 // Click a button and ensure that the lost focus notification was sent, 135 // Click a button and ensure that the lost focus notification was sent,
136 // even though focus was gained without the mouse. 136 // even though focus was gained without the mouse.
137 EXPECT_TRUE(SimulateElementClick("button")); 137 EXPECT_TRUE(SimulateElementClick("button"));
138 EXPECT_TRUE(test_listener_.input_element_lost_focus_called_); 138 EXPECT_TRUE(test_listener_.input_element_lost_focus_called_);
139 test_listener_.ClearResults(); 139 test_listener_.ClearResults();
140 140
141 // Click a text field and test that no lost focus notifications are sent. 141 // Click a text field and test that no lost focus notifications are sent.
142 EXPECT_TRUE(SimulateElementClick("text_1")); 142 EXPECT_TRUE(SimulateElementClick("text_1"));
(...skipping 12 matching lines...) Expand all
155 EXPECT_TRUE(test_listener_.input_element_lost_focus_called_); 155 EXPECT_TRUE(test_listener_.input_element_lost_focus_called_);
156 test_listener_.ClearResults(); 156 test_listener_.ClearResults();
157 157
158 // Click on a text field while the button has focus and ensure no lost focus 158 // Click on a text field while the button has focus and ensure no lost focus
159 // notification is sent. 159 // notification is sent.
160 EXPECT_TRUE(SimulateElementClick("text_1")); 160 EXPECT_TRUE(SimulateElementClick("text_1"));
161 EXPECT_FALSE(test_listener_.input_element_lost_focus_called_); 161 EXPECT_FALSE(test_listener_.input_element_lost_focus_called_);
162 } 162 }
163 163
164 } // namespace autofill 164 } // namespace autofill
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698