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

Unified Diff: content/public/android/javatests/src/org/chromium/content/browser/VSyncMonitorTest.java

Issue 377483002: Remove burst mode from VSyncMonitor. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 5 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 | « AUTHORS ('k') | ui/android/java/src/org/chromium/ui/VSyncMonitor.java » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/public/android/javatests/src/org/chromium/content/browser/VSyncMonitorTest.java
diff --git a/content/public/android/javatests/src/org/chromium/content/browser/VSyncMonitorTest.java b/content/public/android/javatests/src/org/chromium/content/browser/VSyncMonitorTest.java
index 59e0c62ecd4adf3e3edfd00f5cf2cb48307d6586..4e41c8a3bba5a3b94f6b491a68c9299f55799dbf 100644
--- a/content/public/android/javatests/src/org/chromium/content/browser/VSyncMonitorTest.java
+++ b/content/public/android/javatests/src/org/chromium/content/browser/VSyncMonitorTest.java
@@ -21,14 +21,12 @@ public class VSyncMonitorTest extends InstrumentationTestCase {
public int mFrameCount;
public long mLastVSyncCpuTimeMillis;
- private final boolean mActivelyRequestUpdate;
private boolean mDone;
private long mPreviousVSyncTimeMicros;
private Object mSyncRoot = new Object();
- VSyncDataCollector(int frames, boolean activelyRequestUpdate) {
- mFramePeriods = new long[frames];
- mActivelyRequestUpdate = activelyRequestUpdate;
+ VSyncDataCollector(int frames) {
+ mFramePeriods = new long[frames - 1];
}
public boolean isDone() {
@@ -42,7 +40,10 @@ public class VSyncMonitorTest extends InstrumentationTestCase {
mLastVSyncCpuTimeMillis = SystemClock.uptimeMillis();
if (mPreviousVSyncTimeMicros == 0) {
mPreviousVSyncTimeMicros = vsyncTimeMicros;
- return;
+ }
+ else {
+ mFramePeriods[mFrameCount++] = vsyncTimeMicros - mPreviousVSyncTimeMicros;
+ mPreviousVSyncTimeMicros = vsyncTimeMicros;
}
if (mFrameCount >= mFramePeriods.length) {
synchronized (mSyncRoot) {
@@ -51,9 +52,7 @@ public class VSyncMonitorTest extends InstrumentationTestCase {
}
return;
}
- mFramePeriods[mFrameCount++] = vsyncTimeMicros - mPreviousVSyncTimeMicros;
- mPreviousVSyncTimeMicros = vsyncTimeMicros;
- if (mActivelyRequestUpdate) monitor.requestUpdate();
+ monitor.requestUpdate();
}
public void waitTillDone() throws InterruptedException {
@@ -81,14 +80,13 @@ public class VSyncMonitorTest extends InstrumentationTestCase {
// Check that the vsync period roughly matches the timestamps that the monitor generates.
private void performVSyncPeriodTest(boolean enableJBVSync) throws InterruptedException {
// Collect roughly one second of data on a 60 fps display.
- collectAndCheckVSync(enableJBVSync, 60, true);
- collectAndCheckVSync(enableJBVSync, VSyncMonitor.MAX_AUTO_ONVSYNC_COUNT, false);
+ collectAndCheckVSync(enableJBVSync, 60);
}
private void collectAndCheckVSync(
- boolean enableJBVSync, final int totalFrames, final boolean activeFrames)
+ boolean enableJBVSync, final int totalFrames)
throws InterruptedException {
- VSyncDataCollector collector = new VSyncDataCollector(totalFrames, activeFrames);
+ VSyncDataCollector collector = new VSyncDataCollector(totalFrames);
VSyncMonitor monitor = createVSyncMonitor(collector, enableJBVSync);
long reportedFramePeriod = monitor.getVSyncPeriodInMicroseconds();
@@ -98,17 +96,15 @@ public class VSyncMonitorTest extends InstrumentationTestCase {
monitor.requestUpdate();
collector.waitTillDone();
assertTrue(collector.isDone());
- monitor.stop();
// Check that the median frame rate is within 10% of the reported frame period.
- assertTrue(collector.mFrameCount == totalFrames);
+ assertTrue(collector.mFrameCount == totalFrames - 1);
Arrays.sort(collector.mFramePeriods, 0, collector.mFramePeriods.length);
long medianFramePeriod = collector.mFramePeriods[collector.mFramePeriods.length / 2];
if (Math.abs(medianFramePeriod - reportedFramePeriod) > reportedFramePeriod * .1) {
fail("Measured median frame period " + medianFramePeriod
+ " differs by more than 10% from the reported frame period "
- + reportedFramePeriod + " for "
- + (activeFrames ? "requested" : "automatically sent") + " frames");
+ + reportedFramePeriod + " for requested frames");
}
}
@@ -126,13 +122,12 @@ public class VSyncMonitorTest extends InstrumentationTestCase {
// Check that the vsync period roughly matches the timestamps that the monitor generates.
private void performVSyncActivationFromIdle(boolean enableJBVSync) throws InterruptedException {
- VSyncDataCollector collector = new VSyncDataCollector(1, false);
+ VSyncDataCollector collector = new VSyncDataCollector(1);
VSyncMonitor monitor = createVSyncMonitor(collector, enableJBVSync);
monitor.requestUpdate();
collector.waitTillDone();
assertTrue(collector.isDone());
- monitor.stop();
long period = monitor.getVSyncPeriodInMicroseconds() / 1000;
long delay = SystemClock.uptimeMillis() - collector.mLastVSyncCpuTimeMillis;
« no previous file with comments | « AUTHORS ('k') | ui/android/java/src/org/chromium/ui/VSyncMonitor.java » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698