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

Side by Side Diff: chrome/browser/memory/tab_manager_web_contents_data_unittest.cc

Issue 1178423008: Provision to start base::SimpleTestTickClock at initial ticks Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebased Created 4 years, 11 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
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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 "chrome/browser/memory/tab_manager_web_contents_data.h" 5 #include "chrome/browser/memory/tab_manager_web_contents_data.h"
6 6
7 #include "base/test/histogram_tester.h" 7 #include "base/test/histogram_tester.h"
8 #include "base/test/simple_test_tick_clock.h" 8 #include "base/test/simple_test_tick_clock.h"
9 #include "chrome/test/base/chrome_render_view_host_test_harness.h" 9 #include "chrome/test/base/chrome_render_view_host_test_harness.h"
10 #include "chrome/test/base/testing_profile.h" 10 #include "chrome/test/base/testing_profile.h"
11 #include "content/public/browser/web_contents.h" 11 #include "content/public/browser/web_contents.h"
12 #include "content/public/test/web_contents_tester.h" 12 #include "content/public/test/web_contents_tester.h"
13 #include "testing/gtest/include/gtest/gtest.h" 13 #include "testing/gtest/include/gtest/gtest.h"
14 14
15 using content::WebContents; 15 using content::WebContents;
16 using content::WebContentsTester; 16 using content::WebContentsTester;
17 17
18 namespace memory { 18 namespace memory {
19 namespace { 19 namespace {
20 20
21 class TabManagerWebContentsDataTest : public ChromeRenderViewHostTestHarness { 21 class TabManagerWebContentsDataTest : public ChromeRenderViewHostTestHarness {
22 public: 22 public:
23 TabManagerWebContentsDataTest() : ChromeRenderViewHostTestHarness() {} 23 TabManagerWebContentsDataTest()
24 : ChromeRenderViewHostTestHarness(), test_clock_(base::TimeTicks()) {}
24 25
25 void SetUp() override { 26 void SetUp() override {
26 ChromeRenderViewHostTestHarness::SetUp(); 27 ChromeRenderViewHostTestHarness::SetUp();
27 tab_data_ = CreateWebContentsAndTabData(&web_contents_); 28 tab_data_ = CreateWebContentsAndTabData(&web_contents_);
28 tab_data_->set_test_tick_clock(&test_clock_); 29 tab_data_->set_test_tick_clock(&test_clock_);
29 } 30 }
30 31
31 void TearDown() override { 32 void TearDown() override {
32 tab_data_->set_test_tick_clock(nullptr); 33 tab_data_->set_test_tick_clock(nullptr);
33 web_contents_.reset(); 34 web_contents_.reset();
(...skipping 164 matching lines...) Expand 10 before | Expand all | Expand 10 after
198 test_clock().Advance(base::TimeDelta::FromSeconds(7)); 199 test_clock().Advance(base::TimeDelta::FromSeconds(7));
199 tab_data()->SetDiscardState(false); 200 tab_data()->SetDiscardState(false);
200 201
201 EXPECT_EQ(1, 202 EXPECT_EQ(1,
202 histograms.GetTotalCountsForPrefix(kHistogramName).begin()->second); 203 histograms.GetTotalCountsForPrefix(kHistogramName).begin()->second);
203 204
204 histograms.ExpectBucketCount(kHistogramName, 12000, 1); 205 histograms.ExpectBucketCount(kHistogramName, 12000, 1);
205 } 206 }
206 207
207 } // namespace memory 208 } // namespace memory
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698