Commit 85757ac8 authored by Yann Dago's avatar Yann Dago Committed by Commit Bot

Fix flakiness of TabsSnapshotTest

When validating the url of some tabs, they were not necessarily loaded.
We now wait for them to be loaded before checks.

Bug: 958893
Change-Id: I17f83ec19c790224fc479632df35769da72b7a5a
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2107060
Commit-Queue: Yann Dago <ydago@chromium.org>
Reviewed-by: default avatarGreg Thompson <grt@chromium.org>
Cr-Commit-Position: refs/heads/master@{#751367}
parent f739ac51
...@@ -39,6 +39,7 @@ ...@@ -39,6 +39,7 @@
#include "components/version_info/version_info.h" #include "components/version_info/version_info.h"
#include "content/public/browser/web_contents.h" #include "content/public/browser/web_contents.h"
#include "content/public/common/referrer.h" #include "content/public/common/referrer.h"
#include "content/public/test/browser_test_utils.h"
#include "testing/gmock/include/gmock/gmock.h" #include "testing/gmock/include/gmock/gmock.h"
#include "testing/gtest/include/gtest/gtest.h" #include "testing/gtest/include/gtest/gtest.h"
#include "ui/base/page_transition_types.h" #include "ui/base/page_transition_types.h"
...@@ -399,10 +400,13 @@ class TabsSnapshotTest : public UserDataSnapshotBrowserTestBase { ...@@ -399,10 +400,13 @@ class TabsSnapshotTest : public UserDataSnapshotBrowserTestBase {
ASSERT_EQ(tab_strip->count(), 2); ASSERT_EQ(tab_strip->count(), 2);
} else { } else {
ASSERT_EQ(tab_strip->count(), 3); ASSERT_EQ(tab_strip->count(), 3);
content::WaitForLoadStop(tab_strip->GetWebContentsAt(2));
EXPECT_EQ(tab_strip->GetWebContentsAt(2)->GetURL(), GURL("about:blank")); EXPECT_EQ(tab_strip->GetWebContentsAt(2)->GetURL(), GURL("about:blank"));
} }
// embedded_test_server() might return a different hostname. // embedded_test_server() might return a different hostname.
content::WaitForLoadStop(tab_strip->GetWebContentsAt(0));
EXPECT_EQ(tab_strip->GetWebContentsAt(0)->GetURL().path(), "/title1.html"); EXPECT_EQ(tab_strip->GetWebContentsAt(0)->GetURL().path(), "/title1.html");
content::WaitForLoadStop(tab_strip->GetWebContentsAt(1));
EXPECT_EQ(tab_strip->GetWebContentsAt(1)->GetURL().path(), "/title2.html"); EXPECT_EQ(tab_strip->GetWebContentsAt(1)->GetURL().path(), "/title2.html");
} }
}; };
......
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