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

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

Issue 1647803004: Move base to DEPS (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Created 4 years, 11 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/javatests/src/org/chromium/base/ObserverListTest.java ('k') | base/android/jni_android.h » ('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
deleted file mode 100644
index 1bf9c216145da7020f72c5699c153564c1b7d0ce..0000000000000000000000000000000000000000
--- a/base/android/javatests/src/org/chromium/base/metrics/RecordHistogramTest.java
+++ /dev/null
@@ -1,160 +0,0 @@
-// Copyright 2014 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-package org.chromium.base.metrics;
-
-import android.test.InstrumentationTestCase;
-import android.test.suitebuilder.annotation.SmallTest;
-
-import org.chromium.base.library_loader.LibraryLoader;
-import org.chromium.base.library_loader.LibraryProcessType;
-import org.chromium.base.test.util.MetricsUtils.HistogramDelta;
-
-import java.util.concurrent.TimeUnit;
-
-/**
- * Tests for the Java API for recording UMA histograms.
- */
-public class RecordHistogramTest extends InstrumentationTestCase {
- @Override
- protected void setUp() throws Exception {
- super.setUp();
- LibraryLoader.get(LibraryProcessType.PROCESS_BROWSER)
- .ensureInitialized(getInstrumentation().getTargetContext());
- RecordHistogram.initialize();
- }
-
- /**
- * Tests recording of boolean histograms.
- */
- @SmallTest
- public void testRecordBooleanHistogram() {
- String histogram = "HelloWorld.BooleanMetric";
- HistogramDelta falseCount = new HistogramDelta(histogram, 0);
- HistogramDelta trueCount = new HistogramDelta(histogram, 1);
- assertEquals(0, trueCount.getDelta());
- assertEquals(0, falseCount.getDelta());
-
- RecordHistogram.recordBooleanHistogram(histogram, true);
- assertEquals(1, trueCount.getDelta());
- assertEquals(0, falseCount.getDelta());
-
- RecordHistogram.recordBooleanHistogram(histogram, true);
- assertEquals(2, trueCount.getDelta());
- assertEquals(0, falseCount.getDelta());
-
- RecordHistogram.recordBooleanHistogram(histogram, false);
- assertEquals(2, trueCount.getDelta());
- assertEquals(1, falseCount.getDelta());
- }
-
- /**
- * Tests recording of enumerated histograms.
- */
- @SmallTest
- public void testRecordEnumeratedHistogram() {
- String histogram = "HelloWorld.EnumeratedMetric";
- HistogramDelta zeroCount = new HistogramDelta(histogram, 0);
- HistogramDelta oneCount = new HistogramDelta(histogram, 1);
- HistogramDelta twoCount = new HistogramDelta(histogram, 2);
- final int boundary = 3;
-
- assertEquals(0, zeroCount.getDelta());
- assertEquals(0, oneCount.getDelta());
- assertEquals(0, twoCount.getDelta());
-
- RecordHistogram.recordEnumeratedHistogram(histogram, 0, boundary);
- assertEquals(1, zeroCount.getDelta());
- assertEquals(0, oneCount.getDelta());
- assertEquals(0, twoCount.getDelta());
-
- RecordHistogram.recordEnumeratedHistogram(histogram, 0, boundary);
- assertEquals(2, zeroCount.getDelta());
- assertEquals(0, oneCount.getDelta());
- assertEquals(0, twoCount.getDelta());
-
- RecordHistogram.recordEnumeratedHistogram(histogram, 2, boundary);
- assertEquals(2, zeroCount.getDelta());
- assertEquals(0, oneCount.getDelta());
- assertEquals(1, twoCount.getDelta());
- }
-
- /**
- * 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
- public void testRecordCustomTimesHistogram() {
- String histogram = "HelloWorld.CustomTimesMetric";
- HistogramDelta zeroCount = new HistogramDelta(histogram, 0);
- HistogramDelta oneCount = new HistogramDelta(histogram, 1);
- HistogramDelta twoCount = new HistogramDelta(histogram, 100);
-
- assertEquals(0, zeroCount.getDelta());
- assertEquals(0, oneCount.getDelta());
- assertEquals(0, twoCount.getDelta());
-
- TimeUnit milli = TimeUnit.MILLISECONDS;
-
- RecordHistogram.recordCustomTimesHistogram(histogram, 0, 1, 100, milli, 3);
- assertEquals(1, zeroCount.getDelta());
- assertEquals(0, oneCount.getDelta());
- assertEquals(0, twoCount.getDelta());
-
- RecordHistogram.recordCustomTimesHistogram(histogram, 0, 1, 100, milli, 3);
- assertEquals(2, zeroCount.getDelta());
- assertEquals(0, oneCount.getDelta());
- assertEquals(0, twoCount.getDelta());
-
- RecordHistogram.recordCustomTimesHistogram(histogram, 95, 1, 100, milli, 3);
- assertEquals(2, zeroCount.getDelta());
- assertEquals(1, oneCount.getDelta());
- assertEquals(0, twoCount.getDelta());
-
- RecordHistogram.recordCustomTimesHistogram(histogram, 200, 1, 100, milli, 3);
- assertEquals(2, zeroCount.getDelta());
- assertEquals(1, oneCount.getDelta());
- assertEquals(1, twoCount.getDelta());
- }
-}
« no previous file with comments | « base/android/javatests/src/org/chromium/base/ObserverListTest.java ('k') | base/android/jni_android.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698