Commit a6d63b0b authored by Danyao Wang's avatar Danyao Wang Committed by Commit Bot

[Nav Experiment] Fix testBrowsingJavaScriptBasedNavigation again.

The previous attempt of fixing this test (crrev.com/c/896683) did not
end up fixing it because GURL::GetContent() doesn't include the
fragment deliminater. This was not discovered until slimnav is enabled
again on FYI bot.

This CL fixes the issue by looking for a partial match in omnibox URL.

Bug: 807428
Change-Id: Ieea5dc0205edf14b1f7f9c89363a492d0b2c811e
Reviewed-on: https://chromium-review.googlesource.com/c/1334204
Commit-Queue: Danyao Wang <danyao@chromium.org>
Reviewed-by: default avatarEugene But <eugenebut@chromium.org>
Cr-Commit-Position: refs/heads/master@{#607814}
parent 75a7cdfb
......@@ -35,6 +35,7 @@
using chrome_test_util::GetOriginalBrowserState;
using chrome_test_util::OmniboxText;
using chrome_test_util::OmniboxContainingText;
using chrome_test_util::TapWebViewElementWithId;
namespace {
......@@ -338,11 +339,15 @@ id<GREYMatcher> TabWithTitle(const std::string& tab_title) {
[ChromeEarlGrey waitForWebViewContainingText:"Link"];
if (web::GetWebClient()->IsSlimNavigationManagerEnabled()) {
// Due to the link click, URL of the first page now has an extra '#'. This
// is consistent with all other browsers.
const GURL newURL = web::test::HttpServer::MakeUrl("http://origin#");
[[EarlGrey selectElementWithMatcher:OmniboxText(newURL.GetContent())]
assertWithMatcher:grey_notNil()];
// Using partial match for Omnibox text because the displayed URL is now
// "http://origin/#" due to the link click. This is consistent with all
// other browsers.
[[EarlGrey selectElementWithMatcher:chrome_test_util::Omnibox()]
assertWithMatcher:chrome_test_util::OmniboxContainingText(
URL.GetContent())];
GREYAssertEqual(web::test::HttpServer::MakeUrl("http://origin/#"),
chrome_test_util::GetCurrentWebState()->GetVisibleURL(),
@"Unexpected URL after going back");
} else {
[[EarlGrey selectElementWithMatcher:OmniboxText(URL.GetContent())]
assertWithMatcher:grey_notNil()];
......
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