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

Side by Side Diff: third_party/WebKit/LayoutTests/fast/mediastream/MediaStreamTrack-getSettings.html

Issue 2742893003: Let getSettings() return the constrained track resolution, not source. (Closed)
Patch Set: Use common target size calculation Created 3 years, 9 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 unified diff | Download patch
OLDNEW
1 <!DOCTYPE HTML> 1 <!DOCTYPE HTML>
2 <script src="../../resources/testharness.js"></script> 2 <script src="../../resources/testharness.js"></script>
3 <script src="../../resources/testharnessreport.js"></script> 3 <script src="../../resources/testharnessreport.js"></script>
4 <script> 4 <script>
5 5
6 promise_test(function() { 6 promise_test(function() {
7 return navigator.mediaDevices.getUserMedia({audio: true}) 7 return navigator.mediaDevices.getUserMedia({audio: true})
8 .then(function(s) { 8 .then(function(s) {
9 settings = s.getAudioTracks()[0].getSettings(); 9 settings = s.getAudioTracks()[0].getSettings();
10 assert_greater_than(Object.keys(settings).length, 0); 10 assert_greater_than(Object.keys(settings).length, 0);
(...skipping 28 matching lines...) Expand all
39 assert_true('frameRate' in settings, 39 assert_true('frameRate' in settings,
40 'Frame rate missing: ' + JSON.stringify(settings)); 40 'Frame rate missing: ' + JSON.stringify(settings));
41 assert_true('width' in settings, 41 assert_true('width' in settings,
42 'Width missing: ' + JSON.stringify(settings)); 42 'Width missing: ' + JSON.stringify(settings));
43 assert_true('height' in settings, 43 assert_true('height' in settings,
44 'Height missing: ' + JSON.stringify(settings)); 44 'Height missing: ' + JSON.stringify(settings));
45 }); 45 });
46 }, 'A video track returns the expected variables'); 46 }, 'A video track returns the expected variables');
47 47
48 promise_test(function() { 48 promise_test(function() {
49 track1 = null;
50 track2 = null;
51 return navigator.mediaDevices.getUserMedia({video: true})
52 .then(function(s1) {
53 track1 = s1.getVideoTracks()[0];
54 settings1 = track1.getSettings();
55 // We ask for the second track to have half the width of the first one,
56 // but the same source.
57 // This should cause a scaling factor to be applied.
58 constraints2 = {deviceId: settings1.deviceId,
59 width: { max: settings1.width / 2 }};
60 console.log(JSON.stringify(constraints2));
61 return navigator.mediaDevices.getUserMedia({video: constraints2});
62 })
63 .then(function(s) {
64 track2 = s.getVideoTracks()[0];
65 console.log(JSON.stringify(track2.getConstraints()));
66 settings = track2.getSettings();
67 settings1 = track1.getSettings();
68 // This test does not work in testharness due to limitations in mocking.
69 // The Web-Platform-Test that does the same thing passes when run
70 // in a browser.
71 // BUG=to-be-assigned
72 // assert_equals(settings.deviceId, settings1.deviceId);
73 // assert_equals(settings.width, settings1.width / 2,
Guido Urdaneta 2017/03/13 14:12:37 would it make sense to make a content_browsertest?
hta - Chromium 2017/03/13 15:04:35 Probably. Does content_browsertest fully support c
Guido Urdaneta 2017/03/13 15:08:24 Yes, it does.
74 // 'widths are not 2x different: ' +
75 // JSON.stringify(settings) + ' ' + JSON.stringify(settings1));
76 });
77 }, 'Two video tracks with the same source but different scaling are different');
78
79 promise_test(function() {
49 return navigator.mediaDevices.getUserMedia({audio: true, video: true}) 80 return navigator.mediaDevices.getUserMedia({audio: true, video: true})
50 .then(function(s) { 81 .then(function(s) {
51 videoSettings = s.getVideoTracks()[0].getSettings(); 82 videoSettings = s.getVideoTracks()[0].getSettings();
52 audioSettings = s.getAudioTracks()[0].getSettings(); 83 audioSettings = s.getAudioTracks()[0].getSettings();
53 assert_not_equals(videoSettings.deviceId, audioSettings.deviceId, 84 assert_not_equals(videoSettings.deviceId, audioSettings.deviceId,
54 'video and audio device IDs should be different') 85 'video and audio device IDs should be different')
55 }); 86 });
56 }, 'Video and audio device IDs are different'); 87 }, 'Video and audio device IDs are different');
57 88
58 promise_test(function() { 89 promise_test(function() {
(...skipping 19 matching lines...) Expand all
78 }) 109 })
79 .catch(function(e) { 110 .catch(function(e) {
80 console.log('Fake devices are not functional yet.'); 111 console.log('Fake devices are not functional yet.');
81 // TODO(hta): Finish creation of fake devices. Until then, accept failure. 112 // TODO(hta): Finish creation of fake devices. Until then, accept failure.
82 // crbug.com/678561 113 // crbug.com/678561
83 assert_equals(e.name, 'TypeError', "Check crbug.com/678561"); 114 assert_equals(e.name, 'TypeError', "Check crbug.com/678561");
84 }); 115 });
85 }, 'With a fake user-facing device, facing mode is matched') 116 }, 'With a fake user-facing device, facing mode is matched')
86 117
87 </script> 118 </script>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698