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

Unified Diff: chrome/browser/metrics/chrome_stability_metrics_provider.h

Issue 1323703002: Add tests for Chrome Stability Metrics. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: change to testing::Test and add extension test Created 5 years, 4 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/chrome_stability_metrics_provider.h
diff --git a/chrome/browser/metrics/chrome_stability_metrics_provider.h b/chrome/browser/metrics/chrome_stability_metrics_provider.h
index 94da7d2cbbfc41e99205ce8ef07fd72a297d612d..d3c3a80050fa729921fce2283cb35170e0510758 100644
--- a/chrome/browser/metrics/chrome_stability_metrics_provider.h
+++ b/chrome/browser/metrics/chrome_stability_metrics_provider.h
@@ -6,6 +6,7 @@
#define CHROME_BROWSER_METRICS_CHROME_STABILITY_METRICS_PROVIDER_H_
#include "base/basictypes.h"
+#include "base/gtest_prod_util.h"
#include "base/metrics/user_metrics.h"
#include "base/process/kill.h"
#include "components/metrics/metrics_provider.h"
@@ -20,6 +21,8 @@ class RenderProcessHost;
class WebContents;
}
+class PrefService;
+
// ChromeStabilityMetricsProvider gathers and logs Chrome-specific stability-
// related metrics.
class ChromeStabilityMetricsProvider
@@ -27,7 +30,7 @@ class ChromeStabilityMetricsProvider
public content::BrowserChildProcessObserver,
public content::NotificationObserver {
public:
- ChromeStabilityMetricsProvider();
+ explicit ChromeStabilityMetricsProvider(PrefService* local_state);
~ChromeStabilityMetricsProvider() override;
// metrics::MetricsDataProvider:
@@ -41,6 +44,11 @@ class ChromeStabilityMetricsProvider
static void RegisterPrefs(PrefRegistrySimple* registry);
private:
+ FRIEND_TEST_ALL_PREFIXES(ChromeStabilityMetricsProviderTest,
+ BrowserChildProcessObserver);
+ FRIEND_TEST_ALL_PREFIXES(ChromeStabilityMetricsProviderTest,
+ NotificationObserver);
+
// content::NotificationObserver:
void Observe(int type,
const content::NotificationSource& source,
@@ -60,9 +68,17 @@ class ChromeStabilityMetricsProvider
base::TerminationStatus status,
int exit_code);
+ // Increment an Integer pref value specified by |path|
Avi (use Gerrit) 2015/09/02 01:11:10 . at the end of sentences
Will Harris 2015/09/02 15:57:53 Done.
+ void IncrementPrefValue(const char* path);
+
+ // Increment a 64-bit Integer pref value specified by |path|
Avi (use Gerrit) 2015/09/02 01:11:10 ditto
Will Harris 2015/09/02 15:57:53 Done.
+ void IncrementLongPrefsValue(const char* path);
+
// Records a renderer process hang.
void LogRendererHang();
+ PrefService* local_state_;
+
// Registrar for receiving stability-related notifications.
content::NotificationRegistrar registrar_;

Powered by Google App Engine
This is Rietveld 408576698