Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(47)

Side by Side Diff: ios/web/web_state/navigation_callbacks_inttest.mm

Issue 2910663002: Call WebStateObserver::DidStopLoading for native content reloads. (Closed)
Patch Set: Created 3 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright 2017 The Chromium Authors. All rights reserved. 1 // Copyright 2017 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include <memory> 5 #include <memory>
6 #include <string> 6 #include <string>
7 7
8 #include "base/memory/ptr_util.h" 8 #include "base/memory/ptr_util.h"
9 #include "base/strings/stringprintf.h" 9 #include "base/strings/stringprintf.h"
10 #import "ios/web/public/navigation_item.h" 10 #import "ios/web/public/navigation_item.h"
(...skipping 24 matching lines...) Expand all
35 ASSERT_TRUE(*context); 35 ASSERT_TRUE(*context);
36 EXPECT_EQ(web_state, (*context)->GetWebState()); 36 EXPECT_EQ(web_state, (*context)->GetWebState());
37 EXPECT_EQ(url, (*context)->GetUrl()); 37 EXPECT_EQ(url, (*context)->GetUrl());
38 EXPECT_TRUE( 38 EXPECT_TRUE(
39 PageTransitionCoreTypeIs(ui::PageTransition::PAGE_TRANSITION_TYPED, 39 PageTransitionCoreTypeIs(ui::PageTransition::PAGE_TRANSITION_TYPED,
40 (*context)->GetPageTransition())); 40 (*context)->GetPageTransition()));
41 EXPECT_FALSE((*context)->IsSameDocument()); 41 EXPECT_FALSE((*context)->IsSameDocument());
42 EXPECT_FALSE((*context)->IsPost()); 42 EXPECT_FALSE((*context)->IsPost());
43 EXPECT_FALSE((*context)->GetError()); 43 EXPECT_FALSE((*context)->GetError());
44 ASSERT_FALSE((*context)->GetResponseHeaders()); 44 ASSERT_FALSE((*context)->GetResponseHeaders());
45 ASSERT_TRUE(web_state->IsLoading());
45 NavigationManager* navigation_manager = web_state->GetNavigationManager(); 46 NavigationManager* navigation_manager = web_state->GetNavigationManager();
46 NavigationItem* item = navigation_manager->GetPendingItem(); 47 NavigationItem* item = navigation_manager->GetPendingItem();
47 EXPECT_EQ(url, item->GetURL()); 48 EXPECT_EQ(url, item->GetURL());
48 } 49 }
49 50
50 // Verifies correctness of |NavigationContext| (|arg0|) for new page navigation 51 // Verifies correctness of |NavigationContext| (|arg0|) for new page navigation
51 // passed to |DidFinishNavigation|. Asserts that |NavigationContext| the same as 52 // passed to |DidFinishNavigation|. Asserts that |NavigationContext| the same as
52 // |context|. 53 // |context|.
53 ACTION_P3(VerifyNewPageFinishedContext, web_state, url, context) { 54 ACTION_P3(VerifyNewPageFinishedContext, web_state, url, context) {
54 ASSERT_EQ(*context, arg0); 55 ASSERT_EQ(*context, arg0);
55 EXPECT_EQ(web_state, (*context)->GetWebState()); 56 EXPECT_EQ(web_state, (*context)->GetWebState());
56 ASSERT_TRUE((*context)); 57 ASSERT_TRUE((*context));
57 EXPECT_EQ(web_state, (*context)->GetWebState()); 58 EXPECT_EQ(web_state, (*context)->GetWebState());
58 EXPECT_EQ(url, (*context)->GetUrl()); 59 EXPECT_EQ(url, (*context)->GetUrl());
59 EXPECT_TRUE( 60 EXPECT_TRUE(
60 PageTransitionCoreTypeIs(ui::PageTransition::PAGE_TRANSITION_TYPED, 61 PageTransitionCoreTypeIs(ui::PageTransition::PAGE_TRANSITION_TYPED,
61 (*context)->GetPageTransition())); 62 (*context)->GetPageTransition()));
62 EXPECT_FALSE((*context)->IsSameDocument()); 63 EXPECT_FALSE((*context)->IsSameDocument());
63 EXPECT_FALSE((*context)->IsPost()); 64 EXPECT_FALSE((*context)->IsPost());
64 EXPECT_FALSE((*context)->GetError()); 65 EXPECT_FALSE((*context)->GetError());
65 ASSERT_TRUE((*context)->GetResponseHeaders()); 66 ASSERT_TRUE((*context)->GetResponseHeaders());
66 std::string mime_type; 67 std::string mime_type;
67 (*context)->GetResponseHeaders()->GetMimeType(&mime_type); 68 (*context)->GetResponseHeaders()->GetMimeType(&mime_type);
69 ASSERT_TRUE(web_state->IsLoading());
68 EXPECT_EQ(kExpectedMimeType, mime_type); 70 EXPECT_EQ(kExpectedMimeType, mime_type);
69 NavigationManager* navigation_manager = web_state->GetNavigationManager(); 71 NavigationManager* navigation_manager = web_state->GetNavigationManager();
70 NavigationItem* item = navigation_manager->GetLastCommittedItem(); 72 NavigationItem* item = navigation_manager->GetLastCommittedItem();
71 EXPECT_GT(item->GetTimestamp().ToInternalValue(), 0); 73 EXPECT_GT(item->GetTimestamp().ToInternalValue(), 0);
72 EXPECT_EQ(url, item->GetURL()); 74 EXPECT_EQ(url, item->GetURL());
73 } 75 }
74 76
75 // Verifies correctness of |NavigationContext| (|arg0|) for navigations via POST 77 // Verifies correctness of |NavigationContext| (|arg0|) for navigations via POST
76 // HTTP methods passed to |DidStartNavigation|. Stores |NavigationContext| in 78 // HTTP methods passed to |DidStartNavigation|. Stores |NavigationContext| in
77 // |context| pointer. 79 // |context| pointer.
78 ACTION_P3(VerifyPostStartedContext, web_state, url, context) { 80 ACTION_P3(VerifyPostStartedContext, web_state, url, context) {
79 *context = arg0; 81 *context = arg0;
80 ASSERT_TRUE(*context); 82 ASSERT_TRUE(*context);
81 EXPECT_EQ(web_state, (*context)->GetWebState()); 83 EXPECT_EQ(web_state, (*context)->GetWebState());
82 EXPECT_EQ(url, (*context)->GetUrl()); 84 EXPECT_EQ(url, (*context)->GetUrl());
83 EXPECT_FALSE((*context)->IsSameDocument()); 85 EXPECT_FALSE((*context)->IsSameDocument());
84 EXPECT_TRUE((*context)->IsPost()); 86 EXPECT_TRUE((*context)->IsPost());
85 EXPECT_FALSE((*context)->GetError()); 87 EXPECT_FALSE((*context)->GetError());
86 ASSERT_FALSE((*context)->GetResponseHeaders()); 88 ASSERT_FALSE((*context)->GetResponseHeaders());
89 ASSERT_TRUE(web_state->IsLoading());
87 // TODO(crbug.com/676129): Reload does not create a pending item. Remove this 90 // TODO(crbug.com/676129): Reload does not create a pending item. Remove this
88 // workaround once the bug is fixed. 91 // workaround once the bug is fixed.
89 if (!ui::PageTransitionTypeIncludingQualifiersIs( 92 if (!ui::PageTransitionTypeIncludingQualifiersIs(
90 ui::PageTransition::PAGE_TRANSITION_RELOAD, 93 ui::PageTransition::PAGE_TRANSITION_RELOAD,
91 (*context)->GetPageTransition())) { 94 (*context)->GetPageTransition())) {
92 NavigationManager* navigation_manager = web_state->GetNavigationManager(); 95 NavigationManager* navigation_manager = web_state->GetNavigationManager();
93 NavigationItem* item = navigation_manager->GetPendingItem(); 96 NavigationItem* item = navigation_manager->GetPendingItem();
94 EXPECT_EQ(url, item->GetURL()); 97 EXPECT_EQ(url, item->GetURL());
95 } 98 }
96 } 99 }
97 100
98 // Verifies correctness of |NavigationContext| (|arg0|) for navigations via POST 101 // Verifies correctness of |NavigationContext| (|arg0|) for navigations via POST
99 // HTTP methods passed to |DidFinishNavigation|. Stores |NavigationContext| in 102 // HTTP methods passed to |DidFinishNavigation|. Stores |NavigationContext| in
100 // |context| pointer. 103 // |context| pointer.
101 ACTION_P3(VerifyPostFinishedContext, web_state, url, context) { 104 ACTION_P3(VerifyPostFinishedContext, web_state, url, context) {
102 ASSERT_EQ(*context, arg0); 105 ASSERT_EQ(*context, arg0);
103 EXPECT_EQ(web_state, (*context)->GetWebState()); 106 EXPECT_EQ(web_state, (*context)->GetWebState());
104 ASSERT_TRUE((*context)); 107 ASSERT_TRUE((*context));
105 EXPECT_EQ(web_state, (*context)->GetWebState()); 108 EXPECT_EQ(web_state, (*context)->GetWebState());
106 EXPECT_EQ(url, (*context)->GetUrl()); 109 EXPECT_EQ(url, (*context)->GetUrl());
107 EXPECT_FALSE((*context)->IsSameDocument()); 110 EXPECT_FALSE((*context)->IsSameDocument());
108 EXPECT_TRUE((*context)->IsPost()); 111 EXPECT_TRUE((*context)->IsPost());
109 EXPECT_FALSE((*context)->GetError()); 112 EXPECT_FALSE((*context)->GetError());
113 ASSERT_TRUE(web_state->IsLoading());
110 NavigationManager* navigation_manager = web_state->GetNavigationManager(); 114 NavigationManager* navigation_manager = web_state->GetNavigationManager();
111 NavigationItem* item = navigation_manager->GetLastCommittedItem(); 115 NavigationItem* item = navigation_manager->GetLastCommittedItem();
112 EXPECT_GT(item->GetTimestamp().ToInternalValue(), 0); 116 EXPECT_GT(item->GetTimestamp().ToInternalValue(), 0);
113 EXPECT_EQ(url, item->GetURL()); 117 EXPECT_EQ(url, item->GetURL());
114 } 118 }
115 119
116 // Verifies correctness of |NavigationContext| (|arg0|) for same page navigation 120 // Verifies correctness of |NavigationContext| (|arg0|) for same page navigation
117 // passed to |DidFinishNavigation|. Stores |NavigationContext| in |context| 121 // passed to |DidFinishNavigation|. Stores |NavigationContext| in |context|
118 // pointer. 122 // pointer.
119 ACTION_P4(VerifySameDocumentStartedContext, 123 ACTION_P4(VerifySameDocumentStartedContext,
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
165 ASSERT_TRUE(*context); 169 ASSERT_TRUE(*context);
166 EXPECT_EQ(web_state, (*context)->GetWebState()); 170 EXPECT_EQ(web_state, (*context)->GetWebState());
167 EXPECT_EQ(url, (*context)->GetUrl()); 171 EXPECT_EQ(url, (*context)->GetUrl());
168 EXPECT_TRUE( 172 EXPECT_TRUE(
169 PageTransitionCoreTypeIs(ui::PageTransition::PAGE_TRANSITION_TYPED, 173 PageTransitionCoreTypeIs(ui::PageTransition::PAGE_TRANSITION_TYPED,
170 (*context)->GetPageTransition())); 174 (*context)->GetPageTransition()));
171 EXPECT_FALSE((*context)->IsSameDocument()); 175 EXPECT_FALSE((*context)->IsSameDocument());
172 EXPECT_FALSE((*context)->IsPost()); 176 EXPECT_FALSE((*context)->IsPost());
173 EXPECT_FALSE((*context)->GetError()); 177 EXPECT_FALSE((*context)->GetError());
174 EXPECT_FALSE((*context)->GetResponseHeaders()); 178 EXPECT_FALSE((*context)->GetResponseHeaders());
179 ASSERT_TRUE(web_state->IsLoading());
175 NavigationManager* navigation_manager = web_state->GetNavigationManager(); 180 NavigationManager* navigation_manager = web_state->GetNavigationManager();
176 NavigationItem* item = navigation_manager->GetPendingItem(); 181 NavigationItem* item = navigation_manager->GetPendingItem();
177 EXPECT_EQ(url, item->GetURL()); 182 EXPECT_EQ(url, item->GetURL());
178 } 183 }
179 184
180 // Verifies correctness of |NavigationContext| (|arg0|) for new page navigation 185 // Verifies correctness of |NavigationContext| (|arg0|) for new page navigation
181 // to native URLs passed to |DidFinishNavigation|. Asserts that 186 // to native URLs passed to |DidFinishNavigation|. Asserts that
182 // |NavigationContext| the same as |context|. 187 // |NavigationContext| the same as |context|.
183 ACTION_P3(VerifyNewNativePageFinishedContext, web_state, url, context) { 188 ACTION_P3(VerifyNewNativePageFinishedContext, web_state, url, context) {
184 ASSERT_EQ(*context, arg0); 189 ASSERT_EQ(*context, arg0);
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after
243 EXPECT_GT(item->GetTimestamp().ToInternalValue(), 0); 248 EXPECT_GT(item->GetTimestamp().ToInternalValue(), 0);
244 EXPECT_EQ(url, item->GetURL()); 249 EXPECT_EQ(url, item->GetURL());
245 } 250 }
246 251
247 // Mocks DidFinishNavigation navigation callback. 252 // Mocks DidFinishNavigation navigation callback.
248 class WebStateObserverMock : public WebStateObserver { 253 class WebStateObserverMock : public WebStateObserver {
249 public: 254 public:
250 WebStateObserverMock(WebState* web_state) : WebStateObserver(web_state) {} 255 WebStateObserverMock(WebState* web_state) : WebStateObserver(web_state) {}
251 MOCK_METHOD1(DidStartNavigation, void(NavigationContext* context)); 256 MOCK_METHOD1(DidStartNavigation, void(NavigationContext* context));
252 MOCK_METHOD1(DidFinishNavigation, void(NavigationContext* context)); 257 MOCK_METHOD1(DidFinishNavigation, void(NavigationContext* context));
258 MOCK_METHOD0(DidStartLoading, void());
259 MOCK_METHOD0(DidStopLoading, void());
253 }; 260 };
254 261
255 } // namespace 262 } // namespace
256 263
257 using test::HttpServer; 264 using test::HttpServer;
265 using testing::StrictMock;
258 using testing::_; 266 using testing::_;
259 267
260 // Test fixture for WebStateDelegate::ProvisionalNavigationStarted and 268 // Test fixture for WebStateDelegate::ProvisionalNavigationStarted,
261 // WebStateDelegate::DidFinishNavigation integration tests. 269 // WebStateDelegate::DidFinishNavigation, WebStateDelegate::DidStartLoading and
262 class StartAndFinishNavigationTest : public WebIntTest { 270 // WebStateDelegate::DidStopLoading integration tests.
271 class NavigationCallbacksTest : public WebIntTest {
263 void SetUp() override { 272 void SetUp() override {
264 WebIntTest::SetUp(); 273 WebIntTest::SetUp();
265 observer_ = base::MakeUnique<WebStateObserverMock>(web_state()); 274 observer_ = base::MakeUnique<StrictMock<WebStateObserverMock>>(web_state());
266 } 275 }
267 276
268 protected: 277 protected:
269 std::unique_ptr<WebStateObserverMock> observer_; 278 std::unique_ptr<StrictMock<WebStateObserverMock>> observer_;
270 }; 279 };
271 280
272 // Tests successful navigation to a new page. 281 // Tests successful navigation to a new page.
273 TEST_F(StartAndFinishNavigationTest, NewPageNavigation) { 282 TEST_F(NavigationCallbacksTest, NewPageNavigation) {
274 const GURL url = HttpServer::MakeUrl("http://chromium.test"); 283 const GURL url = HttpServer::MakeUrl("http://chromium.test");
275 std::map<GURL, std::string> responses; 284 std::map<GURL, std::string> responses;
276 responses[url] = "Chromium Test"; 285 responses[url] = "Chromium Test";
277 web::test::SetUpSimpleHttpServer(responses); 286 web::test::SetUpSimpleHttpServer(responses);
278 287
279 // Perform new page navigation. 288 // Perform new page navigation.
280 NavigationContext* context = nullptr; 289 NavigationContext* context = nullptr;
281 EXPECT_CALL(*observer_, DidStartNavigation(_)) 290 EXPECT_CALL(*observer_, DidStartNavigation(_))
282 .WillOnce(VerifyNewPageStartedContext(web_state(), url, &context)); 291 .WillOnce(VerifyNewPageStartedContext(web_state(), url, &context));
292 EXPECT_CALL(*observer_, DidStartLoading());
283 EXPECT_CALL(*observer_, DidFinishNavigation(_)) 293 EXPECT_CALL(*observer_, DidFinishNavigation(_))
284 .WillOnce(VerifyNewPageFinishedContext(web_state(), url, &context)); 294 .WillOnce(VerifyNewPageFinishedContext(web_state(), url, &context));
295 EXPECT_CALL(*observer_, DidStopLoading());
285 LoadUrl(url); 296 LoadUrl(url);
286 } 297 }
287 298
288 // Tests web page reload navigation. 299 // Tests web page reload navigation.
289 TEST_F(StartAndFinishNavigationTest, WebPageReloadNavigation) { 300 TEST_F(NavigationCallbacksTest, WebPageReloadNavigation) {
290 const GURL url = HttpServer::MakeUrl("http://chromium.test"); 301 const GURL url = HttpServer::MakeUrl("http://chromium.test");
291 std::map<GURL, std::string> responses; 302 std::map<GURL, std::string> responses;
292 responses[url] = "Chromium Test"; 303 responses[url] = "Chromium Test";
293 web::test::SetUpSimpleHttpServer(responses); 304 web::test::SetUpSimpleHttpServer(responses);
294 305
295 // Perform new page navigation. 306 // Perform new page navigation.
296 NavigationContext* context = nullptr; 307 NavigationContext* context = nullptr;
297 EXPECT_CALL(*observer_, DidStartNavigation(_)); 308 EXPECT_CALL(*observer_, DidStartNavigation(_));
309 EXPECT_CALL(*observer_, DidStartLoading());
298 EXPECT_CALL(*observer_, DidFinishNavigation(_)); 310 EXPECT_CALL(*observer_, DidFinishNavigation(_));
311 EXPECT_CALL(*observer_, DidStopLoading());
299 LoadUrl(url); 312 LoadUrl(url);
300 313
301 // Reload web page. 314 // Reload web page.
302 EXPECT_CALL(*observer_, DidStartNavigation(_)) 315 EXPECT_CALL(*observer_, DidStartNavigation(_))
303 .WillOnce(VerifyReloadStartedContext(web_state(), url, &context)); 316 .WillOnce(VerifyReloadStartedContext(web_state(), url, &context));
317 EXPECT_CALL(*observer_, DidStartLoading());
304 EXPECT_CALL(*observer_, DidFinishNavigation(_)) 318 EXPECT_CALL(*observer_, DidFinishNavigation(_))
305 .WillOnce(VerifyReloadFinishedContext(web_state(), url, &context, 319 .WillOnce(VerifyReloadFinishedContext(web_state(), url, &context,
306 true /* is_web_page */)); 320 true /* is_web_page */));
321 EXPECT_CALL(*observer_, DidStopLoading());
307 // TODO(crbug.com/700958): ios/web ignores |check_for_repost| flag and current 322 // TODO(crbug.com/700958): ios/web ignores |check_for_repost| flag and current
308 // delegate does not run callback for ShowRepostFormWarningDialog. Clearing 323 // delegate does not run callback for ShowRepostFormWarningDialog. Clearing
309 // the delegate will allow form resubmission. Remove this workaround (clearing 324 // the delegate will allow form resubmission. Remove this workaround (clearing
310 // the delegate, once |check_for_repost| is supported). 325 // the delegate, once |check_for_repost| is supported).
311 web_state()->SetDelegate(nullptr); 326 web_state()->SetDelegate(nullptr);
312 ExecuteBlockAndWaitForLoad(url, ^{ 327 ExecuteBlockAndWaitForLoad(url, ^{
313 navigation_manager()->Reload(ReloadType::NORMAL, 328 navigation_manager()->Reload(ReloadType::NORMAL,
314 false /*check_for_repost*/); 329 false /*check_for_repost*/);
315 }); 330 });
316 } 331 }
317 332
318 // Tests user-initiated hash change. 333 // Tests user-initiated hash change.
319 TEST_F(StartAndFinishNavigationTest, UserInitiatedHashChangeNavigation) { 334 TEST_F(NavigationCallbacksTest, UserInitiatedHashChangeNavigation) {
320 const GURL url = HttpServer::MakeUrl("http://chromium.test"); 335 const GURL url = HttpServer::MakeUrl("http://chromium.test");
321 std::map<GURL, std::string> responses; 336 std::map<GURL, std::string> responses;
322 responses[url] = "Chromium Test"; 337 responses[url] = "Chromium Test";
323 web::test::SetUpSimpleHttpServer(responses); 338 web::test::SetUpSimpleHttpServer(responses);
324 339
325 // Perform new page navigation. 340 // Perform new page navigation.
326 NavigationContext* context = nullptr; 341 NavigationContext* context = nullptr;
327 EXPECT_CALL(*observer_, DidStartNavigation(_)) 342 EXPECT_CALL(*observer_, DidStartNavigation(_))
328 .WillOnce(VerifyNewPageStartedContext(web_state(), url, &context)); 343 .WillOnce(VerifyNewPageStartedContext(web_state(), url, &context));
344 EXPECT_CALL(*observer_, DidStartLoading());
329 EXPECT_CALL(*observer_, DidFinishNavigation(_)) 345 EXPECT_CALL(*observer_, DidFinishNavigation(_))
330 .WillOnce(VerifyNewPageFinishedContext(web_state(), url, &context)); 346 .WillOnce(VerifyNewPageFinishedContext(web_state(), url, &context));
347 EXPECT_CALL(*observer_, DidStopLoading());
331 LoadUrl(url); 348 LoadUrl(url);
332 349
333 // Perform same-page navigation. 350 // Perform same-page navigation.
334 const GURL hash_url = HttpServer::MakeUrl("http://chromium.test#1"); 351 const GURL hash_url = HttpServer::MakeUrl("http://chromium.test#1");
335 EXPECT_CALL(*observer_, DidStartNavigation(_)) 352 EXPECT_CALL(*observer_, DidStartNavigation(_))
336 .WillOnce(VerifySameDocumentStartedContext( 353 .WillOnce(VerifySameDocumentStartedContext(
337 web_state(), hash_url, &context, 354 web_state(), hash_url, &context,
338 ui::PageTransition::PAGE_TRANSITION_TYPED)); 355 ui::PageTransition::PAGE_TRANSITION_TYPED));
356 EXPECT_CALL(*observer_, DidStartLoading());
339 EXPECT_CALL(*observer_, DidFinishNavigation(_)) 357 EXPECT_CALL(*observer_, DidFinishNavigation(_))
340 .WillOnce(VerifySameDocumentFinishedContext( 358 .WillOnce(VerifySameDocumentFinishedContext(
341 web_state(), hash_url, &context, 359 web_state(), hash_url, &context,
342 ui::PageTransition::PAGE_TRANSITION_TYPED)); 360 ui::PageTransition::PAGE_TRANSITION_TYPED));
361 EXPECT_CALL(*observer_, DidStopLoading());
343 LoadUrl(hash_url); 362 LoadUrl(hash_url);
344 363
345 // Perform same-page navigation by going back. 364 // Perform same-page navigation by going back.
346 EXPECT_CALL(*observer_, DidStartNavigation(_)) 365 EXPECT_CALL(*observer_, DidStartNavigation(_))
347 .WillOnce(VerifySameDocumentStartedContext( 366 .WillOnce(VerifySameDocumentStartedContext(
348 web_state(), url, &context, 367 web_state(), url, &context,
349 ui::PageTransition::PAGE_TRANSITION_CLIENT_REDIRECT)); 368 ui::PageTransition::PAGE_TRANSITION_CLIENT_REDIRECT));
369 EXPECT_CALL(*observer_, DidStartLoading());
350 EXPECT_CALL(*observer_, DidFinishNavigation(_)) 370 EXPECT_CALL(*observer_, DidFinishNavigation(_))
351 .WillOnce(VerifySameDocumentFinishedContext( 371 .WillOnce(VerifySameDocumentFinishedContext(
352 web_state(), url, &context, 372 web_state(), url, &context,
353 ui::PageTransition::PAGE_TRANSITION_CLIENT_REDIRECT)); 373 ui::PageTransition::PAGE_TRANSITION_CLIENT_REDIRECT));
374 EXPECT_CALL(*observer_, DidStopLoading());
354 ExecuteBlockAndWaitForLoad(url, ^{ 375 ExecuteBlockAndWaitForLoad(url, ^{
355 navigation_manager()->GoBack(); 376 navigation_manager()->GoBack();
356 }); 377 });
357 } 378 }
358 379
359 // Tests renderer-initiated hash change. 380 // Tests renderer-initiated hash change.
360 TEST_F(StartAndFinishNavigationTest, RendererInitiatedHashChangeNavigation) { 381 TEST_F(NavigationCallbacksTest, RendererInitiatedHashChangeNavigation) {
361 const GURL url = HttpServer::MakeUrl("http://chromium.test"); 382 const GURL url = HttpServer::MakeUrl("http://chromium.test");
362 std::map<GURL, std::string> responses; 383 std::map<GURL, std::string> responses;
363 responses[url] = "Chromium Test"; 384 responses[url] = "Chromium Test";
364 web::test::SetUpSimpleHttpServer(responses); 385 web::test::SetUpSimpleHttpServer(responses);
365 386
366 // Perform new page navigation. 387 // Perform new page navigation.
367 NavigationContext* context = nullptr; 388 NavigationContext* context = nullptr;
368 EXPECT_CALL(*observer_, DidStartNavigation(_)) 389 EXPECT_CALL(*observer_, DidStartNavigation(_))
369 .WillOnce(VerifyNewPageStartedContext(web_state(), url, &context)); 390 .WillOnce(VerifyNewPageStartedContext(web_state(), url, &context));
391 EXPECT_CALL(*observer_, DidStartLoading());
370 EXPECT_CALL(*observer_, DidFinishNavigation(_)) 392 EXPECT_CALL(*observer_, DidFinishNavigation(_))
371 .WillOnce(VerifyNewPageFinishedContext(web_state(), url, &context)); 393 .WillOnce(VerifyNewPageFinishedContext(web_state(), url, &context));
394 EXPECT_CALL(*observer_, DidStopLoading());
372 LoadUrl(url); 395 LoadUrl(url);
373 396
374 // Perform same-page navigation using JavaScript. 397 // Perform same-page navigation using JavaScript.
375 const GURL hash_url = HttpServer::MakeUrl("http://chromium.test#1"); 398 const GURL hash_url = HttpServer::MakeUrl("http://chromium.test#1");
376 EXPECT_CALL(*observer_, DidStartNavigation(_)) 399 EXPECT_CALL(*observer_, DidStartNavigation(_))
377 .WillOnce(VerifySameDocumentStartedContext( 400 .WillOnce(VerifySameDocumentStartedContext(
378 web_state(), hash_url, &context, 401 web_state(), hash_url, &context,
379 ui::PageTransition::PAGE_TRANSITION_CLIENT_REDIRECT)); 402 ui::PageTransition::PAGE_TRANSITION_CLIENT_REDIRECT));
403 EXPECT_CALL(*observer_, DidStartLoading());
380 EXPECT_CALL(*observer_, DidFinishNavigation(_)) 404 EXPECT_CALL(*observer_, DidFinishNavigation(_))
381 .WillOnce(VerifySameDocumentFinishedContext( 405 .WillOnce(VerifySameDocumentFinishedContext(
382 web_state(), hash_url, &context, 406 web_state(), hash_url, &context,
383 ui::PageTransition::PAGE_TRANSITION_CLIENT_REDIRECT)); 407 ui::PageTransition::PAGE_TRANSITION_CLIENT_REDIRECT));
408 EXPECT_CALL(*observer_, DidStopLoading());
384 ExecuteJavaScript(@"window.location.hash = '#1'"); 409 ExecuteJavaScript(@"window.location.hash = '#1'");
385 } 410 }
386 411
387 // Tests state change. 412 // Tests state change.
388 TEST_F(StartAndFinishNavigationTest, StateNavigation) { 413 TEST_F(NavigationCallbacksTest, StateNavigation) {
389 const GURL url = HttpServer::MakeUrl("http://chromium.test"); 414 const GURL url = HttpServer::MakeUrl("http://chromium.test");
390 std::map<GURL, std::string> responses; 415 std::map<GURL, std::string> responses;
391 responses[url] = "Chromium Test"; 416 responses[url] = "Chromium Test";
392 web::test::SetUpSimpleHttpServer(responses); 417 web::test::SetUpSimpleHttpServer(responses);
393 418
394 // Perform new page navigation. 419 // Perform new page navigation.
395 NavigationContext* context = nullptr; 420 NavigationContext* context = nullptr;
396 EXPECT_CALL(*observer_, DidStartNavigation(_)) 421 EXPECT_CALL(*observer_, DidStartNavigation(_))
397 .WillOnce(VerifyNewPageStartedContext(web_state(), url, &context)); 422 .WillOnce(VerifyNewPageStartedContext(web_state(), url, &context));
423 EXPECT_CALL(*observer_, DidStartLoading());
398 EXPECT_CALL(*observer_, DidFinishNavigation(_)) 424 EXPECT_CALL(*observer_, DidFinishNavigation(_))
399 .WillOnce(VerifyNewPageFinishedContext(web_state(), url, &context)); 425 .WillOnce(VerifyNewPageFinishedContext(web_state(), url, &context));
426 EXPECT_CALL(*observer_, DidStopLoading());
400 LoadUrl(url); 427 LoadUrl(url);
401 428
402 // Perform push state using JavaScript. 429 // Perform push state using JavaScript.
403 const GURL push_url = HttpServer::MakeUrl("http://chromium.test/test.html"); 430 const GURL push_url = HttpServer::MakeUrl("http://chromium.test/test.html");
404 EXPECT_CALL(*observer_, DidStartNavigation(_)) 431 EXPECT_CALL(*observer_, DidStartNavigation(_))
405 .WillOnce(VerifySameDocumentStartedContext( 432 .WillOnce(VerifySameDocumentStartedContext(
406 web_state(), push_url, &context, 433 web_state(), push_url, &context,
407 ui::PageTransition::PAGE_TRANSITION_CLIENT_REDIRECT)); 434 ui::PageTransition::PAGE_TRANSITION_CLIENT_REDIRECT));
408 EXPECT_CALL(*observer_, DidFinishNavigation(_)) 435 EXPECT_CALL(*observer_, DidFinishNavigation(_))
409 .WillOnce(VerifySameDocumentFinishedContext( 436 .WillOnce(VerifySameDocumentFinishedContext(
410 web_state(), push_url, &context, 437 web_state(), push_url, &context,
411 ui::PageTransition::PAGE_TRANSITION_CLIENT_REDIRECT)); 438 ui::PageTransition::PAGE_TRANSITION_CLIENT_REDIRECT));
412 ExecuteJavaScript(@"window.history.pushState('', 'Test', 'test.html')"); 439 ExecuteJavaScript(@"window.history.pushState('', 'Test', 'test.html')");
413 440
414 // Perform replace state using JavaScript. 441 // Perform replace state using JavaScript.
415 const GURL replace_url = HttpServer::MakeUrl("http://chromium.test/1.html"); 442 const GURL replace_url = HttpServer::MakeUrl("http://chromium.test/1.html");
416 EXPECT_CALL(*observer_, DidStartNavigation(_)) 443 EXPECT_CALL(*observer_, DidStartNavigation(_))
417 .WillOnce(VerifySameDocumentStartedContext( 444 .WillOnce(VerifySameDocumentStartedContext(
418 web_state(), replace_url, &context, 445 web_state(), replace_url, &context,
419 ui::PageTransition::PAGE_TRANSITION_CLIENT_REDIRECT)); 446 ui::PageTransition::PAGE_TRANSITION_CLIENT_REDIRECT));
420 EXPECT_CALL(*observer_, DidFinishNavigation(_)) 447 EXPECT_CALL(*observer_, DidFinishNavigation(_))
421 .WillOnce(VerifySameDocumentFinishedContext( 448 .WillOnce(VerifySameDocumentFinishedContext(
422 web_state(), replace_url, &context, 449 web_state(), replace_url, &context,
423 ui::PageTransition::PAGE_TRANSITION_CLIENT_REDIRECT)); 450 ui::PageTransition::PAGE_TRANSITION_CLIENT_REDIRECT));
424 ExecuteJavaScript(@"window.history.replaceState('', 'Test', '1.html')"); 451 ExecuteJavaScript(@"window.history.replaceState('', 'Test', '1.html')");
425 } 452 }
426 453
427 // Tests native content navigation. 454 // Tests native content navigation.
428 TEST_F(StartAndFinishNavigationTest, NativeContentNavigation) { 455 TEST_F(NavigationCallbacksTest, NativeContentNavigation) {
429 GURL url(url::SchemeHostPort(kTestNativeContentScheme, "ui", 0).Serialize()); 456 GURL url(url::SchemeHostPort(kTestNativeContentScheme, "ui", 0).Serialize());
430 NavigationContext* context = nullptr; 457 NavigationContext* context = nullptr;
431 EXPECT_CALL(*observer_, DidStartNavigation(_)) 458 EXPECT_CALL(*observer_, DidStartNavigation(_))
432 .WillOnce(VerifyNewNativePageStartedContext(web_state(), url, &context)); 459 .WillOnce(VerifyNewNativePageStartedContext(web_state(), url, &context));
460 EXPECT_CALL(*observer_, DidStartLoading());
433 EXPECT_CALL(*observer_, DidFinishNavigation(_)) 461 EXPECT_CALL(*observer_, DidFinishNavigation(_))
434 .WillOnce(VerifyNewNativePageFinishedContext(web_state(), url, &context)); 462 .WillOnce(VerifyNewNativePageFinishedContext(web_state(), url, &context));
463 EXPECT_CALL(*observer_, DidStopLoading());
435 LoadUrl(url); 464 LoadUrl(url);
436 } 465 }
437 466
438 // Tests native content reload navigation. 467 // Tests native content reload navigation.
439 TEST_F(StartAndFinishNavigationTest, NativeContentReload) { 468 TEST_F(NavigationCallbacksTest, NativeContentReload) {
440 GURL url(url::SchemeHostPort(kTestNativeContentScheme, "ui", 0).Serialize()); 469 GURL url(url::SchemeHostPort(kTestNativeContentScheme, "ui", 0).Serialize());
441 NavigationContext* context = nullptr; 470 NavigationContext* context = nullptr;
442 EXPECT_CALL(*observer_, DidStartNavigation(_)); 471 EXPECT_CALL(*observer_, DidStartNavigation(_));
472 EXPECT_CALL(*observer_, DidStartLoading());
443 EXPECT_CALL(*observer_, DidFinishNavigation(_)); 473 EXPECT_CALL(*observer_, DidFinishNavigation(_));
474 EXPECT_CALL(*observer_, DidStopLoading());
444 LoadUrl(url); 475 LoadUrl(url);
445 476
446 // Reload native content. 477 // Reload native content.
447 EXPECT_CALL(*observer_, DidStartNavigation(_)) 478 EXPECT_CALL(*observer_, DidStartNavigation(_))
448 .WillOnce(VerifyReloadStartedContext(web_state(), url, &context)); 479 .WillOnce(VerifyReloadStartedContext(web_state(), url, &context));
480 EXPECT_CALL(*observer_, DidStartLoading());
449 EXPECT_CALL(*observer_, DidFinishNavigation(_)) 481 EXPECT_CALL(*observer_, DidFinishNavigation(_))
450 .WillOnce(VerifyReloadFinishedContext(web_state(), url, &context, 482 .WillOnce(VerifyReloadFinishedContext(web_state(), url, &context,
451 false /* is_web_page */)); 483 false /* is_web_page */));
484 EXPECT_CALL(*observer_, DidStopLoading());
452 navigation_manager()->Reload(ReloadType::NORMAL, false /*check_for_repost*/); 485 navigation_manager()->Reload(ReloadType::NORMAL, false /*check_for_repost*/);
453 } 486 }
454 487
455 // Tests successful navigation to a new page with post HTTP method. 488 // Tests successful navigation to a new page with post HTTP method.
456 TEST_F(StartAndFinishNavigationTest, UserInitiatedPostNavigation) { 489 TEST_F(NavigationCallbacksTest, UserInitiatedPostNavigation) {
457 const GURL url = HttpServer::MakeUrl("http://chromium.test"); 490 const GURL url = HttpServer::MakeUrl("http://chromium.test");
458 std::map<GURL, std::string> responses; 491 std::map<GURL, std::string> responses;
459 responses[url] = "Chromium Test"; 492 responses[url] = "Chromium Test";
460 web::test::SetUpSimpleHttpServer(responses); 493 web::test::SetUpSimpleHttpServer(responses);
461 494
462 // Perform new page navigation. 495 // Perform new page navigation.
463 NavigationContext* context = nullptr; 496 NavigationContext* context = nullptr;
464 EXPECT_CALL(*observer_, DidStartNavigation(_)) 497 EXPECT_CALL(*observer_, DidStartNavigation(_))
465 .WillOnce(VerifyPostStartedContext(web_state(), url, &context)); 498 .WillOnce(VerifyPostStartedContext(web_state(), url, &context));
499 EXPECT_CALL(*observer_, DidStartLoading());
466 EXPECT_CALL(*observer_, DidFinishNavigation(_)) 500 EXPECT_CALL(*observer_, DidFinishNavigation(_))
467 .WillOnce(VerifyPostFinishedContext(web_state(), url, &context)); 501 .WillOnce(VerifyPostFinishedContext(web_state(), url, &context));
502 EXPECT_CALL(*observer_, DidStopLoading());
468 503
469 // Load request using POST HTTP method. 504 // Load request using POST HTTP method.
470 web::NavigationManager::WebLoadParams params(url); 505 web::NavigationManager::WebLoadParams params(url);
471 params.post_data.reset( 506 params.post_data.reset(
472 [[@"foo" dataUsingEncoding:NSUTF8StringEncoding] retain]); 507 [[@"foo" dataUsingEncoding:NSUTF8StringEncoding] retain]);
473 params.extra_headers.reset([@{ @"Content-Type" : @"text/html" } retain]); 508 params.extra_headers.reset([@{ @"Content-Type" : @"text/html" } retain]);
474 LoadWithParams(params); 509 LoadWithParams(params);
475 } 510 }
476 511
477 // Tests successful navigation to a new page with post HTTP method. 512 // Tests successful navigation to a new page with post HTTP method.
478 TEST_F(StartAndFinishNavigationTest, RendererInitiatedPostNavigation) { 513 TEST_F(NavigationCallbacksTest, RendererInitiatedPostNavigation) {
479 const GURL url = HttpServer::MakeUrl("http://chromium.test"); 514 const GURL url = HttpServer::MakeUrl("http://chromium.test");
480 std::map<GURL, std::string> responses; 515 std::map<GURL, std::string> responses;
481 responses[url] = "<form method='post' id='form'></form>"; 516 responses[url] = "<form method='post' id='form'></form>";
482 web::test::SetUpSimpleHttpServer(responses); 517 web::test::SetUpSimpleHttpServer(responses);
483 518
484 // Perform new page navigation. 519 // Perform new page navigation.
485 NavigationContext* context = nullptr; 520 NavigationContext* context = nullptr;
486 EXPECT_CALL(*observer_, DidStartNavigation(_)); 521 EXPECT_CALL(*observer_, DidStartNavigation(_));
522 EXPECT_CALL(*observer_, DidStartLoading());
487 EXPECT_CALL(*observer_, DidFinishNavigation(_)); 523 EXPECT_CALL(*observer_, DidFinishNavigation(_));
524 EXPECT_CALL(*observer_, DidStopLoading());
488 LoadUrl(url); 525 LoadUrl(url);
489 526
490 // Submit the form using JavaScript. 527 // Submit the form using JavaScript.
491 EXPECT_CALL(*observer_, DidStartNavigation(_)) 528 EXPECT_CALL(*observer_, DidStartNavigation(_))
492 .WillOnce(VerifyPostStartedContext(web_state(), url, &context)); 529 .WillOnce(VerifyPostStartedContext(web_state(), url, &context));
530 EXPECT_CALL(*observer_, DidStartLoading());
493 EXPECT_CALL(*observer_, DidFinishNavigation(_)) 531 EXPECT_CALL(*observer_, DidFinishNavigation(_))
494 .WillOnce(VerifyPostFinishedContext(web_state(), url, &context)); 532 .WillOnce(VerifyPostFinishedContext(web_state(), url, &context));
533 EXPECT_CALL(*observer_, DidStopLoading());
495 ExecuteJavaScript(@"window.document.getElementById('form').submit();"); 534 ExecuteJavaScript(@"window.document.getElementById('form').submit();");
496 } 535 }
497 536
498 // Tests successful reload of a page returned for post request. 537 // Tests successful reload of a page returned for post request.
499 TEST_F(StartAndFinishNavigationTest, ReloadPostNavigation) { 538 TEST_F(NavigationCallbacksTest, ReloadPostNavigation) {
500 const GURL url = HttpServer::MakeUrl("http://chromium.test"); 539 const GURL url = HttpServer::MakeUrl("http://chromium.test");
501 std::map<GURL, std::string> responses; 540 std::map<GURL, std::string> responses;
502 const GURL action = HttpServer::MakeUrl("http://action.test"); 541 const GURL action = HttpServer::MakeUrl("http://action.test");
503 responses[url] = 542 responses[url] =
504 base::StringPrintf("<form method='post' id='form' action='%s'></form>", 543 base::StringPrintf("<form method='post' id='form' action='%s'></form>",
505 action.spec().c_str()); 544 action.spec().c_str());
506 web::test::SetUpSimpleHttpServer(responses); 545 web::test::SetUpSimpleHttpServer(responses);
507 546
508 // Perform new page navigation. 547 // Perform new page navigation.
509 NavigationContext* context = nullptr; 548 NavigationContext* context = nullptr;
510 EXPECT_CALL(*observer_, DidStartNavigation(_)); 549 EXPECT_CALL(*observer_, DidStartNavigation(_));
550 EXPECT_CALL(*observer_, DidStartLoading());
511 EXPECT_CALL(*observer_, DidFinishNavigation(_)); 551 EXPECT_CALL(*observer_, DidFinishNavigation(_));
552 EXPECT_CALL(*observer_, DidStopLoading());
512 LoadUrl(url); 553 LoadUrl(url);
513 554
514 // Submit the form using JavaScript. 555 // Submit the form using JavaScript.
515 EXPECT_CALL(*observer_, DidStartNavigation(_)); 556 EXPECT_CALL(*observer_, DidStartNavigation(_));
557 EXPECT_CALL(*observer_, DidStartLoading());
516 EXPECT_CALL(*observer_, DidFinishNavigation(_)); 558 EXPECT_CALL(*observer_, DidFinishNavigation(_));
559 EXPECT_CALL(*observer_, DidStopLoading());
517 ExecuteBlockAndWaitForLoad(action, ^{ 560 ExecuteBlockAndWaitForLoad(action, ^{
518 ExecuteJavaScript(@"window.document.getElementById('form').submit();"); 561 ExecuteJavaScript(@"window.document.getElementById('form').submit();");
519 }); 562 });
520 563
521 // Reload the page. 564 // Reload the page.
522 EXPECT_CALL(*observer_, DidStartNavigation(_)) 565 EXPECT_CALL(*observer_, DidStartNavigation(_))
523 .WillOnce(VerifyPostStartedContext(web_state(), action, &context)); 566 .WillOnce(VerifyPostStartedContext(web_state(), action, &context));
567 EXPECT_CALL(*observer_, DidStartLoading());
524 EXPECT_CALL(*observer_, DidFinishNavigation(_)) 568 EXPECT_CALL(*observer_, DidFinishNavigation(_))
525 .WillOnce(VerifyPostFinishedContext(web_state(), action, &context)); 569 .WillOnce(VerifyPostFinishedContext(web_state(), action, &context));
570 EXPECT_CALL(*observer_, DidStopLoading());
526 // TODO(crbug.com/700958): ios/web ignores |check_for_repost| flag and current 571 // TODO(crbug.com/700958): ios/web ignores |check_for_repost| flag and current
527 // delegate does not run callback for ShowRepostFormWarningDialog. Clearing 572 // delegate does not run callback for ShowRepostFormWarningDialog. Clearing
528 // the delegate will allow form resubmission. Remove this workaround (clearing 573 // the delegate will allow form resubmission. Remove this workaround (clearing
529 // the delegate, once |check_for_repost| is supported). 574 // the delegate, once |check_for_repost| is supported).
530 web_state()->SetDelegate(nullptr); 575 web_state()->SetDelegate(nullptr);
531 ExecuteBlockAndWaitForLoad(action, ^{ 576 ExecuteBlockAndWaitForLoad(action, ^{
532 navigation_manager()->Reload(ReloadType::NORMAL, 577 navigation_manager()->Reload(ReloadType::NORMAL,
533 false /*check_for_repost*/); 578 false /*check_for_repost*/);
534 }); 579 });
535 } 580 }
536 581
537 // Tests going forward to a page rendered from post response. 582 // Tests going forward to a page rendered from post response.
538 TEST_F(StartAndFinishNavigationTest, ForwardPostNavigation) { 583 TEST_F(NavigationCallbacksTest, ForwardPostNavigation) {
539 const GURL url = HttpServer::MakeUrl("http://chromium.test"); 584 const GURL url = HttpServer::MakeUrl("http://chromium.test");
540 std::map<GURL, std::string> responses; 585 std::map<GURL, std::string> responses;
541 const GURL action = HttpServer::MakeUrl("http://action.test"); 586 const GURL action = HttpServer::MakeUrl("http://action.test");
542 responses[url] = 587 responses[url] =
543 base::StringPrintf("<form method='post' id='form' action='%s'></form>", 588 base::StringPrintf("<form method='post' id='form' action='%s'></form>",
544 action.spec().c_str()); 589 action.spec().c_str());
545 web::test::SetUpSimpleHttpServer(responses); 590 web::test::SetUpSimpleHttpServer(responses);
546 591
547 // Perform new page navigation. 592 // Perform new page navigation.
548 NavigationContext* context = nullptr; 593 NavigationContext* context = nullptr;
549 EXPECT_CALL(*observer_, DidStartNavigation(_)); 594 EXPECT_CALL(*observer_, DidStartNavigation(_));
595 EXPECT_CALL(*observer_, DidStartLoading());
550 EXPECT_CALL(*observer_, DidFinishNavigation(_)); 596 EXPECT_CALL(*observer_, DidFinishNavigation(_));
597 EXPECT_CALL(*observer_, DidStopLoading());
551 LoadUrl(url); 598 LoadUrl(url);
552 599
553 // Submit the form using JavaScript. 600 // Submit the form using JavaScript.
554 EXPECT_CALL(*observer_, DidStartNavigation(_)); 601 EXPECT_CALL(*observer_, DidStartNavigation(_));
602 EXPECT_CALL(*observer_, DidStartLoading());
555 EXPECT_CALL(*observer_, DidFinishNavigation(_)); 603 EXPECT_CALL(*observer_, DidFinishNavigation(_));
604 EXPECT_CALL(*observer_, DidStopLoading());
556 ExecuteBlockAndWaitForLoad(action, ^{ 605 ExecuteBlockAndWaitForLoad(action, ^{
557 ExecuteJavaScript(@"window.document.getElementById('form').submit();"); 606 ExecuteJavaScript(@"window.document.getElementById('form').submit();");
558 }); 607 });
559 608
560 // Go Back. 609 // Go Back.
561 EXPECT_CALL(*observer_, DidStartNavigation(_)); 610 EXPECT_CALL(*observer_, DidStartNavigation(_));
611 EXPECT_CALL(*observer_, DidStartLoading());
562 EXPECT_CALL(*observer_, DidFinishNavigation(_)); 612 EXPECT_CALL(*observer_, DidFinishNavigation(_));
613 EXPECT_CALL(*observer_, DidStopLoading());
563 ExecuteBlockAndWaitForLoad(url, ^{ 614 ExecuteBlockAndWaitForLoad(url, ^{
564 navigation_manager()->GoBack(); 615 navigation_manager()->GoBack();
565 }); 616 });
566 617
567 // Go forward. 618 // Go forward.
568 EXPECT_CALL(*observer_, DidStartNavigation(_)) 619 EXPECT_CALL(*observer_, DidStartNavigation(_))
569 .WillOnce(VerifyPostStartedContext(web_state(), action, &context)); 620 .WillOnce(VerifyPostStartedContext(web_state(), action, &context));
621 EXPECT_CALL(*observer_, DidStartLoading());
570 EXPECT_CALL(*observer_, DidFinishNavigation(_)) 622 EXPECT_CALL(*observer_, DidFinishNavigation(_))
571 .WillOnce(VerifyPostFinishedContext(web_state(), action, &context)); 623 .WillOnce(VerifyPostFinishedContext(web_state(), action, &context));
624 EXPECT_CALL(*observer_, DidStopLoading());
572 // TODO(crbug.com/700958): ios/web ignores |check_for_repost| flag and current 625 // TODO(crbug.com/700958): ios/web ignores |check_for_repost| flag and current
573 // delegate does not run callback for ShowRepostFormWarningDialog. Clearing 626 // delegate does not run callback for ShowRepostFormWarningDialog. Clearing
574 // the delegate will allow form resubmission. Remove this workaround (clearing 627 // the delegate will allow form resubmission. Remove this workaround (clearing
575 // the delegate, once |check_for_repost| is supported). 628 // the delegate, once |check_for_repost| is supported).
576 web_state()->SetDelegate(nullptr); 629 web_state()->SetDelegate(nullptr);
577 ExecuteBlockAndWaitForLoad(action, ^{ 630 ExecuteBlockAndWaitForLoad(action, ^{
578 navigation_manager()->GoForward(); 631 navigation_manager()->GoForward();
579 }); 632 });
580 } 633 }
581 634
582 } // namespace web 635 } // namespace web
OLDNEW
« no previous file with comments | « no previous file | ios/web/web_state/ui/crw_web_controller.mm » ('j') | ios/web/web_state/ui/crw_web_controller.mm » ('J')

Powered by Google App Engine
This is Rietveld 408576698