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

[Nav Experiment] Fix testBrowsingJavaScriptBasedNavigation.

With WKBasedNavigationManager, after the back navigation, the URL has
an extra '#' at the end as a result of the link click.
LegacyNavigationManager reloads the URL on back navigation so doesn't
have this problem. However, the new behavior is consistent with Safari,
Firefox and Blink.

Changed test to check for the content of the first link instead of
looking at the URL.

Bug: 807428
Cq-Include-Trybots: master.tryserver.chromium.mac:ios-simulator-cronet;master.tryserver.chromium.mac:ios-simulator-full-configs
Change-Id: Ia98f5a6f69b3aa322781c4a48cf4a8bef90fad2f
Reviewed-on: https://chromium-review.googlesource.com/896683
Commit-Queue: Danyao Wang <danyao@chromium.org>
Reviewed-by: default avatarEugene But <eugenebut@chromium.org>
Cr-Commit-Position: refs/heads/master@{#533704}
parent 6f902809
......@@ -26,6 +26,7 @@
#include "ios/web/public/test/http_server/data_response_provider.h"
#import "ios/web/public/test/http_server/http_server.h"
#include "ios/web/public/test/http_server/http_server_util.h"
#import "ios/web/public/web_client.h"
#include "net/http/http_response_headers.h"
#include "ui/base/l10n/l10n_util.h"
#include "url/gurl.h"
......@@ -333,8 +334,18 @@ id<GREYMatcher> TabWithTitle(const std::string& tab_title) {
assertWithMatcher:grey_notNil()];
[ChromeEarlGrey goBack];
[[EarlGrey selectElementWithMatcher:OmniboxText(URL.GetContent())]
assertWithMatcher:grey_notNil()];
[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()];
} else {
[[EarlGrey selectElementWithMatcher:OmniboxText(URL.GetContent())]
assertWithMatcher:grey_notNil()];
}
}
// Tests that a link with WebUI URL does not trigger a load. WebUI pages may
......
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