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

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

Issue 2418923003: ImageCapture: avoid several grabFrame()s in flight, beef up content_browsertests (Closed)
Patch Set: xianglu@ comments Created 4 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 | « content/renderer/media/image_capture_frame_grabber.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/test/data/media/image_capture_test.html
diff --git a/content/test/data/media/image_capture_test.html b/content/test/data/media/image_capture_test.html
index 2ed74495c716b2719231972fbb6b1a7f142c1a4f..0dbd39b3cc7c594407fd447eccdd24c51fa7ad1a 100644
--- a/content/test/data/media/image_capture_test.html
+++ b/content/test/data/media/image_capture_test.html
@@ -6,10 +6,12 @@ B<!DOCTYPE html>
<body>
<script type="text/javascript" src="webrtc_test_utilities.js"></script>
<script>
+const HEIGHT = 180;
+const WIDTH = 320;
// Runs an ImageCapture.getPhotoCapabilities().
function testCreateAndGetCapabilities() {
- const constraints = { mandatory: { maxHeight: 180, maxWidth: 320 } };
+ const constraints = { mandatory: { maxHeight: HEIGHT, maxWidth: WIDTH } };
navigator.mediaDevices.getUserMedia({"video" : constraints})
.then(stream => {
assertEquals('video', stream.getVideoTracks()[0].kind);
@@ -38,7 +40,7 @@ function testCreateAndGetCapabilities() {
// Runs an ImageCapture.takePhoto().
function testCreateAndTakePhoto() {
- const constraints = { mandatory: { maxHeight: 180, maxWidth: 320 } };
+ const constraints = { mandatory: { maxHeight: HEIGHT, maxWidth: WIDTH } };
navigator.mediaDevices.getUserMedia({"video" : constraints})
.then(stream => {
assertEquals('video', stream.getVideoTracks()[0].kind);
@@ -58,6 +60,28 @@ function testCreateAndTakePhoto() {
});
}
+// Runs an ImageCapture.grabFrame().
+function testCreateAndGrabFrame() {
+ const constraints = { mandatory: { maxHeight: HEIGHT, maxWidth: WIDTH } };
+ navigator.mediaDevices.getUserMedia({"video" : constraints})
+ .then(stream => {
+ assertEquals('video', stream.getVideoTracks()[0].kind);
+ return new ImageCapture(stream.getVideoTracks()[0]);
+ })
+ .then(capturer => {
+ return capturer.grabFrame();
+ })
+ .then(imageBitmap => {
+ assertEquals(WIDTH, imageBitmap.width);
+ assertEquals(HEIGHT, imageBitmap.height);
+
+ reportTestSuccess();
+ })
+ .catch(err => {
+ return failTest(err.toString());
+ });
+}
+
</script>
</body>
</html>
« no previous file with comments | « content/renderer/media/image_capture_frame_grabber.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698