Commit b161f31d authored by Alex Rudenko's avatar Alex Rudenko Committed by Commit Bot

Destroy secondary window in WebTestControlHost after each test

Secondary window was not destroyed after a test so the test
configuration was not properly synchronised with the secondary
renderer process after the first test. As a effect of that,
console messages would be added to the test results for DevTools
test which are configured to ignore console messages.

Fixed: 1122074
Change-Id: I526d95ff7df76c386f766adbd092ef75fa9b27df
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2377713
Commit-Queue: Alex Rudenko <alexrudenko@chromium.org>
Auto-Submit: Alex Rudenko <alexrudenko@chromium.org>
Reviewed-by: default avatardanakj <danakj@chromium.org>
Cr-Commit-Position: refs/heads/master@{#801872}
parent 0786d282
...@@ -610,11 +610,9 @@ bool WebTestControlHost::PrepareForWebTest(const TestInfo& test_info) { ...@@ -610,11 +610,9 @@ bool WebTestControlHost::PrepareForWebTest(const TestInfo& test_info) {
} }
if (is_devtools_js_test) { if (is_devtools_js_test) {
if (!secondary_window_) { secondary_window_ = content::Shell::CreateNewWindow(
secondary_window_ = content::Shell::CreateNewWindow( ShellContentBrowserClient::Get()->browser_context(),
ShellContentBrowserClient::Get()->browser_context(), GURL(url::kAboutBlankURL), nullptr, window_size);
GURL(url::kAboutBlankURL), nullptr, window_size);
}
// This navigates the secondary (devtools inspector) window, and then // This navigates the secondary (devtools inspector) window, and then
// navigates the main window once that has loaded to a devtools html test // navigates the main window once that has loaded to a devtools html test
// page, based on the test url. // page, based on the test url.
...@@ -1675,9 +1673,10 @@ void WebTestControlHost::CloseTestOpenedWindows() { ...@@ -1675,9 +1673,10 @@ void WebTestControlHost::CloseTestOpenedWindows() {
DevToolsAgentHost::DetachAllClients(); DevToolsAgentHost::DetachAllClients();
std::vector<Shell*> open_windows(Shell::windows()); std::vector<Shell*> open_windows(Shell::windows());
for (auto* shell : open_windows) { for (auto* shell : open_windows) {
if (shell != main_window_ && shell != secondary_window_) if (shell != main_window_)
shell->Close(); shell->Close();
} }
secondary_window_ = nullptr;
base::RunLoop().RunUntilIdle(); base::RunLoop().RunUntilIdle();
} }
......
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