Index: chrome/browser/metrics/subprocess_metrics_provider_unittest.cc |
diff --git a/chrome/browser/metrics/subprocess_metrics_provider_unittest.cc b/chrome/browser/metrics/subprocess_metrics_provider_unittest.cc |
index 4f3779c68a80670173cb0fc8db0797384da56258..5b3e641d9eae898dd621b24099ac8a9dbfb78a4f 100644 |
--- a/chrome/browser/metrics/subprocess_metrics_provider_unittest.cc |
+++ b/chrome/browser/metrics/subprocess_metrics_provider_unittest.cc |
@@ -13,6 +13,7 @@ |
#include "base/metrics/persistent_histogram_allocator.h" |
#include "base/metrics/persistent_memory_allocator.h" |
#include "base/metrics/statistics_recorder.h" |
+#include "content/public/test/test_browser_thread_bundle.h" |
#include "testing/gtest/include/gtest/gtest.h" |
namespace { |
@@ -56,7 +57,8 @@ class HistogramFlattenerDeltaRecorder : public base::HistogramFlattener { |
class SubprocessMetricsProviderTest : public testing::Test { |
protected: |
- SubprocessMetricsProviderTest() { |
+ SubprocessMetricsProviderTest() |
+ : thread_bundle_(content::TestBrowserThreadBundle::DEFAULT) { |
// Get this first so it isn't created inside a persistent allocator. |
base::PersistentHistogramAllocator::GetCreateHistogramResultHistogram(); |
@@ -117,6 +119,11 @@ class SubprocessMetricsProviderTest : public testing::Test { |
} |
private: |
+ // A thread-bundle makes the tests appear on the UI thread, something that is |
+ // checked in methods called from the SubprocessMetricsProvider class under |
+ // test. This must be constructed before the |provider_| field. |
+ content::TestBrowserThreadBundle thread_bundle_; |
+ |
SubprocessMetricsProvider provider_; |
std::unique_ptr<base::StatisticsRecorder> test_recorder_; |