Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2017 The Chromium Authors. All rights reserved. | 1 // Copyright 2017 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/shared/chrome/browser/tabs/web_state_list.h" | 5 #import "ios/shared/chrome/browser/tabs/web_state_list.h" |
| 6 | 6 |
| 7 #include "base/macros.h" | 7 #include "base/macros.h" |
| 8 #include "base/memory/ptr_util.h" | 8 #include "base/memory/ptr_util.h" |
| 9 #include "base/supports_user_data.h" | 9 #include "base/supports_user_data.h" |
| 10 #import "ios/shared/chrome/browser/tabs/fake_web_state_list_delegate.h" | 10 #import "ios/shared/chrome/browser/tabs/fake_web_state_list_delegate.h" |
| (...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 104 DISALLOW_COPY_AND_ASSIGN(WebStateListTestObserver); | 104 DISALLOW_COPY_AND_ASSIGN(WebStateListTestObserver); |
| 105 }; | 105 }; |
| 106 | 106 |
| 107 // A fake NavigationManager used to test opener-opened relationship in the | 107 // A fake NavigationManager used to test opener-opened relationship in the |
| 108 // WebStateList. | 108 // WebStateList. |
| 109 class FakeNavigationManager : public web::TestNavigationManager { | 109 class FakeNavigationManager : public web::TestNavigationManager { |
| 110 public: | 110 public: |
| 111 FakeNavigationManager() = default; | 111 FakeNavigationManager() = default; |
| 112 | 112 |
| 113 // web::NavigationManager implementation. | 113 // web::NavigationManager implementation. |
| 114 int GetCurrentItemIndex() const override { return current_item_index_; } | |
| 115 | |
| 116 int GetLastCommittedItemIndex() const override { return current_item_index_; } | 114 int GetLastCommittedItemIndex() const override { return current_item_index_; } |
|
kkhorimoto
2017/03/21 23:54:16
As long as you're touching this, can we s/current_
liaoyuke
2017/03/22 18:50:37
Done.
| |
| 117 | 115 |
| 118 bool CanGoBack() const override { return current_item_index_ > 0; } | 116 bool CanGoBack() const override { return current_item_index_ > 0; } |
| 119 | 117 |
| 120 bool CanGoForward() const override { return current_item_index_ < INT_MAX; } | 118 bool CanGoForward() const override { return current_item_index_ < INT_MAX; } |
| 121 | 119 |
| 122 void GoBack() override { | 120 void GoBack() override { |
| 123 DCHECK(CanGoBack()); | 121 DCHECK(CanGoBack()); |
| 124 --current_item_index_; | 122 --current_item_index_; |
| 125 } | 123 } |
| 126 | 124 |
| (...skipping 410 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 537 web_state_list_.GetIndexOfLastWebStateOpenedBy(opener, start_index, | 535 web_state_list_.GetIndexOfLastWebStateOpenedBy(opener, start_index, |
| 538 false)); | 536 false)); |
| 539 | 537 |
| 540 EXPECT_EQ(WebStateList::kInvalidIndex, | 538 EXPECT_EQ(WebStateList::kInvalidIndex, |
| 541 web_state_list_.GetIndexOfNextWebStateOpenedBy(opener, start_index, | 539 web_state_list_.GetIndexOfNextWebStateOpenedBy(opener, start_index, |
| 542 true)); | 540 true)); |
| 543 EXPECT_EQ(WebStateList::kInvalidIndex, | 541 EXPECT_EQ(WebStateList::kInvalidIndex, |
| 544 web_state_list_.GetIndexOfLastWebStateOpenedBy(opener, start_index, | 542 web_state_list_.GetIndexOfLastWebStateOpenedBy(opener, start_index, |
| 545 true)); | 543 true)); |
| 546 } | 544 } |
| OLD | NEW |