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

Unified Diff: chrome/browser/memory_details_browsertest.cc

Issue 823533004: Move memory histograms generation to MetricsMemoryDetails. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: clang-format Created 5 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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/memory_details_browsertest.cc
diff --git a/chrome/browser/memory_details_browsertest.cc b/chrome/browser/memory_details_browsertest.cc
deleted file mode 100644
index 9ee40c9997359b96a9e2f3f8b0125e8031c1a175..0000000000000000000000000000000000000000
--- a/chrome/browser/memory_details_browsertest.cc
+++ /dev/null
@@ -1,57 +0,0 @@
-// Copyright 2015 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#include "chrome/browser/memory_details.h"
-
-#include "base/message_loop/message_loop.h"
-#include "base/test/histogram_tester.h"
-#include "chrome/test/base/in_process_browser_test.h"
-#include "content/public/test/test_utils.h"
-
-namespace {
-
-class TestMemoryDetails : public MemoryDetails {
- public:
- TestMemoryDetails() {}
-
- void StartFetchAndWait() {
- StartFetch(UPDATE_USER_METRICS);
- content::RunMessageLoop();
- }
-
- private:
- ~TestMemoryDetails() override {}
-
- void OnDetailsAvailable() override {
- // Exit the loop initiated by StartFetchAndWait().
- base::MessageLoop::current()->Quit();
- }
-
- DISALLOW_COPY_AND_ASSIGN(TestMemoryDetails);
-};
-
-} // namespace
-
-class MemoryDetailsBrowserTest : public InProcessBrowserTest {
- public:
- MemoryDetailsBrowserTest() {}
- ~MemoryDetailsBrowserTest() override {}
-
- private:
- DISALLOW_COPY_AND_ASSIGN(MemoryDetailsBrowserTest);
-};
-
-IN_PROC_BROWSER_TEST_F(MemoryDetailsBrowserTest, TestMemoryDetails) {
- base::HistogramTester histogram_tester;
-
- scoped_refptr<TestMemoryDetails> details(new TestMemoryDetails);
- details->StartFetchAndWait();
-
- // Memory.Browser histogram should have a single non-0 sample recorded.
- histogram_tester.ExpectTotalCount("Memory.Browser", 1);
- scoped_ptr<base::HistogramSamples> samples(
- histogram_tester.GetHistogramSamplesSinceCreation("Memory.Browser"));
- ASSERT_TRUE(samples);
- EXPECT_NE(0, samples->sum());
-}

Powered by Google App Engine
This is Rietveld 408576698