| 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 345 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 356 web_state_->OnNavigationFinished(context.get()); | 356 web_state_->OnNavigationFinished(context.get()); |
| 357 ASSERT_TRUE(observer->did_finish_navigation_info()); | 357 ASSERT_TRUE(observer->did_finish_navigation_info()); |
| 358 EXPECT_EQ(web_state_.get(), | 358 EXPECT_EQ(web_state_.get(), |
| 359 observer->did_finish_navigation_info()->web_state); | 359 observer->did_finish_navigation_info()->web_state); |
| 360 NavigationContext* actual_context = | 360 NavigationContext* actual_context = |
| 361 observer->did_finish_navigation_info()->context.get(); | 361 observer->did_finish_navigation_info()->context.get(); |
| 362 EXPECT_EQ(context->GetUrl(), actual_context->GetUrl()); | 362 EXPECT_EQ(context->GetUrl(), actual_context->GetUrl()); |
| 363 EXPECT_TRUE(PageTransitionTypeIncludingQualifiersIs( | 363 EXPECT_TRUE(PageTransitionTypeIncludingQualifiersIs( |
| 364 context->GetPageTransition(), actual_context->GetPageTransition())); | 364 context->GetPageTransition(), actual_context->GetPageTransition())); |
| 365 EXPECT_FALSE(actual_context->IsSameDocument()); | 365 EXPECT_FALSE(actual_context->IsSameDocument()); |
| 366 EXPECT_FALSE(actual_context->IsPost()); |
| 366 EXPECT_FALSE(actual_context->GetError()); | 367 EXPECT_FALSE(actual_context->GetError()); |
| 367 EXPECT_FALSE(actual_context->GetResponseHeaders()); | 368 EXPECT_FALSE(actual_context->GetResponseHeaders()); |
| 368 | 369 |
| 369 // Test that DidStartNavigation() is called. | 370 // Test that DidStartNavigation() is called. |
| 370 ASSERT_FALSE(observer->did_start_navigation_info()); | 371 ASSERT_FALSE(observer->did_start_navigation_info()); |
| 371 web_state_->OnNavigationStarted(context.get()); | 372 web_state_->OnNavigationStarted(context.get()); |
| 372 ASSERT_TRUE(observer->did_start_navigation_info()); | 373 ASSERT_TRUE(observer->did_start_navigation_info()); |
| 373 EXPECT_EQ(web_state_.get(), observer->did_start_navigation_info()->web_state); | 374 EXPECT_EQ(web_state_.get(), observer->did_start_navigation_info()->web_state); |
| 374 actual_context = observer->did_start_navigation_info()->context.get(); | 375 actual_context = observer->did_start_navigation_info()->context.get(); |
| 375 EXPECT_EQ(context->GetUrl(), actual_context->GetUrl()); | 376 EXPECT_EQ(context->GetUrl(), actual_context->GetUrl()); |
| 376 EXPECT_TRUE(PageTransitionTypeIncludingQualifiersIs( | 377 EXPECT_TRUE(PageTransitionTypeIncludingQualifiersIs( |
| 377 context->GetPageTransition(), actual_context->GetPageTransition())); | 378 context->GetPageTransition(), actual_context->GetPageTransition())); |
| 378 EXPECT_FALSE(actual_context->IsSameDocument()); | 379 EXPECT_FALSE(actual_context->IsSameDocument()); |
| 380 EXPECT_FALSE(actual_context->IsPost()); |
| 379 EXPECT_FALSE(actual_context->GetError()); | 381 EXPECT_FALSE(actual_context->GetError()); |
| 380 EXPECT_FALSE(actual_context->GetResponseHeaders()); | 382 EXPECT_FALSE(actual_context->GetResponseHeaders()); |
| 381 | 383 |
| 382 // Test that NavigationItemsPruned() is called. | 384 // Test that NavigationItemsPruned() is called. |
| 383 ASSERT_FALSE(observer->navigation_items_pruned_info()); | 385 ASSERT_FALSE(observer->navigation_items_pruned_info()); |
| 384 web_state_->OnNavigationItemsPruned(1); | 386 web_state_->OnNavigationItemsPruned(1); |
| 385 ASSERT_TRUE(observer->navigation_items_pruned_info()); | 387 ASSERT_TRUE(observer->navigation_items_pruned_info()); |
| 386 EXPECT_EQ(web_state_.get(), | 388 EXPECT_EQ(web_state_.get(), |
| 387 observer->navigation_items_pruned_info()->web_state); | 389 observer->navigation_items_pruned_info()->web_state); |
| 388 | 390 |
| (...skipping 302 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 691 // Set |created_with_opener| to true and verify that HasOpener() returns true. | 693 // Set |created_with_opener| to true and verify that HasOpener() returns true. |
| 692 WebState::CreateParams params_with_opener = | 694 WebState::CreateParams params_with_opener = |
| 693 WebState::CreateParams(GetBrowserState()); | 695 WebState::CreateParams(GetBrowserState()); |
| 694 params_with_opener.created_with_opener = true; | 696 params_with_opener.created_with_opener = true; |
| 695 std::unique_ptr<WebState> web_state_with_opener = | 697 std::unique_ptr<WebState> web_state_with_opener = |
| 696 WebState::Create(params_with_opener); | 698 WebState::Create(params_with_opener); |
| 697 EXPECT_TRUE(web_state_with_opener->HasOpener()); | 699 EXPECT_TRUE(web_state_with_opener->HasOpener()); |
| 698 } | 700 } |
| 699 | 701 |
| 700 } // namespace web | 702 } // namespace web |
| OLD | NEW |