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 @@ ...@@ -35,6 +35,7 @@
using chrome_test_util::GetOriginalBrowserState; using chrome_test_util::GetOriginalBrowserState;
using chrome_test_util::OmniboxText; using chrome_test_util::OmniboxText;
using chrome_test_util::OmniboxContainingText;
using chrome_test_util::TapWebViewElementWithId; using chrome_test_util::TapWebViewElementWithId;
namespace { namespace {
...@@ -338,11 +339,15 @@ id<GREYMatcher> TabWithTitle(const std::string& tab_title) { ...@@ -338,11 +339,15 @@ id<GREYMatcher> TabWithTitle(const std::string& tab_title) {
[ChromeEarlGrey waitForWebViewContainingText:"Link"]; [ChromeEarlGrey waitForWebViewContainingText:"Link"];
if (web::GetWebClient()->IsSlimNavigationManagerEnabled()) { if (web::GetWebClient()->IsSlimNavigationManagerEnabled()) {
// Due to the link click, URL of the first page now has an extra '#'. This // Using partial match for Omnibox text because the displayed URL is now
// is consistent with all other browsers. // "http://origin/#" due to the link click. This is consistent with all
const GURL newURL = web::test::HttpServer::MakeUrl("http://origin#"); // other browsers.
[[EarlGrey selectElementWithMatcher:OmniboxText(newURL.GetContent())] [[EarlGrey selectElementWithMatcher:chrome_test_util::Omnibox()]
assertWithMatcher:grey_notNil()]; 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 { } else {
[[EarlGrey selectElementWithMatcher:OmniboxText(URL.GetContent())] [[EarlGrey selectElementWithMatcher:OmniboxText(URL.GetContent())]
assertWithMatcher:grey_notNil()]; 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