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

Unified Diff: chrome/browser/metrics/metrics_log_unittest.cc

Issue 296483004: Introduce a MetricsDataProvider interface. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 6 years, 7 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/metrics/metrics_log_unittest.cc
===================================================================
--- chrome/browser/metrics/metrics_log_unittest.cc (revision 271296)
+++ chrome/browser/metrics/metrics_log_unittest.cc (working copy)
@@ -27,6 +27,7 @@
#include "chrome/common/metrics/variations/variations_util.h"
#include "chrome/common/pref_names.h"
#include "chrome/installer/util/google_update_settings.h"
+#include "components/metrics/metrics_data_provider.h"
#include "components/metrics/metrics_hashes.h"
#include "components/metrics/proto/profiler_event.pb.h"
#include "components/metrics/proto/system_profile.pb.h"
@@ -324,7 +325,8 @@
synthetic_trials.push_back(kSyntheticTrials[0]);
synthetic_trials.push_back(kSyntheticTrials[1]);
- log.RecordEnvironment(plugins, google_update_metrics, synthetic_trials);
+ log.RecordEnvironment(ScopedVector<metrics::MetricsDataProvider>(),
+ plugins, google_update_metrics, synthetic_trials);
// Check that the system profile on the log has the correct values set.
CheckSystemProfile(log.system_profile());
@@ -357,7 +359,8 @@
// Do a RecordEnvironment() call and check whether the pref is recorded.
{
TestMetricsLog log(kClientId, kSessionId, MetricsLog::ONGOING_LOG, &prefs);
- log.RecordEnvironment(std::vector<content::WebPluginInfo>(),
+ log.RecordEnvironment(ScopedVector<metrics::MetricsDataProvider>(),
+ std::vector<content::WebPluginInfo>(),
GoogleUpdateMetrics(),
std::vector<chrome_variations::ActiveGroupId>());
EXPECT_FALSE(prefs.GetString(kSystemProfilePref).empty());
@@ -379,7 +382,8 @@
{
TestMetricsLog log(kClientId, kSessionId, MetricsLog::ONGOING_LOG, &prefs);
// Call RecordEnvironment() to record the pref again.
- log.RecordEnvironment(std::vector<content::WebPluginInfo>(),
+ log.RecordEnvironment(ScopedVector<metrics::MetricsDataProvider>(),
+ std::vector<content::WebPluginInfo>(),
GoogleUpdateMetrics(),
std::vector<chrome_variations::ActiveGroupId>());
}
@@ -397,10 +401,13 @@
TEST_F(MetricsLogTest, InitialLogStabilityMetrics) {
TestMetricsLog log(kClientId, kSessionId, MetricsLog::INITIAL_STABILITY_LOG);
- log.RecordEnvironment(std::vector<content::WebPluginInfo>(),
+ ScopedVector<metrics::MetricsDataProvider> data_providers;
+ log.RecordEnvironment(data_providers,
+ std::vector<content::WebPluginInfo>(),
GoogleUpdateMetrics(),
std::vector<chrome_variations::ActiveGroupId>());
- log.RecordStabilityMetrics(base::TimeDelta(), base::TimeDelta());
+ log.RecordStabilityMetrics(data_providers, base::TimeDelta(),
+ base::TimeDelta());
const metrics::SystemProfileProto_Stability& stability =
log.system_profile().stability();
// Required metrics:
@@ -416,10 +423,13 @@
TEST_F(MetricsLogTest, OngoingLogStabilityMetrics) {
TestMetricsLog log(kClientId, kSessionId, MetricsLog::ONGOING_LOG);
- log.RecordEnvironment(std::vector<content::WebPluginInfo>(),
+ ScopedVector<metrics::MetricsDataProvider> data_providers;
+ log.RecordEnvironment(data_providers,
+ std::vector<content::WebPluginInfo>(),
GoogleUpdateMetrics(),
std::vector<chrome_variations::ActiveGroupId>());
- log.RecordStabilityMetrics(base::TimeDelta(), base::TimeDelta());
+ log.RecordStabilityMetrics(data_providers, base::TimeDelta(),
+ base::TimeDelta());
const metrics::SystemProfileProto_Stability& stability =
log.system_profile().stability();
// Required metrics:
@@ -436,13 +446,14 @@
#if defined(ENABLE_PLUGINS)
TEST_F(MetricsLogTest, Plugins) {
TestMetricsLog log(kClientId, kSessionId, MetricsLog::ONGOING_LOG);
+ ScopedVector<metrics::MetricsDataProvider> data_providers;
std::vector<content::WebPluginInfo> plugins;
plugins.push_back(CreateFakePluginInfo("p1", FILE_PATH_LITERAL("p1.plugin"),
"1.5", true));
plugins.push_back(CreateFakePluginInfo("p2", FILE_PATH_LITERAL("p2.plugin"),
"2.0", false));
- log.RecordEnvironment(plugins, GoogleUpdateMetrics(),
+ log.RecordEnvironment(data_providers, plugins, GoogleUpdateMetrics(),
std::vector<chrome_variations::ActiveGroupId>());
const metrics::SystemProfileProto& system_profile = log.system_profile();
@@ -468,7 +479,8 @@
update.Get()->Append(plugin_dict.release());
}
- log.RecordStabilityMetrics(base::TimeDelta(), base::TimeDelta());
+ log.RecordStabilityMetrics(data_providers, base::TimeDelta(),
+ base::TimeDelta());
const metrics::SystemProfileProto_Stability& stability =
log.system_profile().stability();
ASSERT_EQ(1, stability.plugin_stability_size());
@@ -673,10 +685,12 @@
user_manager->LoginUser(user3);
TestMetricsLog log(kClientId, kSessionId, MetricsLog::ONGOING_LOG);
+ ScopedVector<metrics::MetricsDataProvider> data_providers;
std::vector<content::WebPluginInfo> plugins;
GoogleUpdateMetrics google_update_metrics;
std::vector<chrome_variations::ActiveGroupId> synthetic_trials;
- log.RecordEnvironment(plugins, google_update_metrics, synthetic_trials);
+ log.RecordEnvironment(data_providers, plugins, google_update_metrics,
+ synthetic_trials);
EXPECT_EQ(2u, log.system_profile().multi_profile_user_count());
}
@@ -698,15 +712,17 @@
EXPECT_EQ(1u, log.system_profile().multi_profile_user_count());
user_manager->LoginUser(user2);
+ ScopedVector<metrics::MetricsDataProvider> data_providers;
std::vector<chrome_variations::ActiveGroupId> synthetic_trials;
- log.RecordEnvironment(std::vector<content::WebPluginInfo>(),
+ log.RecordEnvironment(data_providers, std::vector<content::WebPluginInfo>(),
GoogleUpdateMetrics(), synthetic_trials);
EXPECT_EQ(0u, log.system_profile().multi_profile_user_count());
}
TEST_F(MetricsLogTest, BluetoothHardwareDisabled) {
TestMetricsLog log(kClientId, kSessionId, MetricsLog::ONGOING_LOG);
- log.RecordEnvironment(std::vector<content::WebPluginInfo>(),
+ log.RecordEnvironment(ScopedVector<metrics::MetricsDataProvider>,
+ std::vector<content::WebPluginInfo>(),
GoogleUpdateMetrics(),
std::vector<chrome_variations::ActiveGroupId>());
@@ -724,7 +740,8 @@
properties->powered.ReplaceValue(true);
TestMetricsLog log(kClientId, kSessionId, MetricsLog::ONGOING_LOG);
- log.RecordEnvironment(std::vector<content::WebPluginInfo>(),
+ log.RecordEnvironment(ScopedVector<metrics::MetricsDataProvider>,
+ std::vector<content::WebPluginInfo>(),
GoogleUpdateMetrics(),
std::vector<chrome_variations::ActiveGroupId>());
@@ -754,7 +771,8 @@
properties->paired.ReplaceValue(true);
TestMetricsLog log(kClientId, kSessionId, MetricsLog::ONGOING_LOG);
- log.RecordEnvironment(std::vector<content::WebPluginInfo>(),
+ log.RecordEnvironment(ScopedVector<metrics::MetricsDataProvider>,
+ std::vector<content::WebPluginInfo>(),
GoogleUpdateMetrics(),
std::vector<chrome_variations::ActiveGroupId>());

Powered by Google App Engine
This is Rietveld 408576698