Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(10)

Side by Side Diff: ios/web/public/test/fakes/test_navigation_manager.mm

Issue 2766063002: Remove the concept of currentItemIndex (Closed)
Patch Set: fix unit tests Created 3 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « ios/web/public/test/fakes/test_navigation_manager.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 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/public/test/fakes/test_navigation_manager.h" 5 #import "ios/web/public/test/fakes/test_navigation_manager.h"
6 6
7 namespace web { 7 namespace web {
8 8
9 TestNavigationManager::TestNavigationManager() 9 TestNavigationManager::TestNavigationManager()
10 : items_index_(-1), 10 : items_index_(-1),
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after
72 } 72 }
73 73
74 int TestNavigationManager::GetItemCount() const { 74 int TestNavigationManager::GetItemCount() const {
75 return items_.size(); 75 return items_.size();
76 } 76 }
77 77
78 web::NavigationItem* TestNavigationManager::GetItemAtIndex(size_t index) const { 78 web::NavigationItem* TestNavigationManager::GetItemAtIndex(size_t index) const {
79 return items_[index].get(); 79 return items_[index].get();
80 } 80 }
81 81
82 int TestNavigationManager::GetCurrentItemIndex() const { 82 void TestNavigationManager::SetLastCommittedItemIndex(const int index) {
83 return items_index_;
84 }
85
86 void TestNavigationManager::SetCurrentItemIndex(const int index) {
87 DCHECK(index == -1 || index >= 0 && index < GetItemCount()); 83 DCHECK(index == -1 || index >= 0 && index < GetItemCount());
88 items_index_ = index; 84 items_index_ = index;
89 } 85 }
90 86
91 int TestNavigationManager::GetLastCommittedItemIndex() const { 87 int TestNavigationManager::GetLastCommittedItemIndex() const {
92 NOTREACHED(); 88 return items_index_;
93 return 0;
94 } 89 }
95 90
96 int TestNavigationManager::GetPendingItemIndex() const { 91 int TestNavigationManager::GetPendingItemIndex() const {
97 NOTREACHED(); 92 NOTREACHED();
98 return 0; 93 return 0;
99 } 94 }
100 95
101 bool TestNavigationManager::RemoveItemAtIndex(int index) { 96 bool TestNavigationManager::RemoveItemAtIndex(int index) {
102 if (index < 0 || index >= GetItemCount()) 97 if (index < 0 || index >= GetItemCount())
103 return false; 98 return false;
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after
164 NOTREACHED(); 159 NOTREACHED();
165 } 160 }
166 161
167 // Adds a new navigation item of |transition| type at the end of this 162 // Adds a new navigation item of |transition| type at the end of this
168 // navigation manager. 163 // navigation manager.
169 void TestNavigationManager::AddItem(const GURL& url, 164 void TestNavigationManager::AddItem(const GURL& url,
170 ui::PageTransition transition) { 165 ui::PageTransition transition) {
171 items_.push_back(web::NavigationItem::Create()); 166 items_.push_back(web::NavigationItem::Create());
172 items_.back()->SetTransitionType(transition); 167 items_.back()->SetTransitionType(transition);
173 items_.back()->SetURL(url); 168 items_.back()->SetURL(url);
174 SetCurrentItemIndex(GetItemCount() - 1); 169 SetLastCommittedItemIndex(GetItemCount() - 1);
175 } 170 }
176 171
177 } // namespace web 172 } // namespace web
OLDNEW
« no previous file with comments | « ios/web/public/test/fakes/test_navigation_manager.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698