Commit 7091886f authored by Kai Ninomiya's avatar Kai Ninomiya Committed by Commit Bot

Add tracing for content_shell --run-web-tests mode

Bug: 953991
Change-Id: I8174aff1d572a5bb771ff46d96d94ff1b737439a
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2261795
Commit-Queue: Kai Ninomiya <kainino@chromium.org>
Reviewed-by: default avatardanakj <danakj@chromium.org>
Cr-Commit-Position: refs/heads/master@{#785967}
parent 233e84ce
...@@ -52,6 +52,7 @@ namespace { ...@@ -52,6 +52,7 @@ namespace {
bool RunOneTest(const content::TestInfo& test_info, bool RunOneTest(const content::TestInfo& test_info,
content::WebTestControlHost* web_test_control_host, content::WebTestControlHost* web_test_control_host,
content::BrowserMainRunner* main_runner) { content::BrowserMainRunner* main_runner) {
TRACE_EVENT0("shell", "WebTestBrowserMainRunner::RunOneTest");
DCHECK(web_test_control_host); DCHECK(web_test_control_host);
if (!web_test_control_host->PrepareForWebTest(test_info)) if (!web_test_control_host->PrepareForWebTest(test_info))
...@@ -63,6 +64,7 @@ bool RunOneTest(const content::TestInfo& test_info, ...@@ -63,6 +64,7 @@ bool RunOneTest(const content::TestInfo& test_info,
} }
void RunTests(content::BrowserMainRunner* main_runner) { void RunTests(content::BrowserMainRunner* main_runner) {
TRACE_EVENT0("shell", "WebTestBrowserMainRunner::RunTests");
content::WebTestControlHost test_controller; content::WebTestControlHost test_controller;
{ {
// We're outside of the message loop here, and this is a test. // We're outside of the message loop here, and this is a test.
......
...@@ -520,6 +520,7 @@ WebTestControlHost::~WebTestControlHost() { ...@@ -520,6 +520,7 @@ WebTestControlHost::~WebTestControlHost() {
} }
bool WebTestControlHost::PrepareForWebTest(const TestInfo& test_info) { bool WebTestControlHost::PrepareForWebTest(const TestInfo& test_info) {
TRACE_EVENT0("shell", "WebTestControlHost::PrepareForWebTest");
DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_); DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_);
current_working_directory_ = test_info.current_working_directory; current_working_directory_ = test_info.current_working_directory;
expected_pixel_hash_ = test_info.expected_pixel_hash; expected_pixel_hash_ = test_info.expected_pixel_hash;
...@@ -555,6 +556,8 @@ bool WebTestControlHost::PrepareForWebTest(const TestInfo& test_info) { ...@@ -555,6 +556,8 @@ bool WebTestControlHost::PrepareForWebTest(const TestInfo& test_info) {
RenderViewHost* main_render_view_host = nullptr; RenderViewHost* main_render_view_host = nullptr;
if (!main_window_) { if (!main_window_) {
TRACE_EVENT0("shell",
"WebTestControlHost::PrepareForWebTest::CreateMainWindow");
main_window_ = content::Shell::CreateNewWindow( main_window_ = content::Shell::CreateNewWindow(
browser_context, GURL(url::kAboutBlankURL), nullptr, window_size); browser_context, GURL(url::kAboutBlankURL), nullptr, window_size);
WebContentsObserver::Observe(main_window_->web_contents()); WebContentsObserver::Observe(main_window_->web_contents());
...@@ -599,13 +602,16 @@ bool WebTestControlHost::PrepareForWebTest(const TestInfo& test_info) { ...@@ -599,13 +602,16 @@ bool WebTestControlHost::PrepareForWebTest(const TestInfo& test_info) {
// headless mode. // headless mode.
main_window_->ActivateContents(main_window_->web_contents()); main_window_->ActivateContents(main_window_->web_contents());
// Round-trip through the InputHandler mojom interface to the compositor {
// thread, in order to ensure that any input events (moving the mouse at the TRACE_EVENT0("shell", "WebTestControlHost::PrepareForWebTest::Flush");
// start of the test, focus coming from ActivateContents() above, etc) are // Round-trip through the InputHandler mojom interface to the compositor
// handled and bounced if appropriate to the main thread, before we continue // thread, in order to ensure that any input events (moving the mouse at the
// and start the test. This will ensure they are handled on the main thread // start of the test, focus coming from ActivateContents() above, etc) are
// before the test runs, which would otherwise race against them. // handled and bounced if appropriate to the main thread, before we continue
main_render_view_host->GetWidget()->FlushForTesting(); // and start the test. This will ensure they are handled on the main thread
// before the test runs, which would otherwise race against them.
main_render_view_host->GetWidget()->FlushForTesting();
}
if (is_devtools_js_test) { if (is_devtools_js_test) {
if (!secondary_window_) { if (!secondary_window_) {
...@@ -639,6 +645,7 @@ bool WebTestControlHost::PrepareForWebTest(const TestInfo& test_info) { ...@@ -639,6 +645,7 @@ bool WebTestControlHost::PrepareForWebTest(const TestInfo& test_info) {
} }
bool WebTestControlHost::ResetBrowserAfterWebTest() { bool WebTestControlHost::ResetBrowserAfterWebTest() {
TRACE_EVENT0("shell", "WebTestControlHost::ResetBrowserAfterWebTest");
DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_); DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_);
// Close any windows opened by the test to avoid them polluting the next // Close any windows opened by the test to avoid them polluting the next
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment