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

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

Issue 2045303002: Update to Chromium //base at Chromium commit 3e81715e6d3a4324362635aea46ce1f1a163cca1. (Closed) Base URL: https://chromium.googlesource.com/external/github.com/domokit/base@master
Patch Set: Created 4 years, 6 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 | « android/java_handler_thread.cc ('k') | android/jni_array.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: android/javatests/src/org/chromium/base/metrics/RecordHistogramTest.java
diff --git a/android/javatests/src/org/chromium/base/metrics/RecordHistogramTest.java b/android/javatests/src/org/chromium/base/metrics/RecordHistogramTest.java
index 1bf9c216145da7020f72c5699c153564c1b7d0ce..6b1888ce59ca62cc586dfd6260b7731761a9e431 100644
--- a/android/javatests/src/org/chromium/base/metrics/RecordHistogramTest.java
+++ b/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 | « android/java_handler_thread.cc ('k') | android/jni_array.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698