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

Side by Side Diff: chrome/browser/autofill/autofill_interactive_uitest.cc

Issue 2849603005: Do not reinvent the wheel / use content APIs to find a frame by name. (Closed)
Patch Set: Making the return statement in FrameMatchingPredicate safe against null dereferencing. Created 3 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/browser/subresource_filter/subresource_filter_browsertest.cc » ('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) 2013 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2013 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 <string> 5 #include <string>
6 6
7 #include "base/command_line.h" 7 #include "base/command_line.h"
8 #include "base/files/file_util.h" 8 #include "base/files/file_util.h"
9 #include "base/macros.h" 9 #include "base/macros.h"
10 #include "base/memory/ref_counted.h" 10 #include "base/memory/ref_counted.h"
(...skipping 197 matching lines...) Expand 10 before | Expand all | Expand 10 after
208 bool waiting_for_text_change_; 208 bool waiting_for_text_change_;
209 209
210 DISALLOW_COPY_AND_ASSIGN(AutofillManagerTestDelegateImpl); 210 DISALLOW_COPY_AND_ASSIGN(AutofillManagerTestDelegateImpl);
211 }; 211 };
212 212
213 // Searches all frames of |web_contents| and returns one called |name|. If 213 // Searches all frames of |web_contents| and returns one called |name|. If
214 // there are none, returns null, if there are more, returns an arbitrary one. 214 // there are none, returns null, if there are more, returns an arbitrary one.
215 content::RenderFrameHost* RenderFrameHostForName( 215 content::RenderFrameHost* RenderFrameHostForName(
216 content::WebContents* web_contents, 216 content::WebContents* web_contents,
217 const std::string& name) { 217 const std::string& name) {
218 for (content::RenderFrameHost* frame : web_contents->GetAllFrames()) { 218 return content::FrameMatchingPredicate(
219 if (frame->GetFrameName() == name) 219 web_contents, base::Bind(&content::FrameMatchesName, name));
220 return frame;
221 }
222 return nullptr;
223 } 220 }
224 221
225 } // namespace 222 } // namespace
226 223
227 // AutofillInteractiveTest ---------------------------------------------------- 224 // AutofillInteractiveTest ----------------------------------------------------
228 225
229 class AutofillInteractiveTest : public InProcessBrowserTest { 226 class AutofillInteractiveTest : public InProcessBrowserTest {
230 protected: 227 protected:
231 AutofillInteractiveTest() : 228 AutofillInteractiveTest() :
232 key_press_event_sink_( 229 key_press_event_sink_(
(...skipping 1627 matching lines...) Expand 10 before | Expand all | Expand 10 after
1860 std::string script_focus( 1857 std::string script_focus(
1861 "window.focus();" 1858 "window.focus();"
1862 "document.getElementById('CREDIT_CARD_NUMBER').focus();"); 1859 "document.getElementById('CREDIT_CARD_NUMBER').focus();");
1863 ASSERT_TRUE(content::ExecuteScript(cross_frame, script_focus)); 1860 ASSERT_TRUE(content::ExecuteScript(cross_frame, script_focus));
1864 1861
1865 // Send an arrow dow keypress in order to trigger the autofill popup. 1862 // Send an arrow dow keypress in order to trigger the autofill popup.
1866 SendKeyToPageAndWait(ui::DomKey::ARROW_DOWN); 1863 SendKeyToPageAndWait(ui::DomKey::ARROW_DOWN);
1867 } 1864 }
1868 1865
1869 } // namespace autofill 1866 } // namespace autofill
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/subresource_filter/subresource_filter_browsertest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698