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

Unified Diff: ios/chrome/browser/reading_list/reading_list_web_state_observer_unittest.mm

Issue 2762113002: Reading List iOS: Adapt loading offline for new reload process (Closed)
Patch Set: rebase 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 side-by-side diff with in-line comments
Download patch
Index: ios/chrome/browser/reading_list/reading_list_web_state_observer_unittest.mm
diff --git a/ios/chrome/browser/reading_list/reading_list_web_state_observer_unittest.mm b/ios/chrome/browser/reading_list/reading_list_web_state_observer_unittest.mm
index 397674e2607f79c4635b64d8d2bf1f99f83ff7f6..15506280c47da0375d4fecf3d0bc37e603857144 100644
--- a/ios/chrome/browser/reading_list/reading_list_web_state_observer_unittest.mm
+++ b/ios/chrome/browser/reading_list/reading_list_web_state_observer_unittest.mm
@@ -30,10 +30,18 @@ class TestNavigationManager : public web::TestNavigationManager {
void Reload(web::ReloadType reload_type, bool check_for_repost) override {
reload_called_ = true;
}
+
bool ReloadCalled() { return reload_called_; }
+ int GetLastCommittedItemIndex() const override { return 1; }
+
+ void GoToIndex(int index) override { go_to_index_called_index_ = index; }
+
+ int GoToIndexCalled() { return go_to_index_called_index_; }
+
private:
bool reload_called_ = false;
+ int go_to_index_called_index_ = -1;
};
// A Test navigation manager that remembers the last opened parameters.
@@ -85,6 +93,7 @@ TEST_F(ReadingListWebStateObserverTest, TestLoadReadingListFailure) {
test_web_state_.SetLoading(false);
EXPECT_FALSE(test_navigation_manager_->ReloadCalled());
+ EXPECT_EQ(test_navigation_manager_->GoToIndexCalled(), -1);
// Check that |GetLastCommittedItem()| has not been altered.
EXPECT_EQ(test_navigation_manager_->GetLastCommittedItem()->GetVirtualURL(),
GURL());
@@ -108,6 +117,7 @@ TEST_F(ReadingListWebStateObserverTest, TestLoadReadingListOnline) {
test_web_state_.SetLoading(false);
EXPECT_FALSE(test_navigation_manager_->ReloadCalled());
+ EXPECT_EQ(test_navigation_manager_->GoToIndexCalled(), -1);
// Check that |GetLastCommittedItem()| has not been altered.
EXPECT_EQ(test_navigation_manager_->GetLastCommittedItem()->GetVirtualURL(),
GURL());
@@ -134,7 +144,9 @@ TEST_F(ReadingListWebStateObserverTest, TestLoadReadingListDistilledCommitted) {
test_web_state_.OnPageLoaded(web::PageLoadCompletionStatus::FAILURE);
test_web_state_.SetLoading(false);
- EXPECT_TRUE(test_navigation_manager_->ReloadCalled());
+ EXPECT_FALSE(test_navigation_manager_->ReloadCalled());
+ EXPECT_EQ(test_navigation_manager_->GoToIndexCalled(),
+ test_navigation_manager_->GetLastCommittedItemIndex());
EXPECT_EQ(test_navigation_manager_->GetLastCommittedItem()->GetVirtualURL(),
url);
EXPECT_EQ(test_navigation_manager_->GetLastCommittedItem()->GetURL(),
@@ -160,7 +172,9 @@ TEST_F(ReadingListWebStateObserverTest, TestLoadReadingListDistilledPending) {
test_web_state_.OnPageLoaded(web::PageLoadCompletionStatus::FAILURE);
test_web_state_.SetLoading(false);
- EXPECT_TRUE(test_navigation_manager_->ReloadCalled());
+ EXPECT_FALSE(test_navigation_manager_->ReloadCalled());
+ EXPECT_EQ(test_navigation_manager_->GoToIndexCalled(),
+ test_navigation_manager_->GetLastCommittedItemIndex());
EXPECT_EQ(test_navigation_manager_->GetLastCommittedItem()->GetVirtualURL(),
url);
EXPECT_EQ(test_navigation_manager_->GetLastCommittedItem()->GetURL(),
« no previous file with comments | « ios/chrome/browser/reading_list/reading_list_web_state_observer.mm ('k') | ios/chrome/browser/ui/reading_list/BUILD.gn » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698