Commit 0a08373d authored by Shengfa Lin's avatar Shengfa Lin Committed by Chromium LUCI CQ

[chromedriver] Changed default first tab when Chrome starts

This change assumes that json/list returns chronological order;
the first tab is the newest opened.
ChromeDriver defaults to use the first tab of type page from
json/list; however, this tab could be opened and closed by user,
which could cause ChromeDriver failed to connect to the tab.
Instead, we will use the last tab.

Bug: chromedriver:3690
Change-Id: I813ee6e6802fba122d819fa6232dbf07f2b2cb8d
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2600237Reviewed-by: default avatarJohn Chen <johnchen@chromium.org>
Commit-Queue: Shengfa Lin <shengfa@google.com>
Cr-Commit-Position: refs/heads/master@{#838753}
parent 568936b0
......@@ -52,7 +52,7 @@ Status ChromeImpl::GetWebViewIdForFirstTab(std::string* web_view_id,
if (status.IsError())
return status;
UpdateWebViews(views_info, w3c_compliant);
for (size_t i = 0; i < views_info.GetSize(); ++i) {
for (int i = views_info.GetSize() - 1; i >= 0; --i) {
const WebViewInfo& view = views_info.Get(i);
if (view.type == WebViewInfo::kPage) {
*web_view_id = view.id;
......
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