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" |
11 #include "ios/web/public/test/test_browser_state.h" | 11 #include "ios/web/public/test/fakes/test_browser_state.h" |
12 #include "testing/gtest/include/gtest/gtest.h" | 12 #include "testing/gtest/include/gtest/gtest.h" |
13 #include "testing/platform_test.h" | 13 #include "testing/platform_test.h" |
14 | 14 |
15 namespace web { | 15 namespace web { |
16 namespace { | 16 namespace { |
17 // Stub class for NavigationManagerDelegate. | 17 // Stub class for NavigationManagerDelegate. |
18 class TestNavigationManagerDelegate : public NavigationManagerDelegate { | 18 class TestNavigationManagerDelegate : public NavigationManagerDelegate { |
19 void GoToIndex(int index) override {} | 19 void GoToIndex(int index) override {} |
20 void LoadURLWithParams(const NavigationManager::WebLoadParams&) override {} | 20 void LoadURLWithParams(const NavigationManager::WebLoadParams&) override {} |
21 void OnNavigationItemsPruned(size_t pruned_item_count) override {} | 21 void OnNavigationItemsPruned(size_t pruned_item_count) override {} |
(...skipping 500 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
522 [session_controller() goToEntryAtIndex:0]; | 522 [session_controller() goToEntryAtIndex:0]; |
523 [session_controller() setPendingEntryIndex:1]; | 523 [session_controller() setPendingEntryIndex:1]; |
524 ASSERT_EQ(3, navigation_manager()->GetItemCount()); | 524 ASSERT_EQ(3, navigation_manager()->GetItemCount()); |
525 ASSERT_EQ(0, navigation_manager()->GetCurrentItemIndex()); | 525 ASSERT_EQ(0, navigation_manager()->GetCurrentItemIndex()); |
526 ASSERT_EQ(1, navigation_manager()->GetPendingItemIndex()); | 526 ASSERT_EQ(1, navigation_manager()->GetPendingItemIndex()); |
527 EXPECT_EQ(2, navigation_manager()->GetIndexForOffset(1)); | 527 EXPECT_EQ(2, navigation_manager()->GetIndexForOffset(1)); |
528 EXPECT_EQ(0, navigation_manager()->GetIndexForOffset(-1)); | 528 EXPECT_EQ(0, navigation_manager()->GetIndexForOffset(-1)); |
529 } | 529 } |
530 | 530 |
531 } // namespace web | 531 } // namespace web |
OLD | NEW |