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

Unified Diff: chrome/browser/android/offline_pages/recent_tab_helper_unittest.cc

Issue 2705453003: Last_n: disable on Svelte devices. (Closed)
Patch Set: Created 3 years, 10 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: chrome/browser/android/offline_pages/recent_tab_helper_unittest.cc
diff --git a/chrome/browser/android/offline_pages/recent_tab_helper_unittest.cc b/chrome/browser/android/offline_pages/recent_tab_helper_unittest.cc
index 205db07c36d10722f99bdf85c0024669986fe192..564b48f1e791a703e713424fb646e905fe00bfd4 100644
--- a/chrome/browser/android/offline_pages/recent_tab_helper_unittest.cc
+++ b/chrome/browser/android/offline_pages/recent_tab_helper_unittest.cc
@@ -333,6 +333,30 @@ TEST_F(RecentTabHelperTest, NoTabIdNoCapture) {
ASSERT_EQ(0U, GetAllPages().size());
}
+// Checks that last_n is disabled if the device is low-end (aka svelte) but that
+// download requests still work.
+TEST_F(RecentTabHelperTest, LastNDisabledOnSvelte) {
+ // Simulates a low end device.
+ recent_tab_helper()->is_low_end_device_ = true;
+
+ // Navigate and finish loading then hide the tab. Nothing should be saved.
+ NavigateAndCommit(kTestPageUrl);
+ recent_tab_helper()->DocumentOnLoadCompletedInMainFrame();
+ FastForwardSnapshotController();
+ recent_tab_helper()->WasHidden();
+ RunUntilIdle();
+ EXPECT_TRUE(model()->is_loaded());
+ EXPECT_EQ(0U, page_added_count());
+ ASSERT_EQ(0U, GetAllPages().size());
+
+ // But the following download request should work normally
+ recent_tab_helper()->ObserveAndDownloadCurrentPage(NewDownloadClientId(),
+ 123L);
+ RunUntilIdle();
+ EXPECT_EQ(1U, page_added_count());
+ ASSERT_EQ(1U, GetAllPages().size());
+}
+
// Triggers two last_n snapshot captures during a single page load. Should end
// up with one snapshot, the 1st being replaced by the 2nd.
TEST_F(RecentTabHelperTest, TwoCapturesSamePageLoad) {

Powered by Google App Engine
This is Rietveld 408576698