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

Side by Side Diff: components/metrics/file_metrics_provider_unittest.cc

Issue 2748463004: No 'prefs' state is necessary for an active file. (Closed)
Patch Set: fixed test Created 3 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 unified diff | Download patch
« no previous file with comments | « components/metrics/file_metrics_provider.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 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 "components/metrics/file_metrics_provider.h" 5 #include "components/metrics/file_metrics_provider.h"
6 6
7 #include "base/files/file_util.h" 7 #include "base/files/file_util.h"
8 #include "base/files/memory_mapped_file.h" 8 #include "base/files/memory_mapped_file.h"
9 #include "base/files/scoped_temp_dir.h" 9 #include "base/files/scoped_temp_dir.h"
10 #include "base/macros.h" 10 #include "base/macros.h"
(...skipping 354 matching lines...) Expand 10 before | Expand all | Expand 10 after
365 CreateGlobalHistograms(2); 365 CreateGlobalHistograms(2);
366 ASSERT_TRUE(PathExists(metrics_file())); 366 ASSERT_TRUE(PathExists(metrics_file()));
367 base::HistogramBase* h0 = GetCreatedHistogram(0); 367 base::HistogramBase* h0 = GetCreatedHistogram(0);
368 base::HistogramBase* h1 = GetCreatedHistogram(1); 368 base::HistogramBase* h1 = GetCreatedHistogram(1);
369 DCHECK(h0); 369 DCHECK(h0);
370 DCHECK(h1); 370 DCHECK(h1);
371 std::unique_ptr<base::PersistentHistogramAllocator> histogram_allocator = 371 std::unique_ptr<base::PersistentHistogramAllocator> histogram_allocator =
372 base::GlobalHistogramAllocator::ReleaseForTesting(); 372 base::GlobalHistogramAllocator::ReleaseForTesting();
373 373
374 // Register the file and allow the "checker" task to run. 374 // Register the file and allow the "checker" task to run.
375 provider()->RegisterSource(metrics_file(), 375 provider()->RegisterSource(
376 FileMetricsProvider::SOURCE_HISTOGRAMS_ACTIVE_FILE, 376 metrics_file(), FileMetricsProvider::SOURCE_HISTOGRAMS_ACTIVE_FILE,
377 FileMetricsProvider::ASSOCIATE_CURRENT_RUN, 377 FileMetricsProvider::ASSOCIATE_CURRENT_RUN, nullptr);
378 kMetricsName);
379 378
380 // Record embedded snapshots via snapshot-manager. 379 // Record embedded snapshots via snapshot-manager.
381 OnDidCreateMetricsLog(); 380 OnDidCreateMetricsLog();
382 RunTasks(); 381 RunTasks();
383 EXPECT_EQ(2U, GetSnapshotHistogramCount()); 382 EXPECT_EQ(2U, GetSnapshotHistogramCount());
384 EXPECT_TRUE(base::PathExists(metrics_file())); 383 EXPECT_TRUE(base::PathExists(metrics_file()));
385 384
386 // Make sure a second call to the snapshot-recorder doesn't break anything. 385 // Make sure a second call to the snapshot-recorder doesn't break anything.
387 OnDidCreateMetricsLog(); 386 OnDidCreateMetricsLog();
388 RunTasks(); 387 RunTasks();
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
430 OnDidCreateMetricsLog(); 429 OnDidCreateMetricsLog();
431 RunTasks(); 430 RunTasks();
432 EXPECT_EQ(0U, GetSnapshotHistogramCount()); 431 EXPECT_EQ(0U, GetSnapshotHistogramCount());
433 EXPECT_TRUE(base::PathExists(metrics_file())); 432 EXPECT_TRUE(base::PathExists(metrics_file()));
434 OnDidCreateMetricsLog(); 433 OnDidCreateMetricsLog();
435 RunTasks(); 434 RunTasks();
436 EXPECT_TRUE(base::PathExists(metrics_file())); 435 EXPECT_TRUE(base::PathExists(metrics_file()));
437 } 436 }
438 437
439 } // namespace metrics 438 } // namespace metrics
OLDNEW
« no previous file with comments | « components/metrics/file_metrics_provider.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698