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

Unified Diff: content/browser/web_contents/web_contents_impl_unittest.cc

Issue 138913021: Avoid discarding freshly created background tabs (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase (last_selected) Created 6 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
« no previous file with comments | « content/browser/web_contents/web_contents_impl.cc ('k') | content/public/browser/web_contents.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/browser/web_contents/web_contents_impl_unittest.cc
diff --git a/content/browser/web_contents/web_contents_impl_unittest.cc b/content/browser/web_contents/web_contents_impl_unittest.cc
index 846a86198436d8bdb5bfb2b72e88eff5e9b1366d..d7834b0b0a1c9c366528ac3fda4bbd449ead3b88 100644
--- a/content/browser/web_contents/web_contents_impl_unittest.cc
+++ b/content/browser/web_contents/web_contents_impl_unittest.cc
@@ -2216,4 +2216,19 @@ TEST_F(WebContentsImplTest, CapturerOverridesPreferredSize) {
EXPECT_EQ(original_preferred_size, contents()->GetPreferredSize());
}
+// Tests that GetLastActiveTime starts with a real, non-zero time and updates
+// on activity.
+TEST_F(WebContentsImplTest, GetLastActiveTime) {
+ // The WebContents starts with a valid creation time.
+ EXPECT_FALSE(contents()->GetLastActiveTime().is_null());
+
+ // Reset the last active time to a known-bad value.
+ contents()->last_active_time_ = base::TimeTicks();
+ ASSERT_TRUE(contents()->GetLastActiveTime().is_null());
+
+ // Simulate activating the WebContents. The active time should update.
+ contents()->WasShown();
+ EXPECT_FALSE(contents()->GetLastActiveTime().is_null());
+}
+
} // namespace content
« no previous file with comments | « content/browser/web_contents/web_contents_impl.cc ('k') | content/public/browser/web_contents.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698