OLD | NEW |
1 'use strict'; | 1 'use strict'; |
2 | 2 |
3 function vibration_mocks(mojo) { | 3 function vibration_mocks(mojo) { |
4 return define( | 4 return define( |
5 'VibrationManager mocks', | 5 'VibrationManager mocks', |
6 [ | 6 [ |
7 'mojo/public/js/bindings', | 7 'mojo/public/js/bindings', |
8 'device/vibration/vibration_manager.mojom', | |
9 'services/device/public/interfaces/constants.mojom', | 8 'services/device/public/interfaces/constants.mojom', |
| 9 'services/device/public/interfaces/vibration_manager.mojom', |
10 ], | 10 ], |
11 (bindings, vibrationManager, deviceConstants) => { | 11 (bindings, deviceConstants, vibrationManager) => { |
12 class MockVibrationManager { | 12 class MockVibrationManager { |
13 constructor() { | 13 constructor() { |
14 this.bindingSet = | 14 this.bindingSet = |
15 new bindings.BindingSet(vibrationManager.VibrationManager); | 15 new bindings.BindingSet(vibrationManager.VibrationManager); |
16 | 16 |
17 this.vibrate_milliseconds_ = -1; | 17 this.vibrate_milliseconds_ = -1; |
18 this.cancelled_ = false; | 18 this.cancelled_ = false; |
19 } | 19 } |
20 | 20 |
21 vibrate(milliseconds) { | 21 vibrate(milliseconds) { |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
61 function vibration_test(func, name, properties) { | 61 function vibration_test(func, name, properties) { |
62 mojo_test( | 62 mojo_test( |
63 mojo => vibration_mocks(mojo).then(vibration => { | 63 mojo => vibration_mocks(mojo).then(vibration => { |
64 let result = Promise.resolve(func(vibration)); | 64 let result = Promise.resolve(func(vibration)); |
65 let cleanUp = () => vibration.mockVibrationManager.reset(); | 65 let cleanUp = () => vibration.mockVibrationManager.reset(); |
66 result.then(cleanUp, cleanUp); | 66 result.then(cleanUp, cleanUp); |
67 return result; | 67 return result; |
68 }), | 68 }), |
69 name, properties); | 69 name, properties); |
70 } | 70 } |
OLD | NEW |