| 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 }; | 26 }; |
| 27 } // namespace | 27 } // namespace |
| 28 | 28 |
| 29 // Test fixture for NavigationManagerImpl testing. | 29 // Test fixture for NavigationManagerImpl testing. |
| 30 class NavigationManagerTest : public PlatformTest { | 30 class NavigationManagerTest : public PlatformTest { |
| 31 protected: | 31 protected: |
| 32 NavigationManagerTest() : manager_(new NavigationManagerImpl()) { | 32 NavigationManagerTest() : manager_(new NavigationManagerImpl()) { |
| 33 manager_->SetDelegate(&delegate_); | 33 manager_->SetDelegate(&delegate_); |
| 34 manager_->SetBrowserState(&browser_state_); | 34 manager_->SetBrowserState(&browser_state_); |
| 35 controller_.reset([[CRWSessionController alloc] | 35 controller_.reset([[CRWSessionController alloc] |
| 36 initWithWindowName:nil | 36 initWithBrowserState:&browser_state_ |
| 37 openedByDOM:NO | 37 openedByDOM:NO]); |
| 38 browserState:&browser_state_]); | |
| 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 461 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 510 navigation_manager()->OverrideDesktopUserAgentForNextPendingItem(); | 509 navigation_manager()->OverrideDesktopUserAgentForNextPendingItem(); |
| 511 navigation_manager()->AddPendingItem( | 510 navigation_manager()->AddPendingItem( |
| 512 GURL("http://www.url.com"), Referrer(), ui::PAGE_TRANSITION_TYPED, | 511 GURL("http://www.url.com"), Referrer(), ui::PAGE_TRANSITION_TYPED, |
| 513 web::NavigationInitiationType::USER_INITIATED); | 512 web::NavigationInitiationType::USER_INITIATED); |
| 514 [session_controller() commitPendingItem]; | 513 [session_controller() commitPendingItem]; |
| 515 NavigationItem* visible_item = navigation_manager()->GetVisibleItem(); | 514 NavigationItem* visible_item = navigation_manager()->GetVisibleItem(); |
| 516 EXPECT_TRUE(visible_item->IsOverridingUserAgent()); | 515 EXPECT_TRUE(visible_item->IsOverridingUserAgent()); |
| 517 } | 516 } |
| 518 | 517 |
| 519 } // namespace web | 518 } // namespace web |
| OLD | NEW |