1919 *
2020 */
2121
22- /* global cordova, Windows */
23-
2422exports . defineAutoTests = function ( ) {
25- const isWindows = cordova . platformId === 'windows' ;
26- // Checking existence of accelerometer for windows platform
27- // Assumed that accelerometer always exists on other platforms. Extend
28- // condition to support accelerometer check on other platforms
29- let isAccelExist = isWindows ? Windows . Devices . Sensors . Accelerometer . getDefault ( ) !== null : true ;
30-
3123 describe ( 'Accelerometer (navigator.accelerometer)' , function ( ) {
3224 const fail = function ( done ) {
3325 expect ( true ) . toBe ( false ) ;
@@ -53,10 +45,6 @@ exports.defineAutoTests = function () {
5345 } ) ;
5446
5547 it ( 'accelerometer.spec.3 success callback should be called with an Acceleration object' , function ( done ) {
56- // skip the test if Accelerometer doesn't exist on this device
57- if ( ! isAccelExist ) {
58- pending ( ) ;
59- }
6048 const win = function ( a ) {
6149 expect ( a ) . toBeDefined ( ) ;
6250 expect ( a . x ) . toBeDefined ( ) ;
@@ -73,7 +61,6 @@ exports.defineAutoTests = function () {
7361 const onError = function ( err ) {
7462 console . log ( err ) ;
7563 console . log ( 'Skipping gyroscope tests, marking all as pending.' ) ;
76- isAccelExist = false ;
7764 expect ( true ) . toBe ( true ) ;
7865 done ( ) ;
7966 } ;
@@ -82,10 +69,6 @@ exports.defineAutoTests = function () {
8269 } ) ;
8370
8471 it ( 'accelerometer.spec.4 success callback Acceleration object should have (reasonable) values for x, y and z expressed in m/s^2' , function ( done ) {
85- // skip the test if Accelerometer doesn't exist on this device
86- if ( ! isAccelExist ) {
87- pending ( ) ;
88- }
8972 const reasonableThreshold = 15 ;
9073 const win = function ( a ) {
9174 expect ( a . x ) . toBeLessThan ( reasonableThreshold ) ;
@@ -101,10 +84,6 @@ exports.defineAutoTests = function () {
10184 } ) ;
10285
10386 it ( 'accelerometer.spec.5 success callback Acceleration object should return a recent timestamp' , function ( done ) {
104- // skip the test if Accelerometer doesn't exist on this device
105- if ( ! isAccelExist ) {
106- pending ( ) ;
107- }
10887 const veryRecently = new Date ( ) . getTime ( ) ;
10988 // Need to check that dates returned are not vastly greater than a recent time stamp.
11089 // In case the timestamps returned are ridiculously high
@@ -137,10 +116,6 @@ exports.defineAutoTests = function () {
137116 } ) ;
138117
139118 it ( 'accelerometer.spec.7 success callback should be called with an Acceleration object' , function ( done ) {
140- // skip the test if Accelerometer doesn't exist on this device
141- if ( ! isAccelExist ) {
142- pending ( ) ;
143- }
144119 const win = function ( a ) {
145120 expect ( a ) . toBeDefined ( ) ;
146121 expect ( a . x ) . toBeDefined ( ) ;
@@ -158,10 +133,6 @@ exports.defineAutoTests = function () {
158133 } ) ;
159134
160135 it ( 'accelerometer.spec.8 success callback Acceleration object should have (reasonable) values for x, y and z expressed in m/s^2' , function ( done ) {
161- // skip the test if Accelerometer doesn't exist on this device
162- if ( ! isAccelExist ) {
163- pending ( ) ;
164- }
165136 const reasonableThreshold = 15 ;
166137 const win = function ( a ) {
167138 expect ( a . x ) . toBeLessThan ( reasonableThreshold ) ;
@@ -177,10 +148,6 @@ exports.defineAutoTests = function () {
177148 } ) ;
178149
179150 it ( 'accelerometer.spec.9 success callback Acceleration object should return a recent timestamp' , function ( done ) {
180- // skip the test if Accelerometer doesn't exist on this device
181- if ( ! isAccelExist ) {
182- pending ( ) ;
183- }
184151 const veryRecently = new Date ( ) . getTime ( ) ;
185152 // Need to check that dates returned are not vastly greater than a recent time stamp.
186153 // In case the timestamps returned are ridiculously high
@@ -195,10 +162,6 @@ exports.defineAutoTests = function () {
195162 } ) ;
196163
197164 it ( 'accelerometer.spec.12 success callback should be preserved and called several times' , function ( done ) {
198- // skip the test if Accelerometer doesn't exist on this device
199- if ( ! isAccelExist ) {
200- pending ( ) ;
201- }
202165 let callbacksCallCount = 0 ;
203166 const callbacksCallTestCount = 3 ;
204167
@@ -221,11 +184,6 @@ exports.defineAutoTests = function () {
221184 } ) ;
222185
223186 it ( 'accelerometer.spec.11 should clear an existing watch' , function ( done ) {
224- // skip the test if Accelerometer doesn't exist on this device
225- if ( ! isAccelExist ) {
226- pending ( ) ;
227- }
228-
229187 // expect win to get called exactly once
230188 let win = function ( a ) {
231189 // clear watch on first call
0 commit comments