OLD | NEW |
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/resource_coordinator/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 resource_coordinator { |
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() : ChromeRenderViewHostTestHarness() {} |
24 | 24 |
25 void SetUp() override { | 25 void SetUp() override { |
26 ChromeRenderViewHostTestHarness::SetUp(); | 26 ChromeRenderViewHostTestHarness::SetUp(); |
27 tab_data_ = CreateWebContentsAndTabData(&web_contents_); | 27 tab_data_ = CreateWebContentsAndTabData(&web_contents_); |
28 tab_data_->set_test_tick_clock(&test_clock_); | 28 tab_data_->set_test_tick_clock(&test_clock_); |
(...skipping 168 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
197 tab_data()->IncrementDiscardCount(); | 197 tab_data()->IncrementDiscardCount(); |
198 test_clock().Advance(base::TimeDelta::FromSeconds(7)); | 198 test_clock().Advance(base::TimeDelta::FromSeconds(7)); |
199 tab_data()->SetDiscardState(false); | 199 tab_data()->SetDiscardState(false); |
200 | 200 |
201 EXPECT_EQ(1, | 201 EXPECT_EQ(1, |
202 histograms.GetTotalCountsForPrefix(kHistogramName).begin()->second); | 202 histograms.GetTotalCountsForPrefix(kHistogramName).begin()->second); |
203 | 203 |
204 histograms.ExpectBucketCount(kHistogramName, 12000, 1); | 204 histograms.ExpectBucketCount(kHistogramName, 12000, 1); |
205 } | 205 } |
206 | 206 |
207 } // namespace memory | 207 } // namespace resource_coordinator |
OLD | NEW |