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

Unified Diff: chrome/browser/memory/tab_manager_web_contents_data_unittest.cc

Issue 2454593002: Add new fields for Purge+Suspend to WebContentsData. (Closed)
Patch Set: Add TabManagerWebContentsDataTest.PurgeAndSuspendState. Created 4 years, 2 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
« no previous file with comments | « chrome/browser/memory/tab_manager_web_contents_data.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/memory/tab_manager_web_contents_data_unittest.cc
diff --git a/chrome/browser/memory/tab_manager_web_contents_data_unittest.cc b/chrome/browser/memory/tab_manager_web_contents_data_unittest.cc
index e8adeefb150bd2955f29af1329cf014b6f2ae585..9c1cd3dfcb8c6abb59275faefce4ba0be27c7286 100644
--- a/chrome/browser/memory/tab_manager_web_contents_data_unittest.cc
+++ b/chrome/browser/memory/tab_manager_web_contents_data_unittest.cc
@@ -204,4 +204,22 @@ TEST_F(TabManagerWebContentsDataTest, HistogramsInactiveToReloadTime) {
histograms.ExpectBucketCount(kHistogramName, 12000, 1);
}
+TEST_F(TabManagerWebContentsDataTest, PurgeAndSuspendState) {
+ EXPECT_EQ(TabManager::RUNNING, tab_data()->GetPurgeAndSuspendState());
+ base::TimeTicks last_modified = tab_data()->LastPurgeAndSuspendModifiedTime();
+ tab_data()->SetPurgeAndSuspendState(TabManager::SUSPENDED);
+ EXPECT_EQ(TabManager::SUSPENDED, tab_data()->GetPurgeAndSuspendState());
+ EXPECT_GT(tab_data()->LastPurgeAndSuspendModifiedTime(), last_modified);
+
+ last_modified = tab_data()->LastPurgeAndSuspendModifiedTime();
+ tab_data()->SetPurgeAndSuspendState(TabManager::RESUMED);
+ EXPECT_EQ(TabManager::RESUMED, tab_data()->GetPurgeAndSuspendState());
+ EXPECT_GE(tab_data()->LastPurgeAndSuspendModifiedTime(), last_modified);
+
+ last_modified = tab_data()->LastPurgeAndSuspendModifiedTime();
+ tab_data()->SetPurgeAndSuspendState(TabManager::RUNNING);
+ EXPECT_EQ(TabManager::RUNNING, tab_data()->GetPurgeAndSuspendState());
+ EXPECT_GE(tab_data()->LastPurgeAndSuspendModifiedTime(), last_modified);
+}
+
} // namespace memory
« no previous file with comments | « chrome/browser/memory/tab_manager_web_contents_data.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698