| 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/navigation/navigation_manager_impl.h" | 5 #import "ios/web/navigation/navigation_manager_impl.h" |
| 6 | 6 |
| 7 #include "base/logging.h" | 7 #include "base/logging.h" |
| 8 #import "base/mac/scoped_nsobject.h" | 8 #import "base/mac/scoped_nsobject.h" |
| 9 #import "ios/web/navigation/crw_session_controller+private_constructors.h" | 9 #import "ios/web/navigation/crw_session_controller+private_constructors.h" |
| 10 #import "ios/web/navigation/navigation_manager_delegate.h" | 10 #import "ios/web/navigation/navigation_manager_delegate.h" |
| (...skipping 15 matching lines...) Expand all Loading... |
| 26 WebState* GetWebState() override { return nullptr; } | 26 WebState* GetWebState() override { return nullptr; } |
| 27 }; | 27 }; |
| 28 } // namespace | 28 } // namespace |
| 29 | 29 |
| 30 // Test fixture for NavigationManagerImpl testing. | 30 // Test fixture for NavigationManagerImpl testing. |
| 31 class NavigationManagerTest : public PlatformTest { | 31 class NavigationManagerTest : public PlatformTest { |
| 32 protected: | 32 protected: |
| 33 NavigationManagerTest() : manager_(new NavigationManagerImpl()) { | 33 NavigationManagerTest() : manager_(new NavigationManagerImpl()) { |
| 34 manager_->SetDelegate(&delegate_); | 34 manager_->SetDelegate(&delegate_); |
| 35 manager_->SetBrowserState(&browser_state_); | 35 manager_->SetBrowserState(&browser_state_); |
| 36 controller_.reset([[CRWSessionController alloc] | 36 controller_.reset( |
| 37 initWithBrowserState:&browser_state_ | 37 [[CRWSessionController alloc] initWithBrowserState:&browser_state_]); |
| 38 openedByDOM:NO]); | |
| 39 manager_->SetSessionController(controller_.get()); | 38 manager_->SetSessionController(controller_.get()); |
| 40 } | 39 } |
| 41 CRWSessionController* session_controller() { return controller_.get(); } | 40 CRWSessionController* session_controller() { return controller_.get(); } |
| 42 NavigationManagerImpl* navigation_manager() { return manager_.get(); } | 41 NavigationManagerImpl* navigation_manager() { return manager_.get(); } |
| 43 | 42 |
| 44 private: | 43 private: |
| 45 TestBrowserState browser_state_; | 44 TestBrowserState browser_state_; |
| 46 TestNavigationManagerDelegate delegate_; | 45 TestNavigationManagerDelegate delegate_; |
| 47 std::unique_ptr<NavigationManagerImpl> manager_; | 46 std::unique_ptr<NavigationManagerImpl> manager_; |
| 48 base::scoped_nsobject<CRWSessionController> controller_; | 47 base::scoped_nsobject<CRWSessionController> controller_; |
| (...skipping 543 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 592 GURL("http://www.3.com"), Referrer(), ui::PAGE_TRANSITION_TYPED, | 591 GURL("http://www.3.com"), Referrer(), ui::PAGE_TRANSITION_TYPED, |
| 593 web::NavigationInitiationType::USER_INITIATED); | 592 web::NavigationInitiationType::USER_INITIATED); |
| 594 [session_controller() commitPendingItem]; | 593 [session_controller() commitPendingItem]; |
| 595 web::NavigationItem* item3 = navigation_manager()->GetLastCommittedItem(); | 594 web::NavigationItem* item3 = navigation_manager()->GetLastCommittedItem(); |
| 596 | 595 |
| 597 // Verify that |item2|'s UserAgentType is propagated to |item3|. | 596 // Verify that |item2|'s UserAgentType is propagated to |item3|. |
| 598 EXPECT_EQ(item2->GetUserAgentType(), item3->GetUserAgentType()); | 597 EXPECT_EQ(item2->GetUserAgentType(), item3->GetUserAgentType()); |
| 599 } | 598 } |
| 600 | 599 |
| 601 } // namespace web | 600 } // namespace web |
| OLD | NEW |