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

Unified Diff: content/test/data/media/getusermedia.html

Issue 638423002: Massively speed up aspect ratio-detecting WebRTC tests. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebased Created 6 years, 2 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 | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/test/data/media/getusermedia.html
diff --git a/content/test/data/media/getusermedia.html b/content/test/data/media/getusermedia.html
index 2287117812d71c93b94320ff1d011ce073ee94ce..f12767173523f7b5aa145649e7c007c5aeba00a8 100644
--- a/content/test/data/media/getusermedia.html
+++ b/content/test/data/media/getusermedia.html
@@ -388,9 +388,8 @@
var maxLightGreenPixelsX = 0;
var maxLightGreenPixelsY = 0;
- // TODO(phoglund): don't iterate 10 times - too slow on Windows.
- var iterations = 0;
- var maxIterations = 10;
+ var attempt = 0;
+ var maxAttempts = 10;
var detectorFunction = function() {
var width = videoElement.videoWidth;
@@ -427,23 +426,27 @@
if (lightGreenPixelsY > maxLightGreenPixelsY)
maxLightGreenPixelsY = lightGreenPixelsY;
- if (++iterations > maxIterations) {
- clearInterval(detectorInterval);
- // Allow maxLightGreenPixelsY = maxLightGreenPixelsX +-1 due to
- // possible subpixel rendering on Mac and Android.
- if (maxLightGreenPixelsY > maxLightGreenPixelsX + 1 ||
- maxLightGreenPixelsY < maxLightGreenPixelsX -1 ||
- maxLightGreenPixelsY == 0 ||
- maxLightGreenPixelsX == width / 2 ||
- maxLightGreenPixelsY == height / 2) {
+ // Allow maxLightGreenPixelsY = maxLightGreenPixelsX +-1 due to
+ // possible subpixel rendering on Mac and Android.
+ if (maxLightGreenPixelsY > maxLightGreenPixelsX + 1 ||
+ maxLightGreenPixelsY < maxLightGreenPixelsX -1 ||
+ maxLightGreenPixelsY == 0 ||
+ maxLightGreenPixelsX == width / 2 ||
+ maxLightGreenPixelsY == height / 2) {
+ if (++attempt > maxAttempts) {
+ clearInterval(detectorInterval);
failTest("Aspect ratio corrupted. X " + maxLightGreenPixelsX +
- " Y " + maxLightGreenPixelsY);
+ " Y " + maxLightGreenPixelsY);
+ }
+ else {
+ // We have a bad aspect ratio now; give a chance to shape up.
+ return;
}
-
- var result = "w=" + width + ":h=" + height;
- console.log(result);
- callback(result);
}
+
+ clearInterval(detectorInterval);
+ var result = "w=" + width + ":h=" + height;
+ callback(result);
}
var detectorInterval = setInterval(detectorFunction, 50);
}
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698