| 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 10 matching lines...) Expand all Loading... |
| 21 void OnNavigationItemsPruned(size_t pruned_item_count) override {} | 21 void OnNavigationItemsPruned(size_t pruned_item_count) override {} |
| 22 void OnNavigationItemChanged() override{}; | 22 void OnNavigationItemChanged() override{}; |
| 23 void OnNavigationItemCommitted(const LoadCommittedDetails&) override {} | 23 void OnNavigationItemCommitted(const LoadCommittedDetails&) override {} |
| 24 WebState* GetWebState() override { return nullptr; } | 24 WebState* GetWebState() override { return nullptr; } |
| 25 }; | 25 }; |
| 26 } // namespace | 26 } // namespace |
| 27 | 27 |
| 28 // Test fixture for NavigationManagerImpl testing. | 28 // Test fixture for NavigationManagerImpl testing. |
| 29 class NavigationManagerTest : public PlatformTest { | 29 class NavigationManagerTest : public PlatformTest { |
| 30 protected: | 30 protected: |
| 31 NavigationManagerTest() : manager_(new NavigationManagerImpl()) { | 31 NavigationManagerTest() |
| 32 manager_->SetDelegate(&delegate_); | 32 : manager_(new NavigationManagerImpl(&delegate_, &browser_state_)) { |
| 33 manager_->SetBrowserState(&browser_state_); | |
| 34 controller_.reset([[CRWSessionController alloc] | 33 controller_.reset([[CRWSessionController alloc] |
| 35 initWithWindowName:nil | 34 initWithWindowName:nil |
| 36 openerId:nil | 35 openerId:nil |
| 37 openedByDOM:NO | 36 openedByDOM:NO |
| 38 openerNavigationIndex:0 | 37 openerNavigationIndex:0 |
| 39 browserState:&browser_state_]); | 38 browserState:&browser_state_]); |
| 40 manager_->SetSessionController(controller_.get()); | 39 manager_->SetSessionController(controller_.get()); |
| 41 } | 40 } |
| 42 CRWSessionController* session_controller() { return controller_.get(); } | 41 CRWSessionController* session_controller() { return controller_.get(); } |
| 43 NavigationManagerImpl* navigation_manager() { return manager_.get(); } | 42 NavigationManagerImpl* navigation_manager() { return manager_.get(); } |
| (...skipping 479 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 523 [session_controller() goToEntryAtIndex:0]; | 522 [session_controller() goToEntryAtIndex:0]; |
| 524 [session_controller() setPendingEntryIndex:1]; | 523 [session_controller() setPendingEntryIndex:1]; |
| 525 ASSERT_EQ(3, navigation_manager()->GetItemCount()); | 524 ASSERT_EQ(3, navigation_manager()->GetItemCount()); |
| 526 ASSERT_EQ(0, navigation_manager()->GetCurrentItemIndex()); | 525 ASSERT_EQ(0, navigation_manager()->GetCurrentItemIndex()); |
| 527 ASSERT_EQ(1, navigation_manager()->GetPendingItemIndex()); | 526 ASSERT_EQ(1, navigation_manager()->GetPendingItemIndex()); |
| 528 EXPECT_EQ(2, navigation_manager()->GetIndexForOffset(1)); | 527 EXPECT_EQ(2, navigation_manager()->GetIndexForOffset(1)); |
| 529 EXPECT_EQ(0, navigation_manager()->GetIndexForOffset(-1)); | 528 EXPECT_EQ(0, navigation_manager()->GetIndexForOffset(-1)); |
| 530 } | 529 } |
| 531 | 530 |
| 532 } // namespace web | 531 } // namespace web |
| OLD | NEW |