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

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

Issue 1140013004: Revert of Disable user gesture checking for all autofill browser tests. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 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
« no previous file with comments | « no previous file | chrome/test/base/chrome_render_view_test.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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/command_line.h" 5 #include "base/command_line.h"
6 #include "base/files/file_util.h" 6 #include "base/files/file_util.h"
7 #include "base/strings/stringprintf.h" 7 #include "base/strings/stringprintf.h"
8 #include "base/strings/utf_string_conversions.h" 8 #include "base/strings/utf_string_conversions.h"
9 #include "chrome/test/base/chrome_render_view_test.h" 9 #include "chrome/test/base/chrome_render_view_test.h"
10 #include "chrome/test/base/ui_test_utils.h" 10 #include "chrome/test/base/ui_test_utils.h"
(...skipping 240 matching lines...) Expand 10 before | Expand all | Expand 10 after
251 " <input type='text' id='full_name'/>" 251 " <input type='text' id='full_name'/>"
252 "</form>"); 252 "</form>");
253 253
254 blink::WebInputElement full_name = 254 blink::WebInputElement full_name =
255 GetMainFrame()->document().getElementById("full_name") 255 GetMainFrame()->document().getElementById("full_name")
256 .to<blink::WebInputElement>(); 256 .to<blink::WebInputElement>();
257 while (!full_name.focused()) 257 while (!full_name.focused())
258 GetMainFrame()->view()->advanceFocus(false); 258 GetMainFrame()->view()->advanceFocus(false);
259 259
260 // Not a user gesture, so no IPC message to browser. 260 // Not a user gesture, so no IPC message to browser.
261 DisableUserGestureSimulationForAutofill();
262 full_name.setValue("Alice", true); 261 full_name.setValue("Alice", true);
263 GetMainFrame()->toWebLocalFrame()->autofillClient()->textFieldDidChange( 262 GetMainFrame()->toWebLocalFrame()->autofillClient()->textFieldDidChange(
264 full_name); 263 full_name);
265 base::MessageLoop::current()->RunUntilIdle(); 264 base::MessageLoop::current()->RunUntilIdle();
266 ASSERT_EQ(nullptr, render_thread_->sink().GetFirstMessageMatching( 265 ASSERT_EQ(nullptr, render_thread_->sink().GetFirstMessageMatching(
267 AutofillHostMsg_TextFieldDidChange::ID)); 266 AutofillHostMsg_TextFieldDidChange::ID));
268 267
269 // A user gesture will send a message to the browser. 268 // A user gesture will send a message to the browser.
270 EnableUserGestureSimulationForAutofill();
271 SimulateUserInputChangeForElement(&full_name, "Alice"); 269 SimulateUserInputChangeForElement(&full_name, "Alice");
272 ASSERT_NE(nullptr, render_thread_->sink().GetFirstMessageMatching( 270 ASSERT_NE(nullptr, render_thread_->sink().GetFirstMessageMatching(
273 AutofillHostMsg_TextFieldDidChange::ID)); 271 AutofillHostMsg_TextFieldDidChange::ID));
274 } 272 }
275 273
276 class RequestAutocompleteRendererTest : public AutofillRendererTest { 274 class RequestAutocompleteRendererTest : public AutofillRendererTest {
277 public: 275 public:
278 RequestAutocompleteRendererTest() 276 RequestAutocompleteRendererTest()
279 : invoking_frame_(NULL), sibling_frame_(NULL) {} 277 : invoking_frame_(NULL), sibling_frame_(NULL) {}
280 ~RequestAutocompleteRendererTest() override {} 278 ~RequestAutocompleteRendererTest() override {}
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after
344 }; 342 };
345 343
346 TEST_F(RequestAutocompleteRendererTest, InvokingTwiceOnlyShowsOnce) { 344 TEST_F(RequestAutocompleteRendererTest, InvokingTwiceOnlyShowsOnce) {
347 // Attempting to show the requestAutocomplete dialog again should be ignored. 345 // Attempting to show the requestAutocomplete dialog again should be ignored.
348 invoking_frame_->autofillClient()->didRequestAutocomplete(invoking_form()); 346 invoking_frame_->autofillClient()->didRequestAutocomplete(invoking_form());
349 EXPECT_FALSE(render_thread_->sink().GetFirstMessageMatching( 347 EXPECT_FALSE(render_thread_->sink().GetFirstMessageMatching(
350 AutofillHostMsg_RequestAutocomplete::ID)); 348 AutofillHostMsg_RequestAutocomplete::ID));
351 } 349 }
352 350
353 } // namespace autofill 351 } // namespace autofill
OLDNEW
« no previous file with comments | « no previous file | chrome/test/base/chrome_render_view_test.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698