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

[Nav Experiment] Adjust test expectations for reload inttest.

This fixes WebPageReloadNavigation and NativeContentReload in
navigation_and_load_callbacks_inttest with WKBasedNavigationManager.

Bug: 807428
Cq-Include-Trybots: master.tryserver.chromium.mac:ios-simulator-cronet;master.tryserver.chromium.mac:ios-simulator-full-configs
Change-Id: I04cf18663fed453c8d4093a67fe988298acd87fc
Reviewed-on: https://chromium-review.googlesource.com/1040276Reviewed-by: default avatarEugene But <eugenebut@chromium.org>
Commit-Queue: Danyao Wang <danyao@chromium.org>
Cr-Commit-Position: refs/heads/master@{#555529}
parent 40fa5104
...@@ -367,7 +367,11 @@ ACTION_P4(VerifyReloadStartedContext, web_state, url, context, nav_id) { ...@@ -367,7 +367,11 @@ ACTION_P4(VerifyReloadStartedContext, web_state, url, context, nav_id) {
EXPECT_FALSE((*context)->HasCommitted()); EXPECT_FALSE((*context)->HasCommitted());
EXPECT_FALSE((*context)->IsDownload()); EXPECT_FALSE((*context)->IsDownload());
EXPECT_FALSE((*context)->GetError()); EXPECT_FALSE((*context)->GetError());
EXPECT_TRUE((*context)->IsRendererInitiated()); // TODO(crbug.com/676129): Reload should not be renderer-initiated, but only
// marked so because LegacyNavigationManager doesn't create a pending item.
// WKBasedNavigationManager fixes this problem.
EXPECT_EQ(!web::GetWebClient()->IsSlimNavigationManagerEnabled(),
(*context)->IsRendererInitiated());
EXPECT_FALSE((*context)->GetResponseHeaders()); EXPECT_FALSE((*context)->GetResponseHeaders());
// TODO(crbug.com/676129): Reload does not create a pending item. Check // TODO(crbug.com/676129): Reload does not create a pending item. Check
// pending item once the bug is fixed. The slim navigation manager fixes this // pending item once the bug is fixed. The slim navigation manager fixes this
...@@ -403,7 +407,11 @@ ACTION_P5(VerifyReloadFinishedContext, ...@@ -403,7 +407,11 @@ ACTION_P5(VerifyReloadFinishedContext,
EXPECT_TRUE((*context)->HasCommitted()); EXPECT_TRUE((*context)->HasCommitted());
EXPECT_FALSE((*context)->IsDownload()); EXPECT_FALSE((*context)->IsDownload());
EXPECT_FALSE((*context)->GetError()); EXPECT_FALSE((*context)->GetError());
EXPECT_TRUE((*context)->IsRendererInitiated()); // TODO(crbug.com/676129): Reload should not be renderer-initiated, but only
// marked so because LegacyNavigationManager doesn't create a pending item.
// WKBasedNavigationManager fixes this problem.
EXPECT_EQ(!web::GetWebClient()->IsSlimNavigationManagerEnabled(),
(*context)->IsRendererInitiated());
if (is_web_page) { if (is_web_page) {
ASSERT_TRUE((*context)->GetResponseHeaders()); ASSERT_TRUE((*context)->GetResponseHeaders());
std::string mime_type; std::string mime_type;
...@@ -650,8 +658,13 @@ TEST_F(NavigationAndLoadCallbacksTest, WebPageReloadNavigation) { ...@@ -650,8 +658,13 @@ TEST_F(NavigationAndLoadCallbacksTest, WebPageReloadNavigation) {
// Reload web page. // Reload web page.
NavigationContext* context = nullptr; NavigationContext* context = nullptr;
int32_t nav_id = 0; int32_t nav_id = 0;
EXPECT_CALL(observer_, DidStartLoading(web_state())); if (web::GetWebClient()->IsSlimNavigationManagerEnabled()) {
EXPECT_CALL(*decider_, ShouldAllowRequest(_, _)).WillOnce(Return(true)); EXPECT_CALL(*decider_, ShouldAllowRequest(_, _)).WillOnce(Return(true));
EXPECT_CALL(observer_, DidStartLoading(web_state()));
} else {
EXPECT_CALL(observer_, DidStartLoading(web_state()));
EXPECT_CALL(*decider_, ShouldAllowRequest(_, _)).WillOnce(Return(true));
}
EXPECT_CALL(observer_, DidStartNavigation(web_state(), _)) EXPECT_CALL(observer_, DidStartNavigation(web_state(), _))
.WillOnce( .WillOnce(
VerifyReloadStartedContext(web_state(), url, &context, &nav_id)); VerifyReloadStartedContext(web_state(), url, &context, &nav_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