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

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

Issue 269893004: Revert 268203 "There are many ways to get it wrong." (Closed) Base URL: svn://svn.chromium.org/chrome/
Patch Set: Created 6 years, 7 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 | Annotate | Revision Log
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 149 matching lines...) Expand 10 before | Expand all | Expand 10 after
160 // even though focus was gained without the mouse. 160 // even though focus was gained without the mouse.
161 EXPECT_TRUE(SimulateElementClick("button")); 161 EXPECT_TRUE(SimulateElementClick("button"));
162 EXPECT_TRUE(test_listener_.form_control_element_lost_focus_called_); 162 EXPECT_TRUE(test_listener_.form_control_element_lost_focus_called_);
163 test_listener_.ClearResults(); 163 test_listener_.ClearResults();
164 164
165 // Click a text field and test that no lost focus notifications are sent. 165 // Click a text field and test that no lost focus notifications are sent.
166 EXPECT_TRUE(SimulateElementClick("text_1")); 166 EXPECT_TRUE(SimulateElementClick("text_1"));
167 EXPECT_FALSE(test_listener_.form_control_element_lost_focus_called_); 167 EXPECT_FALSE(test_listener_.form_control_element_lost_focus_called_);
168 test_listener_.ClearResults(); 168 test_listener_.ClearResults();
169 169
170 // Select another text field to test that the notification for the 170 // Select another text field to test that the notifcation for the
171 // first text field losing focus is sent. 171 // first text field losing focus is sent.
172 EXPECT_TRUE(SimulateElementClick("text_2")); 172 EXPECT_TRUE(SimulateElementClick("text_2"));
173 EXPECT_TRUE(test_listener_.form_control_element_lost_focus_called_); 173 EXPECT_TRUE(test_listener_.form_control_element_lost_focus_called_);
174 test_listener_.ClearResults(); 174 test_listener_.ClearResults();
175 175
176 // Click the button, a notification should happen since a text field has 176 // Click the button, a notification should happen since a text field has
177 // lost focus. 177 // lost focus.
178 EXPECT_TRUE(SimulateElementClick("button")); 178 EXPECT_TRUE(SimulateElementClick("button"));
179 EXPECT_TRUE(test_listener_.form_control_element_lost_focus_called_); 179 EXPECT_TRUE(test_listener_.form_control_element_lost_focus_called_);
180 test_listener_.ClearResults(); 180 test_listener_.ClearResults();
(...skipping 17 matching lines...) Expand all
198 // even though focus was gained without the mouse. 198 // even though focus was gained without the mouse.
199 EXPECT_TRUE(SimulateElementClick("button")); 199 EXPECT_TRUE(SimulateElementClick("button"));
200 EXPECT_TRUE(test_listener_.form_control_element_lost_focus_called_); 200 EXPECT_TRUE(test_listener_.form_control_element_lost_focus_called_);
201 test_listener_.ClearResults(); 201 test_listener_.ClearResults();
202 202
203 // Click a textarea field and test that no lost focus notifications are sent. 203 // Click a textarea field and test that no lost focus notifications are sent.
204 EXPECT_TRUE(SimulateElementClick("textarea_1")); 204 EXPECT_TRUE(SimulateElementClick("textarea_1"));
205 EXPECT_FALSE(test_listener_.form_control_element_lost_focus_called_); 205 EXPECT_FALSE(test_listener_.form_control_element_lost_focus_called_);
206 test_listener_.ClearResults(); 206 test_listener_.ClearResults();
207 207
208 // Select another textarea field to test that the notification for the 208 // Select another textarea field to test that the notifcation for the
209 // first textarea field losing focus is sent. 209 // first textarea field losing focus is sent.
210 EXPECT_TRUE(SimulateElementClick("textarea_2")); 210 EXPECT_TRUE(SimulateElementClick("textarea_2"));
211 EXPECT_TRUE(test_listener_.form_control_element_lost_focus_called_); 211 EXPECT_TRUE(test_listener_.form_control_element_lost_focus_called_);
212 test_listener_.ClearResults(); 212 test_listener_.ClearResults();
213 213
214 // Click the button, a notification should happen since a textarea field has 214 // Click the button, a notification should happen since a textarea field has
215 // lost focus. 215 // lost focus.
216 EXPECT_TRUE(SimulateElementClick("button")); 216 EXPECT_TRUE(SimulateElementClick("button"));
217 EXPECT_TRUE(test_listener_.form_control_element_lost_focus_called_); 217 EXPECT_TRUE(test_listener_.form_control_element_lost_focus_called_);
218 test_listener_.ClearResults(); 218 test_listener_.ClearResults();
219 219
220 // Click on a textarea field while the button has focus and ensure no lost 220 // Click on a textarea field while the button has focus and ensure no lost
221 // focus notification is sent. 221 // focus notification is sent.
222 EXPECT_TRUE(SimulateElementClick("textarea_1")); 222 EXPECT_TRUE(SimulateElementClick("textarea_1"));
223 EXPECT_FALSE(test_listener_.form_control_element_lost_focus_called_); 223 EXPECT_FALSE(test_listener_.form_control_element_lost_focus_called_);
224 } 224 }
225 225
226 } // namespace autofill 226 } // namespace autofill
OLDNEW
« no previous file with comments | « trunk/src/chrome/browser/ui/unload_controller.h ('k') | trunk/src/chrome/renderer/content_settings_observer_browsertest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698