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

Unified Diff: base/android/javatests/src/org/chromium/base/metrics/RecordHistogramTest.java

Issue 1309143004: Add UMA metrics to record the size of internal memory available on a user's device when the Update … (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix indent 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: base/android/javatests/src/org/chromium/base/metrics/RecordHistogramTest.java
diff --git a/base/android/javatests/src/org/chromium/base/metrics/RecordHistogramTest.java b/base/android/javatests/src/org/chromium/base/metrics/RecordHistogramTest.java
index 1bf9c216145da7020f72c5699c153564c1b7d0ce..6b1888ce59ca62cc586dfd6260b7731761a9e431 100644
--- a/base/android/javatests/src/org/chromium/base/metrics/RecordHistogramTest.java
+++ b/base/android/javatests/src/org/chromium/base/metrics/RecordHistogramTest.java
@@ -157,4 +157,37 @@ public class RecordHistogramTest extends InstrumentationTestCase {
assertEquals(1, oneCount.getDelta());
assertEquals(1, twoCount.getDelta());
}
+
+ /**
+ * Tests recording of linear count histograms.
+ */
+ @SmallTest
+ public void testRecordLinearCountHistogram() {
+ String histogram = "HelloWorld.LinearCountMetric";
+ HistogramDelta zeroCount = new HistogramDelta(histogram, 0);
+ HistogramDelta oneCount = new HistogramDelta(histogram, 1);
+ HistogramDelta twoCount = new HistogramDelta(histogram, 2);
+ final int min = 1;
+ final int max = 3;
+ final int numBuckets = 4;
+
+ assertEquals(0, zeroCount.getDelta());
+ assertEquals(0, oneCount.getDelta());
+ assertEquals(0, twoCount.getDelta());
+
+ RecordHistogram.recordLinearCountHistogram(histogram, 0, min, max, numBuckets);
+ assertEquals(1, zeroCount.getDelta());
+ assertEquals(0, oneCount.getDelta());
+ assertEquals(0, twoCount.getDelta());
+
+ RecordHistogram.recordLinearCountHistogram(histogram, 0, min, max, numBuckets);
+ assertEquals(2, zeroCount.getDelta());
+ assertEquals(0, oneCount.getDelta());
+ assertEquals(0, twoCount.getDelta());
+
+ RecordHistogram.recordLinearCountHistogram(histogram, 2, min, max, numBuckets);
+ assertEquals(2, zeroCount.getDelta());
+ assertEquals(0, oneCount.getDelta());
+ assertEquals(1, twoCount.getDelta());
+ }
}
« no previous file with comments | « base/android/java/src/org/chromium/base/metrics/RecordHistogram.java ('k') | base/android/record_histogram.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698