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

Side by Side 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "base/logging.h" 5 #include "base/logging.h"
6 #include "base/strings/utf_string_conversions.h" 6 #include "base/strings/utf_string_conversions.h"
7 #include "content/browser/frame_host/interstitial_page_impl.h" 7 #include "content/browser/frame_host/interstitial_page_impl.h"
8 #include "content/browser/frame_host/navigation_entry_impl.h" 8 #include "content/browser/frame_host/navigation_entry_impl.h"
9 #include "content/browser/renderer_host/render_view_host_impl.h" 9 #include "content/browser/renderer_host/render_view_host_impl.h"
10 #include "content/browser/site_instance_impl.h" 10 #include "content/browser/site_instance_impl.h"
(...skipping 2198 matching lines...) Expand 10 before | Expand all | Expand 10 after
2209 EXPECT_EQ(1, contents()->GetCapturerCount()); 2209 EXPECT_EQ(1, contents()->GetCapturerCount());
2210 EXPECT_EQ(capture_size, contents()->GetPreferredSize()); 2210 EXPECT_EQ(capture_size, contents()->GetPreferredSize());
2211 2211
2212 // Decrement capturer count, and since the count has dropped to zero, the 2212 // Decrement capturer count, and since the count has dropped to zero, the
2213 // original preferred size should be restored. 2213 // original preferred size should be restored.
2214 contents()->DecrementCapturerCount(); 2214 contents()->DecrementCapturerCount();
2215 EXPECT_EQ(0, contents()->GetCapturerCount()); 2215 EXPECT_EQ(0, contents()->GetCapturerCount());
2216 EXPECT_EQ(original_preferred_size, contents()->GetPreferredSize()); 2216 EXPECT_EQ(original_preferred_size, contents()->GetPreferredSize());
2217 } 2217 }
2218 2218
2219 // Tests that GetLastActiveTime starts with a real, non-zero time and updates
2220 // on activity.
2221 TEST_F(WebContentsImplTest, GetLastActiveTime) {
2222 // The WebContents starts with a valid creation time.
2223 EXPECT_FALSE(contents()->GetLastActiveTime().is_null());
2224
2225 // Reset the last active time to a known-bad value.
2226 contents()->last_active_time_ = base::TimeTicks();
2227 ASSERT_TRUE(contents()->GetLastActiveTime().is_null());
2228
2229 // Simulate activating the WebContents. The active time should update.
2230 contents()->WasShown();
2231 EXPECT_FALSE(contents()->GetLastActiveTime().is_null());
2232 }
2233
2219 } // namespace content 2234 } // namespace content
OLDNEW
« 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