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

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

Issue 2704443006: Make time_to_first_suspension's default 1800sec (Closed)
Patch Set: Fixed. 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/memory/tab_manager_unittest.cc
diff --git a/chrome/browser/memory/tab_manager_unittest.cc b/chrome/browser/memory/tab_manager_unittest.cc
index 59b93b6cec30027077c4c3b79573c61c3c5583ad..91293fa87d02f198845287cf35833dd74f94f5f6 100644
--- a/chrome/browser/memory/tab_manager_unittest.cc
+++ b/chrome/browser/memory/tab_manager_unittest.cc
@@ -681,7 +681,9 @@ TEST_F(TabManagerTest, NextPurgeAndSuspendState) {
WebContents* test_contents = CreateWebContents();
tabstrip.AppendWebContents(test_contents, false);
- base::TimeDelta threshold = base::TimeDelta::FromSeconds(180);
+ // Use default time-to-first-suspension seconds defined in TabManager.
+ base::TimeDelta threshold = base::TimeDelta::FromSeconds(
+ TabManager::kDefaultTimeToFirstPurgeInSeconds);
base::SimpleTestTickClock test_clock;
tab_manager.GetWebContentsData(test_contents)
@@ -689,11 +691,13 @@ TEST_F(TabManagerTest, NextPurgeAndSuspendState) {
tab_manager.GetWebContentsData(test_contents)
->SetLastPurgeAndSuspendModifiedTimeForTesting(test_clock.NowTicks());
- test_clock.Advance(base::TimeDelta::FromSeconds(180));
+ // Wait 30 minutes. Should be still RUNNING.
Wez 2017/02/22 01:25:10 nit: Comment style is to prefer complete sentences
tasak 2017/02/22 04:18:46 Done.
+ test_clock.Advance(base::TimeDelta::FromMinutes(30));
EXPECT_EQ(TabManager::RUNNING,
tab_manager.GetNextPurgeAndSuspendState(
test_contents, test_clock.NowTicks(), threshold));
+ // > 30 minutes. Should be still SUSPENDED.
Wez 2017/02/22 01:25:10 Do you mean "Should _now_ be SUSPENDED."?
tasak 2017/02/22 04:18:46 Yes, thanks. Done.
test_clock.Advance(base::TimeDelta::FromSeconds(1));
EXPECT_EQ(TabManager::SUSPENDED,
tab_manager.GetNextPurgeAndSuspendState(
« chrome/browser/memory/tab_manager.h ('K') | « chrome/browser/memory/tab_manager.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698