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

Side by Side Diff: content/public/test/browser_test_utils.cc

Issue 1852903002: Create an interactive site-per-process browsertest class and move DocumentHasFocus there. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: thestig's comments Created 4 years, 8 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 | « content/public/test/browser_test_utils.h ('k') | no next file » | 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 "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 <utility> 8 #include <utility>
9 9
10 #include "base/auto_reset.h" 10 #include "base/auto_reset.h"
11 #include "base/bind.h" 11 #include "base/bind.h"
12 #include "base/command_line.h" 12 #include "base/command_line.h"
13 #include "base/json/json_reader.h" 13 #include "base/json/json_reader.h"
14 #include "base/macros.h" 14 #include "base/macros.h"
15 #include "base/process/kill.h" 15 #include "base/process/kill.h"
16 #include "base/rand_util.h" 16 #include "base/rand_util.h"
17 #include "base/strings/string_number_conversions.h" 17 #include "base/strings/string_number_conversions.h"
18 #include "base/strings/string_piece.h" 18 #include "base/strings/string_piece.h"
19 #include "base/strings/utf_string_conversions.h" 19 #include "base/strings/utf_string_conversions.h"
20 #include "base/synchronization/waitable_event.h" 20 #include "base/synchronization/waitable_event.h"
21 #include "base/test/test_timeouts.h" 21 #include "base/test/test_timeouts.h"
22 #include "base/values.h" 22 #include "base/values.h"
23 #include "build/build_config.h" 23 #include "build/build_config.h"
24 #include "content/browser/accessibility/accessibility_mode_helper.h" 24 #include "content/browser/accessibility/accessibility_mode_helper.h"
25 #include "content/browser/accessibility/browser_accessibility.h" 25 #include "content/browser/accessibility/browser_accessibility.h"
26 #include "content/browser/accessibility/browser_accessibility_manager.h" 26 #include "content/browser/accessibility/browser_accessibility_manager.h"
27 #include "content/browser/frame_host/frame_tree_node.h"
28 #include "content/browser/frame_host/render_frame_host_impl.h"
27 #include "content/browser/renderer_host/render_widget_host_impl.h" 29 #include "content/browser/renderer_host/render_widget_host_impl.h"
28 #include "content/browser/web_contents/web_contents_impl.h" 30 #include "content/browser/web_contents/web_contents_impl.h"
29 #include "content/browser/web_contents/web_contents_view.h" 31 #include "content/browser/web_contents/web_contents_view.h"
30 #include "content/common/input/synthetic_web_input_event_builders.h" 32 #include "content/common/input/synthetic_web_input_event_builders.h"
31 #include "content/common/input_messages.h" 33 #include "content/common/input_messages.h"
32 #include "content/common/view_messages.h" 34 #include "content/common/view_messages.h"
33 #include "content/public/browser/browser_context.h" 35 #include "content/public/browser/browser_context.h"
34 #include "content/public/browser/histogram_fetcher.h" 36 #include "content/public/browser/histogram_fetcher.h"
35 #include "content/public/browser/navigation_entry.h" 37 #include "content/public/browser/navigation_entry.h"
36 #include "content/public/browser/notification_service.h" 38 #include "content/public/browser/notification_service.h"
(...skipping 700 matching lines...) Expand 10 before | Expand all | Expand 10 after
737 } 739 }
738 740
739 bool FrameIsChildOfMainFrame(RenderFrameHost* frame) { 741 bool FrameIsChildOfMainFrame(RenderFrameHost* frame) {
740 return frame->GetParent() && !frame->GetParent()->GetParent(); 742 return frame->GetParent() && !frame->GetParent()->GetParent();
741 } 743 }
742 744
743 bool FrameHasSourceUrl(const GURL& url, RenderFrameHost* frame) { 745 bool FrameHasSourceUrl(const GURL& url, RenderFrameHost* frame) {
744 return frame->GetLastCommittedURL() == url; 746 return frame->GetLastCommittedURL() == url;
745 } 747 }
746 748
749 RenderFrameHost* ChildFrameAt(RenderFrameHost* frame, size_t index) {
750 RenderFrameHostImpl* rfh = static_cast<RenderFrameHostImpl*>(frame);
751 if (index >= rfh->frame_tree_node()->child_count())
752 return nullptr;
753 return rfh->frame_tree_node()->child_at(index)->current_frame_host();
754 }
755
747 bool ExecuteWebUIResourceTest(WebContents* web_contents, 756 bool ExecuteWebUIResourceTest(WebContents* web_contents,
748 const std::vector<int>& js_resource_ids) { 757 const std::vector<int>& js_resource_ids) {
749 // Inject WebUI test runner script first prior to other scripts required to 758 // Inject WebUI test runner script first prior to other scripts required to
750 // run the test as scripts may depend on it being declared. 759 // run the test as scripts may depend on it being declared.
751 std::vector<int> ids; 760 std::vector<int> ids;
752 ids.push_back(IDR_WEBUI_JS_WEBUI_RESOURCE_TEST); 761 ids.push_back(IDR_WEBUI_JS_WEBUI_RESOURCE_TEST);
753 ids.insert(ids.end(), js_resource_ids.begin(), js_resource_ids.end()); 762 ids.insert(ids.end(), js_resource_ids.begin(), js_resource_ids.end());
754 763
755 std::string script; 764 std::string script;
756 for (std::vector<int>::iterator iter = ids.begin(); 765 for (std::vector<int>::iterator iter = ids.begin();
(...skipping 460 matching lines...) Expand 10 before | Expand all | Expand 10 after
1217 DCHECK_CURRENTLY_ON(BrowserThread::UI); 1226 DCHECK_CURRENTLY_ON(BrowserThread::UI);
1218 if (ack_result_ != INPUT_EVENT_ACK_STATE_UNKNOWN) 1227 if (ack_result_ != INPUT_EVENT_ACK_STATE_UNKNOWN)
1219 return ack_result_; 1228 return ack_result_;
1220 base::RunLoop run_loop; 1229 base::RunLoop run_loop;
1221 base::AutoReset<base::Closure> reset_quit(&quit_, run_loop.QuitClosure()); 1230 base::AutoReset<base::Closure> reset_quit(&quit_, run_loop.QuitClosure());
1222 run_loop.Run(); 1231 run_loop.Run();
1223 return ack_result_; 1232 return ack_result_;
1224 } 1233 }
1225 1234
1226 } // namespace content 1235 } // namespace content
OLDNEW
« no previous file with comments | « content/public/test/browser_test_utils.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698