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

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

Issue 1013463003: Update from https://crrev.com/320931 (Closed) Base URL: https://github.com/domokit/mojo.git@master
Patch Set: Created 5 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « base/android/java/src/org/chromium/base/metrics/RecordHistogram.java ('k') | base/android/jni_android.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 f0489d37e1b2ba18678ae1f32bd971d11f287f20..24af056f1cee08849215141b05c4e10fa94c8913 100644
--- a/base/android/javatests/src/org/chromium/base/metrics/RecordHistogramTest.java
+++ b/base/android/javatests/src/org/chromium/base/metrics/RecordHistogramTest.java
@@ -80,6 +80,47 @@ public class RecordHistogramTest extends InstrumentationTestCase {
}
/**
+ * Tests recording of count histograms.
+ */
+ @SmallTest
+ public void testRecordCountHistogram() {
+ String histogram = "HelloWorld.CountMetric";
+ HistogramDelta zeroCount = new HistogramDelta(histogram, 0);
+ HistogramDelta oneCount = new HistogramDelta(histogram, 1);
+ HistogramDelta twoCount = new HistogramDelta(histogram, 2);
+ HistogramDelta eightThousandCount = new HistogramDelta(histogram, 8000);
+
+ assertEquals(0, zeroCount.getDelta());
+ assertEquals(0, oneCount.getDelta());
+ assertEquals(0, twoCount.getDelta());
+ assertEquals(0, eightThousandCount.getDelta());
+
+ RecordHistogram.recordCountHistogram(histogram, 0);
+ assertEquals(1, zeroCount.getDelta());
+ assertEquals(0, oneCount.getDelta());
+ assertEquals(0, twoCount.getDelta());
+ assertEquals(0, eightThousandCount.getDelta());
+
+ RecordHistogram.recordCountHistogram(histogram, 0);
+ assertEquals(2, zeroCount.getDelta());
+ assertEquals(0, oneCount.getDelta());
+ assertEquals(0, twoCount.getDelta());
+ assertEquals(0, eightThousandCount.getDelta());
+
+ RecordHistogram.recordCountHistogram(histogram, 2);
+ assertEquals(2, zeroCount.getDelta());
+ assertEquals(0, oneCount.getDelta());
+ assertEquals(1, twoCount.getDelta());
+ assertEquals(0, eightThousandCount.getDelta());
+
+ RecordHistogram.recordCountHistogram(histogram, 8000);
+ assertEquals(2, zeroCount.getDelta());
+ assertEquals(0, oneCount.getDelta());
+ assertEquals(1, twoCount.getDelta());
+ assertEquals(1, eightThousandCount.getDelta());
+ }
+
+ /**
* Tests recording of custom times histograms.
*/
@SmallTest
« no previous file with comments | « base/android/java/src/org/chromium/base/metrics/RecordHistogram.java ('k') | base/android/jni_android.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698