Commit 05553a68 authored by John Chen's avatar John Chen Committed by Commit Bot

[ChromeDriver] Fix OOPIF test flakiness on Windows

The OOPIF test is flaky on Windows due to issue chromedriver:2198,
which causes ChromeDriver not waiting for frames to fully load.
This CL adds a workaround to that issue.

Change-Id: I87c37a4c756b8a836d7d3861addb54e8bd03e853
Reviewed-on: https://chromium-review.googlesource.com/939905Reviewed-by: default avatarDmitry Gozman <dgozman@chromium.org>
Reviewed-by: default avatarCaleb Rouleau <crouleau@chromium.org>
Commit-Queue: John Chen <johnchen@chromium.org>
Cr-Commit-Position: refs/heads/master@{#539893}
parent 2ae8acd5
...@@ -257,14 +257,20 @@ Status FindElement(int interval_ms, ...@@ -257,14 +257,20 @@ Status FindElement(int interval_ms,
arguments.Append(CreateElement(*root_element_id)); arguments.Append(CreateElement(*root_element_id));
base::TimeTicks start_time = base::TimeTicks::Now(); base::TimeTicks start_time = base::TimeTicks::Now();
int context_retry = 0;
while (true) { while (true) {
std::unique_ptr<base::Value> temp; std::unique_ptr<base::Value> temp;
Status status = web_view->CallFunction( Status status = web_view->CallFunction(
session->GetCurrentFrameId(), script, arguments, &temp); session->GetCurrentFrameId(), script, arguments, &temp);
if (status.IsError()) // A "Cannot find context" error can occur due to transition from in-process
// iFrame to OOPIF. Retry a couple of times.
if (status.IsError() &&
(status.message().find("Cannot find context") == std::string::npos ||
++context_retry > 2)) {
return status; return status;
}
if (!temp->is_none()) { if (temp && !temp->is_none()) {
if (only_one) { if (only_one) {
*value = std::move(temp); *value = std::move(temp);
return Status(kOk); return Status(kOk);
......
...@@ -119,8 +119,6 @@ _OS_SPECIFIC_FILTER['win'] = [ ...@@ -119,8 +119,6 @@ _OS_SPECIFIC_FILTER['win'] = [
'ChromeLogPathCapabilityTest.testChromeLogPath', 'ChromeLogPathCapabilityTest.testChromeLogPath',
# https://bugs.chromium.org/p/chromedriver/issues/detail?id=1945 # https://bugs.chromium.org/p/chromedriver/issues/detail?id=1945
'ChromeDriverTest.testWindowFullScreen', 'ChromeDriverTest.testWindowFullScreen',
# https://bugs.chromium.org/p/chromium/issues/detail?id=746266
'ChromeDriverSiteIsolation.testCanClickOOPIF',
] ]
_OS_SPECIFIC_FILTER['linux'] = [ _OS_SPECIFIC_FILTER['linux'] = [
# Xvfb doesn't support maximization. # Xvfb doesn't support maximization.
...@@ -1663,6 +1661,12 @@ class ChromeDriverSiteIsolation(ChromeDriverBaseTestWithWebServer): ...@@ -1663,6 +1661,12 @@ class ChromeDriverSiteIsolation(ChromeDriverBaseTestWithWebServer):
Note that the Iframe will not be out-of-process if the correct Note that the Iframe will not be out-of-process if the correct
flags are not passed into Chrome. flags are not passed into Chrome.
""" """
if util.GetPlatformName() == 'win':
# https://bugs.chromium.org/p/chromedriver/issues/detail?id=2198
# This test is unreliable on Windows, as FindElement can be called too
# soon, before the child frame is fully loaded. This causes element not
# found error. Add an implicit wait works around this issue.
self._driver.SetTimeout('implicit', 2000)
self._driver.Load(self.GetHttpUrlForFile( self._driver.Load(self.GetHttpUrlForFile(
'/chromedriver/cross_domain_iframe.html')) '/chromedriver/cross_domain_iframe.html'))
a_outer = self._driver.FindElement('tag name', 'a') a_outer = self._driver.FindElement('tag name', 'a')
......
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