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

Unified Diff: components/metrics/file_metrics_provider_unittest.cc

Issue 1738063002: Refactor histogram_persistence to be a class. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: addressed final review comments by Alexei Created 4 years, 9 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 | « components/metrics/file_metrics_provider.cc ('k') | components/metrics/metrics_service.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: components/metrics/file_metrics_provider_unittest.cc
diff --git a/components/metrics/file_metrics_provider_unittest.cc b/components/metrics/file_metrics_provider_unittest.cc
index 3bffb1c44af6beb4d2a15b065b2da586a2a4f588..425777fe29eb45af25e04702166a0ef8fec538a4 100644
--- a/components/metrics/file_metrics_provider_unittest.cc
+++ b/components/metrics/file_metrics_provider_unittest.cc
@@ -9,8 +9,8 @@
#include "base/files/scoped_temp_dir.h"
#include "base/metrics/histogram.h"
#include "base/metrics/histogram_flattener.h"
-#include "base/metrics/histogram_persistence.h"
#include "base/metrics/histogram_snapshot_manager.h"
+#include "base/metrics/persistent_histogram_allocator.h"
#include "base/metrics/persistent_memory_allocator.h"
#include "base/metrics/statistics_recorder.h"
#include "base/test/test_simple_task_runner.h"
@@ -103,10 +103,10 @@ TEST_F(FileMetricsProviderTest, AccessMetrics) {
{
// Get this first so it isn't created inside the persistent allocator.
- base::GetCreateHistogramResultHistogram();
+ base::PersistentHistogramAllocator::GetCreateHistogramResultHistogram();
- base::SetPersistentHistogramMemoryAllocator(
- new base::LocalPersistentMemoryAllocator(64 << 10, 0, kMetricsName));
+ base::PersistentHistogramAllocator::CreateGlobalAllocatorOnLocalMemory(
+ 64 << 10, 0, kMetricsName);
base::HistogramBase* foo =
base::Histogram::FactoryGet("foo", 1, 100, 10, 0);
base::HistogramBase* bar =
@@ -114,8 +114,10 @@ TEST_F(FileMetricsProviderTest, AccessMetrics) {
foo->Add(42);
bar->Add(84);
- scoped_ptr<base::PersistentMemoryAllocator> allocator(
- base::ReleasePersistentHistogramMemoryAllocatorForTesting());
+ scoped_ptr<base::PersistentHistogramAllocator> histogram_allocator =
+ base::PersistentHistogramAllocator::ReleaseGlobalAllocatorForTesting();
+ base::PersistentMemoryAllocator* allocator =
+ histogram_allocator->memory_allocator();
base::File writer(metrics_file(),
base::File::FLAG_CREATE | base::File::FLAG_WRITE);
ASSERT_TRUE(writer.IsValid());
« no previous file with comments | « components/metrics/file_metrics_provider.cc ('k') | components/metrics/metrics_service.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698