@@ -68,31 +68,32 @@ CamResolutionsTest.prototype = {
68
68
height : { exact : resolution [ 1 ] }
69
69
}
70
70
} ;
71
- navigator . mediaDevices . getUserMedia ( constraints )
72
- . then ( function ( stream ) {
73
- // Do not check actual video frames when more than one resolution is
74
- // provided.
75
- if ( this . resolutions . length > 1 ) {
76
- this . test . reportSuccess ( 'Supported: ' + resolution [ 0 ] + 'x' +
77
- resolution [ 1 ] ) ;
78
- stream . getTracks ( ) . forEach ( function ( track ) {
79
- track . stop ( ) ;
80
- } ) ;
81
- this . maybeContinueGetUserMedia ( ) ;
82
- } else {
83
- this . collectAndAnalyzeStats_ ( stream , resolution ) ;
84
- }
85
- } . bind ( this ) )
86
- . catch ( function ( error ) {
87
- if ( this . resolutions . length > 1 ) {
88
- this . test . reportInfo ( resolution [ 0 ] + 'x' + resolution [ 1 ] +
71
+
72
+ doGetUserMedia ( constraints , onSuccess . bind ( this ) , onFail . bind ( this ) ) ;
73
+
74
+ function onSuccess ( stream ) {
75
+ if ( this . resolutions . length > 1 ) {
76
+ this . test . reportSuccess ( 'Supported: ' + resolution [ 0 ] + 'x' +
77
+ resolution [ 1 ] ) ;
78
+ stream . getTracks ( ) . forEach ( function ( track ) {
79
+ track . stop ( ) ;
80
+ } ) ;
81
+ this . maybeContinueGetUserMedia ( ) ;
82
+ } else {
83
+ this . collectAndAnalyzeStats_ ( stream , resolution ) ;
84
+ }
85
+ } ;
86
+
87
+ function onFail ( error ) {
88
+ if ( this . resolutions . length > 1 ) {
89
+ this . test . reportInfo ( resolution [ 0 ] + 'x' + resolution [ 1 ] +
89
90
' not supported' ) ;
90
- } else {
91
- this . test . reportError ( 'getUserMedia failed with error: ' +
92
- error . name ) ;
93
- }
94
- this . maybeContinueGetUserMedia ( ) ;
95
- } . bind ( this ) ) ;
91
+ } else {
92
+ this . test . reportError ( 'getUserMedia failed with error: ' +
93
+ error ) ;
94
+ }
95
+ this . maybeContinueGetUserMedia ( ) ;
96
+ } ;
96
97
} ,
97
98
98
99
maybeContinueGetUserMedia : function ( ) {
@@ -102,6 +103,31 @@ CamResolutionsTest.prototype = {
102
103
}
103
104
this . startGetUserMedia ( this . resolutions [ this . currentResolution ++ ] ) ;
104
105
} ,
106
+
107
+ onSuccess : function ( stream ) {
108
+ if ( this . resolutions . length > 1 ) {
109
+ this . test . reportSuccess ( 'Supported: ' + resolution [ 0 ] + 'x' +
110
+ resolution [ 1 ] ) ;
111
+ stream . getTracks ( ) . forEach ( function ( track ) {
112
+ track . stop ( ) ;
113
+ } ) ;
114
+ this . maybeContinueGetUserMedia ( ) ;
115
+ } else {
116
+ this . collectAndAnalyzeStats_ ( stream , resolution ) ;
117
+ }
118
+ } ,
119
+
120
+ onFail : function ( error ) {
121
+ if ( this . resolutions . length > 1 ) {
122
+ this . test . reportInfo ( resolution [ 0 ] + 'x' + resolution [ 1 ] +
123
+ ' not supported' ) ;
124
+ } else {
125
+ this . test . reportError ( 'getUserMedia failed with error: ' +
126
+ error . name ) ;
127
+ }
128
+ this . maybeContinueGetUserMedia ( ) ;
129
+ } ,
130
+
105
131
106
132
collectAndAnalyzeStats_ : function ( stream , resolution ) {
107
133
var tracks = stream . getVideoTracks ( ) ;
0 commit comments