OLD | NEW |
---|---|
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 Loading... | |
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)); |
Łukasz Anforowicz
2017/04/27 21:36:32
Given how often the pattern above is used, I wonde
Łukasz Anforowicz
2017/04/27 22:59:28
WDYT about the above? This would simplify the tes
ncarter (slow)
2017/04/27 23:13:35
Should we instead expose a FindFrameByName to web_
| |
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 Loading... | |
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 |
OLD | NEW |