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: content/public/test/browser_test_utils.cc

Issue 2052633002: Extend the ToRenderFrameHost magic to FrameTreeNode* and Shell* (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix induced script bug. Created 4 years, 6 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) 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 "content/public/test/browser_test_utils.h" 5 #include "content/public/test/browser_test_utils.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 #include <tuple> 8 #include <tuple>
9 #include <utility> 9 #include <utility>
10 10
(...skipping 655 matching lines...) Expand 10 before | Expand all | Expand 10 after
666 if (command) { 666 if (command) {
667 modifiers &= ~blink::WebInputEvent::MetaKey; 667 modifiers &= ~blink::WebInputEvent::MetaKey;
668 InjectRawKeyEvent(web_contents, blink::WebInputEvent::KeyUp, 668 InjectRawKeyEvent(web_contents, blink::WebInputEvent::KeyUp,
669 ui::DomKey::META, ui::DomCode::META_LEFT, 669 ui::DomKey::META, ui::DomCode::META_LEFT,
670 ui::VKEY_COMMAND, modifiers); 670 ui::VKEY_COMMAND, modifiers);
671 } 671 }
672 672
673 ASSERT_EQ(modifiers, 0); 673 ASSERT_EQ(modifiers, 0);
674 } 674 }
675 675
676 ToRenderFrameHost::ToRenderFrameHost(WebContents* web_contents) 676 RenderFrameHost* ConvertToRenderFrameHost(WebContents* web_contents) {
677 : render_frame_host_(web_contents->GetMainFrame()) { 677 return web_contents->GetMainFrame();
678 } 678 }
679 679
680 ToRenderFrameHost::ToRenderFrameHost(RenderViewHost* render_view_host) 680 RenderFrameHost* ConvertToRenderFrameHost(RenderViewHost* render_view_host) {
681 : render_frame_host_(render_view_host->GetMainFrame()) { 681 return render_view_host->GetMainFrame();
682 } 682 }
683 683
684 ToRenderFrameHost::ToRenderFrameHost(RenderFrameHost* render_frame_host) 684 RenderFrameHost* ConvertToRenderFrameHost(RenderFrameHost* render_frame_host) {
685 : render_frame_host_(render_frame_host) { 685 return render_frame_host;
686 } 686 }
687 687
688 bool ExecuteScript(const ToRenderFrameHost& adapter, 688 bool ExecuteScript(const ToRenderFrameHost& adapter,
689 const std::string& script) { 689 const std::string& script) {
690 std::string new_script = 690 std::string new_script =
691 script + ";window.domAutomationController.send(0);"; 691 script + ";window.domAutomationController.send(0);";
692 return ExecuteScriptHelper(adapter.render_frame_host(), new_script, NULL); 692 return ExecuteScriptHelper(adapter.render_frame_host(), new_script, NULL);
693 } 693 }
694 694
695 bool ExecuteScriptAndExtractDouble(const ToRenderFrameHost& adapter, 695 bool ExecuteScriptAndExtractDouble(const ToRenderFrameHost& adapter,
(...skipping 578 matching lines...) Expand 10 before | Expand all | Expand 10 after
1274 DCHECK_CURRENTLY_ON(BrowserThread::UI); 1274 DCHECK_CURRENTLY_ON(BrowserThread::UI);
1275 if (ack_result_ != INPUT_EVENT_ACK_STATE_UNKNOWN) 1275 if (ack_result_ != INPUT_EVENT_ACK_STATE_UNKNOWN)
1276 return ack_result_; 1276 return ack_result_;
1277 base::RunLoop run_loop; 1277 base::RunLoop run_loop;
1278 base::AutoReset<base::Closure> reset_quit(&quit_, run_loop.QuitClosure()); 1278 base::AutoReset<base::Closure> reset_quit(&quit_, run_loop.QuitClosure());
1279 run_loop.Run(); 1279 run_loop.Run();
1280 return ack_result_; 1280 return ack_result_;
1281 } 1281 }
1282 1282
1283 } // namespace content 1283 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698