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 16 matching lines...) Expand all Loading... |
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 initWithWindowName:nil |
37 openerId:nil | |
38 openedByDOM:NO | 37 openedByDOM:NO |
39 openerNavigationIndex:0 | |
40 browserState:&browser_state_]); | 38 browserState:&browser_state_]); |
41 manager_->SetSessionController(controller_.get()); | 39 manager_->SetSessionController(controller_.get()); |
42 } | 40 } |
43 CRWSessionController* session_controller() { return controller_.get(); } | 41 CRWSessionController* session_controller() { return controller_.get(); } |
44 NavigationManagerImpl* navigation_manager() { return manager_.get(); } | 42 NavigationManagerImpl* navigation_manager() { return manager_.get(); } |
45 | 43 |
46 private: | 44 private: |
47 TestBrowserState browser_state_; | 45 TestBrowserState browser_state_; |
48 TestNavigationManagerDelegate delegate_; | 46 TestNavigationManagerDelegate delegate_; |
49 std::unique_ptr<NavigationManagerImpl> manager_; | 47 std::unique_ptr<NavigationManagerImpl> manager_; |
(...skipping 462 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
512 navigation_manager()->OverrideDesktopUserAgentForNextPendingItem(); | 510 navigation_manager()->OverrideDesktopUserAgentForNextPendingItem(); |
513 navigation_manager()->AddPendingItem( | 511 navigation_manager()->AddPendingItem( |
514 GURL("http://www.url.com"), Referrer(), ui::PAGE_TRANSITION_TYPED, | 512 GURL("http://www.url.com"), Referrer(), ui::PAGE_TRANSITION_TYPED, |
515 web::NavigationInitiationType::USER_INITIATED); | 513 web::NavigationInitiationType::USER_INITIATED); |
516 [session_controller() commitPendingItem]; | 514 [session_controller() commitPendingItem]; |
517 NavigationItem* visible_item = navigation_manager()->GetVisibleItem(); | 515 NavigationItem* visible_item = navigation_manager()->GetVisibleItem(); |
518 EXPECT_TRUE(visible_item->IsOverridingUserAgent()); | 516 EXPECT_TRUE(visible_item->IsOverridingUserAgent()); |
519 } | 517 } |
520 | 518 |
521 } // namespace web | 519 } // namespace web |
OLD | NEW |