| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 #import "ios/web/web_state/web_state_impl.h" | 5 #import "ios/web/web_state/web_state_impl.h" |
| 6 | 6 |
| 7 #include <stddef.h> | 7 #include <stddef.h> |
| 8 | 8 |
| 9 #include <memory> | 9 #include <memory> |
| 10 | 10 |
| (...skipping 332 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 343 SetIgnoreRenderProcessCrashesDuringTesting(true); | 343 SetIgnoreRenderProcessCrashesDuringTesting(true); |
| 344 ASSERT_FALSE(observer->render_process_gone_info()); | 344 ASSERT_FALSE(observer->render_process_gone_info()); |
| 345 web_state_->OnRenderProcessGone(); | 345 web_state_->OnRenderProcessGone(); |
| 346 ASSERT_TRUE(observer->render_process_gone_info()); | 346 ASSERT_TRUE(observer->render_process_gone_info()); |
| 347 EXPECT_EQ(web_state_.get(), observer->render_process_gone_info()->web_state); | 347 EXPECT_EQ(web_state_.get(), observer->render_process_gone_info()->web_state); |
| 348 | 348 |
| 349 // Test that DidFinishNavigation() is called. | 349 // Test that DidFinishNavigation() is called. |
| 350 ASSERT_FALSE(observer->did_finish_navigation_info()); | 350 ASSERT_FALSE(observer->did_finish_navigation_info()); |
| 351 const GURL url("http://test"); | 351 const GURL url("http://test"); |
| 352 std::unique_ptr<web::NavigationContext> context = | 352 std::unique_ptr<web::NavigationContext> context = |
| 353 NavigationContextImpl::CreateNavigationContext(web_state_.get(), url); | 353 NavigationContextImpl::CreateNavigationContext( |
| 354 web_state_.get(), url, |
| 355 ui::PageTransition::PAGE_TRANSITION_AUTO_BOOKMARK); |
| 354 web_state_->OnNavigationFinished(context.get()); | 356 web_state_->OnNavigationFinished(context.get()); |
| 355 ASSERT_TRUE(observer->did_finish_navigation_info()); | 357 ASSERT_TRUE(observer->did_finish_navigation_info()); |
| 356 EXPECT_EQ(web_state_.get(), | 358 EXPECT_EQ(web_state_.get(), |
| 357 observer->did_finish_navigation_info()->web_state); | 359 observer->did_finish_navigation_info()->web_state); |
| 358 NavigationContext* actual_context = | 360 NavigationContext* actual_context = |
| 359 observer->did_finish_navigation_info()->context.get(); | 361 observer->did_finish_navigation_info()->context.get(); |
| 360 EXPECT_EQ(context->GetUrl(), actual_context->GetUrl()); | 362 EXPECT_EQ(context->GetUrl(), actual_context->GetUrl()); |
| 363 EXPECT_TRUE(PageTransitionTypeIncludingQualifiersIs( |
| 364 context->GetPageTransition(), actual_context->GetPageTransition())); |
| 361 EXPECT_FALSE(actual_context->IsSameDocument()); | 365 EXPECT_FALSE(actual_context->IsSameDocument()); |
| 362 EXPECT_FALSE(actual_context->GetError()); | 366 EXPECT_FALSE(actual_context->GetError()); |
| 363 EXPECT_FALSE(actual_context->GetResponseHeaders()); | 367 EXPECT_FALSE(actual_context->GetResponseHeaders()); |
| 364 | 368 |
| 365 // Test that DidStartNavigation() is called. | 369 // Test that DidStartNavigation() is called. |
| 366 ASSERT_FALSE(observer->did_start_navigation_info()); | 370 ASSERT_FALSE(observer->did_start_navigation_info()); |
| 367 web_state_->OnNavigationStarted(context.get()); | 371 web_state_->OnNavigationStarted(context.get()); |
| 368 ASSERT_TRUE(observer->did_start_navigation_info()); | 372 ASSERT_TRUE(observer->did_start_navigation_info()); |
| 369 EXPECT_EQ(web_state_.get(), observer->did_start_navigation_info()->web_state); | 373 EXPECT_EQ(web_state_.get(), observer->did_start_navigation_info()->web_state); |
| 370 actual_context = observer->did_start_navigation_info()->context.get(); | 374 actual_context = observer->did_start_navigation_info()->context.get(); |
| 371 EXPECT_EQ(context->GetUrl(), actual_context->GetUrl()); | 375 EXPECT_EQ(context->GetUrl(), actual_context->GetUrl()); |
| 376 EXPECT_TRUE(PageTransitionTypeIncludingQualifiersIs( |
| 377 context->GetPageTransition(), actual_context->GetPageTransition())); |
| 372 EXPECT_FALSE(actual_context->IsSameDocument()); | 378 EXPECT_FALSE(actual_context->IsSameDocument()); |
| 373 EXPECT_FALSE(actual_context->GetError()); | 379 EXPECT_FALSE(actual_context->GetError()); |
| 374 EXPECT_FALSE(actual_context->GetResponseHeaders()); | 380 EXPECT_FALSE(actual_context->GetResponseHeaders()); |
| 375 | 381 |
| 376 // Test that NavigationItemsPruned() is called. | 382 // Test that NavigationItemsPruned() is called. |
| 377 ASSERT_FALSE(observer->navigation_items_pruned_info()); | 383 ASSERT_FALSE(observer->navigation_items_pruned_info()); |
| 378 web_state_->OnNavigationItemsPruned(1); | 384 web_state_->OnNavigationItemsPruned(1); |
| 379 ASSERT_TRUE(observer->navigation_items_pruned_info()); | 385 ASSERT_TRUE(observer->navigation_items_pruned_info()); |
| 380 EXPECT_EQ(web_state_.get(), | 386 EXPECT_EQ(web_state_.get(), |
| 381 observer->navigation_items_pruned_info()->web_state); | 387 observer->navigation_items_pruned_info()->web_state); |
| (...skipping 303 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 685 // Set |created_with_opener| to true and verify that HasOpener() returns true. | 691 // Set |created_with_opener| to true and verify that HasOpener() returns true. |
| 686 WebState::CreateParams params_with_opener = | 692 WebState::CreateParams params_with_opener = |
| 687 WebState::CreateParams(GetBrowserState()); | 693 WebState::CreateParams(GetBrowserState()); |
| 688 params_with_opener.created_with_opener = true; | 694 params_with_opener.created_with_opener = true; |
| 689 std::unique_ptr<WebState> web_state_with_opener = | 695 std::unique_ptr<WebState> web_state_with_opener = |
| 690 WebState::Create(params_with_opener); | 696 WebState::Create(params_with_opener); |
| 691 EXPECT_TRUE(web_state_with_opener->HasOpener()); | 697 EXPECT_TRUE(web_state_with_opener->HasOpener()); |
| 692 } | 698 } |
| 693 | 699 |
| 694 } // namespace web | 700 } // namespace web |
| OLD | NEW |