Best JavaScript code snippet using wpt
SR000GHQBN.test.js
Source:SR000GHQBN.test.js
...112 */113 it('SUB_AUDIO_MANAGER_PR_getDevices_output_001', 0, async function (done) {114 deviceRoleValue = null;115 deviceTypeValue = null;116 const promise = audioManager.getDevices(audio.DeviceFlag.OUTPUT_DEVICES_FLAG)117 promise.then(function (value) {118 console.info('AudioFrameworkTest: Promise: getDevices OUTPUT_DEVICES_FLAG');119 value.forEach(displayDeviceProp);120 if (deviceTypeValue != null && deviceRoleValue != null){121 console.info('AudioFrameworkTest: Promise: getDevices : OUTPUT_DEVICES_FLAG : PASS');122 expect(true).assertTrue();123 }124 else{125 console.info('AudioFrameworkTest: Promise: getDevices : OUTPUT_DEVICES_FLAG : FAIL');126 expect(false).assertTrue();127 }128 });129 await promise;130 done();131 })132 /* *133 * @tc.number : SUB_AUDIO_MANAGER_PR_getDevices_output_enum_002134 * @tc.name : getDevices - Output device - Promise - ENAME -135 * @tc.desc : getDevices - Output device136 * @tc.size : MEDIUM137 * @tc.type : Function138 * @tc.level : Level 0139 */140 it('SUB_AUDIO_MANAGER_PR_getDevices_output_enum_002', 0, async function (done) {141 deviceRoleValue = null;142 deviceTypeValue = null;143 const promise = audioManager.getDevices(1)144 promise.then(function (value) {145 console.info('AudioFrameworkTest: Promise: getDevices OUTPUT_DEVICES_FLAG');146 value.forEach(displayDeviceProp);147 if (deviceTypeValue != null && deviceRoleValue != null){148 console.info('AudioFrameworkTest: Promise: getDevices : OUTPUT_DEVICES_FLAG : PASS');149 expect(true).assertTrue();150 }151 else{152 console.info('AudioFrameworkTest: Promise: getDevices : OUTPUT_DEVICES_FLAG : FAIL');153 expect(false).assertTrue();154 }155 });156 await promise;157 done();158 })159 /* *160 * @tc.number : SUB_AUDIO_MANAGER_PR_getDevices_input_003161 * @tc.name : getDevices - Input device - Promise - ENAME162 * @tc.desc : getDevices - Input device163 * @tc.size : MEDIUM164 * @tc.type : Function165 * @tc.level : Level 0166 */167 it('SUB_AUDIO_MANAGER_PR_getDevices_input_003', 0, async function (done) {168 deviceRoleValue = null;169 deviceTypeValue = null;170 const promise = audioManager.getDevices(audio.DeviceFlag.INPUT_DEVICES_FLAG);171 promise.then(function (value) {172 console.info('AudioFrameworkTest: Promise: getDevices INPUT_DEVICES_FLAG');173 value.forEach(displayDeviceProp);174 if (deviceTypeValue != null && deviceRoleValue != null){175 console.info('AudioFrameworkTest: Promise: getDevices : INPUT_DEVICES_FLAG : PASS');176 expect(true).assertTrue();177 }178 else{179 console.info('AudioFrameworkTest: Promise: getDevices : INPUT_DEVICES_FLAG : FAIL');180 expect(false).assertTrue();181 }182 });183 await promise;184 done();185 })186 /* *187 * @tc.number : SUB_AUDIO_MANAGER_PR_getDevices_input_enum_004188 * @tc.name : getDevices - Input device - Promise - ENAME189 * @tc.desc : getDevices - Input device190 * @tc.size : MEDIUM191 * @tc.type : Function192 * @tc.level : Level 0193 */194 it('SUB_AUDIO_MANAGER_PR_getDevices_input_enum_004', 0, async function (done) {195 deviceRoleValue = null;196 deviceTypeValue = null;197 const promise = audioManager.getDevices(2);198 promise.then(function (value) {199 console.info('AudioFrameworkTest: Promise: getDevices INPUT_DEVICES_FLAG');200 value.forEach(displayDeviceProp);201 if (deviceTypeValue != null && deviceRoleValue != null){202 console.info('AudioFrameworkTest: Promise: getDevices : INPUT_DEVICES_FLAG : PASS');203 expect(true).assertTrue();204 }205 else{206 console.info('AudioFrameworkTest: Promise: getDevices : INPUT_DEVICES_FLAG : FAIL');207 expect(false).assertTrue();208 }209 });210 await promise;211 done();212 })213 /* *214 * @tc.number : SUB_AUDIO_MANAGER_PR_getDevices_all_005215 * @tc.name : getDevices - ALL device - Promise - ENAME216 * @tc.desc : getDevices - ALL device217 * @tc.size : MEDIUM218 * @tc.type : Function219 * @tc.level : Level 0220 */221 it('SUB_AUDIO_MANAGER_PR_getDevices_all_005', 0, async function (done) {222 deviceRoleValue = null;223 deviceTypeValue = null;224 const promise = audioManager.getDevices(audio.DeviceFlag.ALL_DEVICES_FLAG);225 promise.then(function (value) {226 console.info('AudioFrameworkTest: Promise: getDevices ALL_DEVICES_FLAG');227 value.forEach(displayDeviceProp);228 if (deviceTypeValue != null && deviceRoleValue != null){229 console.info('AudioFrameworkTest: Promise: getDevices : ALL_DEVICES_FLAG : PASS');230 expect(true).assertTrue();231 }232 else{233 console.info('AudioFrameworkTest: Promise: getDevices : ALL_DEVICES_FLAG : FAIL');234 expect(false).assertTrue();235 }236 });237 await promise;238 done();239 })240 /* *241 * @tc.number : SUB_AUDIO_MANAGER_PR_getDevices_all_enum_006242 * @tc.name : getDevices - ALL device - Promise - ENAME243 * @tc.desc : getDevices - ALL device244 * @tc.size : MEDIUM245 * @tc.type : Function246 * @tc.level : Level 0247 */248 it('SUB_AUDIO_MANAGER_PR_getDevices_all_enum_006', 0, async function (done) {249 deviceRoleValue = null;250 deviceTypeValue = null;251 const promise = audioManager.getDevices(3);252 promise.then(function (value) {253 console.info('AudioFrameworkTest: Promise: getDevices ALL_DEVICES_FLAG');254 value.forEach(displayDeviceProp);255 if (deviceTypeValue != null && deviceRoleValue != null){256 console.info('AudioFrameworkTest: Promise: getDevices : ALL_DEVICES_FLAG : PASS');257 expect(true).assertTrue();258 }259 else{260 console.info('AudioFrameworkTest: Promise: getDevices : ALL_DEVICES_FLAG : FAIL');261 expect(false).assertTrue();262 }263 });264 await promise;265 done();266 })267 /* *268 * @tc.number : SUB_AUDIO_MANAGER_CB_getDevices_OUT_007269 * @tc.name : getDevices - Output device - Callback - ENAME270 * @tc.desc : getDevices - Output device271 * @tc.size : MEDIUM272 * @tc.type : Function273 * @tc.level : Level 0274 */275 it('SUB_AUDIO_MANAGER_CB_getDevices_OUT_007', 0, async function (done) {276 deviceRoleValue = null;277 deviceTypeValue = null;278 audioManager.getDevices(audio.DeviceFlag.OUTPUT_DEVICES_FLAG, (err, value) => {279 console.info('AudioFrameworkTest: Callback: getDevices OUTPUT_DEVICES_FLAG');280 if (err) {281 console.error(`AudioFrameworkTest: Callback: OUTPUT_DEVICES_FLAG: failed to get devices ${err.message}`);282 expect().assertFail();283 }284 else{285 console.info('AudioFrameworkTest: Callback: getDevices OUTPUT_DEVICES_FLAG');286 value.forEach(displayDeviceProp);287 if (deviceTypeValue != null && deviceRoleValue != null){288 console.info('AudioFrameworkTest: Callback: getDevices : OUTPUT_DEVICES_FLAG : PASS');289 expect(true).assertTrue();290 }291 else{292 console.info('AudioFrameworkTest: Callback: getDevices : OUTPUT_DEVICES_FLAG : FAIL');293 expect(false).assertTrue();294 }295 }296 done();297 });298 })299 /* *300 * @tc.number : SUB_AUDIO_MANAGER_CB_getDevices_OUT_ENUM_008301 * @tc.name : getDevices - Output device - Callback - ENAME302 * @tc.desc : getDevices - Output device303 * @tc.size : MEDIUM304 * @tc.type : Function305 * @tc.level : Level 0306 */307 it('SUB_AUDIO_MANAGER_CB_getDevices_OUT_ENUM_008', 0, async function (done) {308 deviceRoleValue = null;309 deviceTypeValue = null;310 audioManager.getDevices(1, (err, value) => {311 console.info('AudioFrameworkTest: Callback: getDevices OUTPUT_DEVICES_FLAG');312 if (err) {313 console.error(`AudioFrameworkTest: Callback: OUTPUT_DEVICES_FLAG: failed to get devices ${err.message}`);314 expect().assertFail();315 }316 else{317 console.info('AudioFrameworkTest: Callback: getDevices OUTPUT_DEVICES_FLAG');318 value.forEach(displayDeviceProp);319 if (deviceTypeValue != null && deviceRoleValue != null){320 console.info('AudioFrameworkTest: Callback: getDevices : OUTPUT_DEVICES_FLAG : PASS');321 expect(true).assertTrue();322 }323 else{324 console.info('AudioFrameworkTest: Callback: getDevices : OUTPUT_DEVICES_FLAG : FAIL');325 expect(false).assertTrue();326 }327 }328 done();329 });330 })331 /* *332 * @tc.number : SUB_AUDIO_MANAGER_CB_getDevices_INPUT_009333 * @tc.name : getDevices - Input device - Callback - ENAME334 * @tc.desc : getDevices - Input device335 * @tc.size : MEDIUM336 * @tc.type : Function337 * @tc.level : Level 0338 */339 it('SUB_AUDIO_MANAGER_CB_getDevices_INPUT_009', 0, async function (done) {340 deviceRoleValue = null;341 deviceTypeValue = null;342 audioManager.getDevices(audio.DeviceFlag.INPUT_DEVICES_FLAG, (err, value) => {343 console.info('AudioFrameworkTest: Callback: getDevices INPUT_DEVICES_FLAG');344 if (err) {345 console.error(`AudioFrameworkTest: Callback: INPUT_DEVICES_FLAG: failed to get devices ${err.message}`);346 expect().assertFail();347 }348 else{349 console.info('AudioFrameworkTest: Callback: getDevices INPUT_DEVICES_FLAG');350 value.forEach(displayDeviceProp);351 if (deviceTypeValue != null && deviceRoleValue != null){352 console.info('AudioFrameworkTest: Callback: getDevices : INPUT_DEVICES_FLAG: PASS');353 expect(true).assertTrue();354 }355 else{356 console.info('AudioFrameworkTest: Callback: getDevices : INPUT_DEVICES_FLAG: FAIL');357 expect(false).assertTrue();358 }359 }360 done();361 });362 })363 /* *364 * @tc.number : SUB_AUDIO_MANAGER_CB_getDevices_INPUT_ENUM_010365 * @tc.name : getDevices - Input device - Callback - ENAME366 * @tc.desc : getDevices - Input device367 * @tc.size : MEDIUM368 * @tc.type : Function369 * @tc.level : Level 0370 */371 it('SUB_AUDIO_MANAGER_CB_getDevices_INPUT_ENUM_010', 0, async function (done) {372 deviceRoleValue = null;373 deviceTypeValue = null;374 audioManager.getDevices(2, (err, value) => {375 console.info('AudioFrameworkTest: Callback: getDevices INPUT_DEVICES_FLAG');376 if (err) {377 console.error(`AudioFrameworkTest: Callback: INPUT_DEVICES_FLAG: failed to get devices ${err.message}`);378 expect().assertFail();379 }380 else{381 console.info('AudioFrameworkTest: Callback: getDevices INPUT_DEVICES_FLAG');382 value.forEach(displayDeviceProp);383 if (deviceTypeValue != null && deviceRoleValue != null){384 console.info('AudioFrameworkTest: Callback: getDevices : INPUT_DEVICES_FLAG: PASS');385 expect(true).assertTrue();386 }387 else{388 console.info('AudioFrameworkTest: Callback: getDevices : INPUT_DEVICES_FLAG: FAIL');389 expect(false).assertTrue();390 }391 }392 done();393 });394 })395 /* *396 * @tc.number : SUB_AUDIO_MANAGER_CB_getDevices_All_011397 * @tc.name : getDevices - ALL device - Callback - ENAME398 * @tc.desc : getDevices - ALL device399 * @tc.size : MEDIUM400 * @tc.type : Function401 * @tc.level : Level 0402 */403 it('SUB_AUDIO_MANAGER_getDevices_All_011', 0, async function (done) {404 deviceRoleValue = null;405 deviceTypeValue = null;406 audioManager.getDevices(audio.DeviceFlag.ALL_DEVICES_FLAG, (err, value) => {407 console.info('AudioFrameworkTest: Callback: getDevices ALL_DEVICES_FLAG');408 if (err) {409 console.error(`AudioFrameworkTest: Callback: ALL_DEVICES_FLAG: failed to get devices ${err.message}`);410 expect().assertFail();411 }412 else{413 console.info('AudioFrameworkTest: Callback: getDevices ALL_DEVICES_FLAG');414 value.forEach(displayDeviceProp);415 if (deviceTypeValue != null && deviceRoleValue != null){416 console.info('AudioFrameworkTest: Callback: getDevices : ALL_DEVICES_FLAG: PASS');417 expect(true).assertTrue();418 }419 else{420 console.info('AudioFrameworkTest: Callback: getDevices : ALL_DEVICES_FLAG: FAIL');421 expect(false).assertTrue();422 }423 }424 done();425 });426 })427 /* *428 * @tc.number : SUB_AUDIO_MANAGER_CB_getDevices_All_ENUM_012429 * @tc.name : getDevices - ALL device - Callback - ENAME430 * @tc.desc : getDevices - ALL device431 * @tc.size : MEDIUM432 * @tc.type : Function433 * @tc.level : Level 0434 */435 it('SUB_AUDIO_MANAGER_CB_getDevices_All_ENUM_012', 0, async function (done) {436 deviceRoleValue = null;437 deviceTypeValue = null;438 audioManager.getDevices(3, (err, value) => {439 console.info('AudioFrameworkTest: Callback: getDevices ALL_DEVICES_FLAG');440 if (err) {441 console.error(`AudioFrameworkTest: Callback: ALL_DEVICES_FLAG: failed to get devices ${err.message}`);442 expect().assertFail();443 }444 else{445 console.info('AudioFrameworkTest: Callback: getDevices ALL_DEVICES_FLAG');446 value.forEach(displayDeviceProp);447 if (deviceTypeValue != null && deviceRoleValue != null){448 console.info('AudioFrameworkTest: Callback: getDevices : ALL_DEVICES_FLAG: PASS');449 expect(true).assertTrue();450 }451 else{452 console.info('AudioFrameworkTest: Callback: getDevices : ALL_DEVICES_FLAG: FAIL');...
test.js
Source:test.js
...125 deviceName: 'Webcam Mic',126 streamType: 'INPUT'127 }128 };129 chrome.audio.getDevices(chrome.test.callbackPass(function(devices) {130 assertDevicesMatch(kTestDevices, devices);131 }));132 },133 function getDevicesWithEmptyFilterTest() {134 // Test output devices. Maps device ID -> tested device properties.135 var kTestDevices = {136 '30001': {137 id: '30001',138 stableDeviceId: '0',139 displayName: 'Jabra Speaker 1',140 deviceName: 'Jabra Speaker',141 streamType: 'OUTPUT'142 },143 '30002': {144 id: '30002',145 stableDeviceId: '1',146 displayName: 'Jabra Speaker 2',147 deviceName: 'Jabra Speaker',148 streamType: 'OUTPUT'149 },150 '30003': {151 id: '30003',152 stableDeviceId: '2',153 displayName: 'HDA Intel MID',154 deviceName: 'HDMI output',155 streamType: 'OUTPUT'156 },157 '40001': {158 id: '40001',159 stableDeviceId: '3',160 displayName: 'Jabra Mic 1',161 deviceName: 'Jabra Mic',162 streamType: 'INPUT'163 },164 '40002': {165 id: '40002',166 stableDeviceId: '4',167 displayName: 'Jabra Mic 2',168 deviceName: 'Jabra Mic',169 streamType: 'INPUT'170 },171 '40003': {172 id: '40003',173 stableDeviceId: '5',174 displayName: 'Logitech Webcam',175 deviceName: 'Webcam Mic',176 streamType: 'INPUT'177 }178 };179 chrome.audio.getDevices({}, chrome.test.callbackPass(function(devices) {180 assertDevicesMatch(kTestDevices, devices);181 }));182 },183 function getInputDevicesTest() {184 var kTestDevices = {185 '40001': {186 id: '40001',187 streamType: 'INPUT'188 },189 '40002': {190 id: '40002',191 streamType: 'INPUT'192 },193 '40003': {194 id: '40003',195 streamType: 'INPUT'196 }197 };198 chrome.audio.getDevices({199 streamTypes: ['INPUT']200 }, chrome.test.callbackPass(function(devices) {201 assertDevicesMatch(kTestDevices, devices);202 }));203 },204 function getOutputDevicesTest() {205 var kTestDevices = {206 '30001': {207 id: '30001',208 streamType: 'OUTPUT'209 },210 '30002': {211 id: '30002',212 streamType: 'OUTPUT'213 },214 '30003': {215 id: '30003',216 streamType: 'OUTPUT'217 },218 };219 chrome.audio.getDevices({220 streamTypes: ['OUTPUT']221 }, chrome.test.callbackPass(function(devices) {222 assertDevicesMatch(kTestDevices, devices);223 }));224 },225 function getActiveDevicesTest() {226 chrome.audio.getDevices(chrome.test.callbackPass(function(initial) {227 var initialActiveDevices = initial.filter(function(device) {228 return device.isActive;229 });230 chrome.test.assertTrue(initialActiveDevices.length > 0);231 chrome.audio.getDevices({232 isActive: true233 }, chrome.test.callbackPass(function(devices) {234 assertDevicesMatch(235 deviceListToExpectedDevicesMap(initialActiveDevices),236 devices);237 }));238 var initialActiveInputs = initialActiveDevices.filter(function(device) {239 return device.streamType === 'INPUT';240 });241 chrome.test.assertTrue(initialActiveInputs.length > 0);242 chrome.audio.getDevices({243 isActive: true,244 streamTypes: ['INPUT']245 }, chrome.test.callbackPass(function(devices) {246 assertDevicesMatch(247 deviceListToExpectedDevicesMap(initialActiveInputs),248 devices);249 }));250 var initialActiveOutputs = initialActiveDevices.filter(function(device) {251 return device.streamType === 'OUTPUT';252 });253 chrome.test.assertTrue(initialActiveOutputs.length > 0);254 chrome.audio.getDevices({255 isActive: true,256 streamTypes: ['OUTPUT']257 }, chrome.test.callbackPass(function(devices) {258 assertDevicesMatch(259 deviceListToExpectedDevicesMap(initialActiveOutputs),260 devices);261 }));262 }));263 },264 function getInactiveDevicesTest() {265 chrome.audio.getDevices(chrome.test.callbackPass(function(initial) {266 var initialInactiveDevices = initial.filter(function(device) {267 return !device.isActive;268 });269 chrome.test.assertTrue(initialInactiveDevices.length > 0);270 chrome.audio.getDevices({271 isActive: false272 }, chrome.test.callbackPass(function(devices) {273 assertDevicesMatch(274 deviceListToExpectedDevicesMap(initialInactiveDevices),275 devices);276 }));277 }));278 },279 function setPropertiesTest() {280 chrome.audio.getDevices(chrome.test.callbackPass(function(initial) {281 var expectedDevices = deviceListToExpectedDevicesMap(initial);282 // Update expected input devices with values that should be changed in283 // test.284 var updatedInput = expectedDevices['40002'];285 chrome.test.assertFalse(updatedInput.gain === 65);286 updatedInput.level = 65;287 // Update expected output devices with values that should be changed in288 // test.289 var updatedOutput = expectedDevices['30001'];290 chrome.test.assertFalse(updatedOutput.volume === 45);291 updatedOutput.level = 45;292 chrome.audio.setProperties('30001', {293 level: 45294 }, chrome.test.callbackPass(function() {295 chrome.audio.setProperties('40002', {296 level: 65297 }, chrome.test.callbackPass(function() {298 chrome.audio.getDevices(chrome.test.callbackPass(function(devices) {299 assertDevicesMatch(expectedDevices, devices);300 }));301 }));302 }));303 }));304 },305 function inputMuteTest() {306 var getMute = function(callback) {307 chrome.audio.getMute('INPUT', chrome.test.callbackPass(callback));308 };309 getMute(function(originalValue) {310 chrome.audio.setMute(311 'INPUT', !originalValue, chrome.test.callbackPass(function() {312 getMute(function(value) {313 chrome.test.assertEq(!originalValue, value);314 });315 }));316 });317 },318 function outputMuteTest() {319 var getMute = function(callback) {320 chrome.audio.getMute('OUTPUT', chrome.test.callbackPass(callback));321 };322 getMute(function(originalValue) {323 chrome.audio.setMute(324 'OUTPUT', !originalValue, chrome.test.callbackPass(function() {325 getMute(function(value) {326 chrome.test.assertEq(!originalValue, value);327 });328 }));329 });330 },331 function setActiveDevicesTest() {332 chrome.audio.setActiveDevices({333 input: ['40002', '40003'],334 output: ['30001']335 }, chrome.test.callbackPass(function() {336 chrome.audio.getDevices({337 isActive: true338 }, chrome.test.callbackPass(function(activeDevices) {339 chrome.test.assertEq(['30001', '40002', '40003'],340 getDeviceIds(activeDevices));341 }));342 }));343 },344 function setActiveDevicesOutputOnlyTest() {345 chrome.audio.getDevices({346 streamTypes: ['INPUT'],347 isActive: true348 }, chrome.test.callbackPass(function(initial) {349 var initialActiveInputs = getDeviceIds(initial);350 chrome.test.assertTrue(initialActiveInputs.length > 0);351 chrome.audio.setActiveDevices({352 output: ['30003']353 }, chrome.test.callbackPass(function() {354 chrome.audio.getDevices({355 isActive: true356 }, chrome.test.callbackPass(function(devices) {357 var expected = ['30003'].concat(initialActiveInputs).sort();358 chrome.test.assertEq(expected, getDeviceIds(devices));359 }));360 }));361 }));362 },363 function setActiveDevicesFailInputTest() {364 chrome.audio.getDevices({365 isActive: true366 }, chrome.test.callbackPass(function(initial) {367 var initialActiveIds = getDeviceIds(initial);368 chrome.test.assertTrue(initialActiveIds.length > 0);369 chrome.audio.setActiveDevices({370 input: ['0000000'], /* does not exist */371 output: []372 }, chrome.test.callbackFail('Failed to set active devices.', function() {373 chrome.audio.getDevices({374 isActive: true375 }, chrome.test.callbackPass(function(devices) {376 chrome.test.assertEq(initialActiveIds, getDeviceIds(devices));377 }));378 }));379 }));380 },381 function setActiveDevicesFailOutputTest() {382 chrome.audio.getDevices({383 isActive: true384 }, chrome.test.callbackPass(function(initial) {385 var initialActiveIds = getDeviceIds(initial);386 chrome.test.assertTrue(initialActiveIds.length > 0);387 chrome.audio.setActiveDevices({388 input: [],389 output: ['40001'] /* id is input node ID */390 }, chrome.test.callbackFail('Failed to set active devices.', function() {391 chrome.audio.getDevices({392 isActive: true393 }, chrome.test.callbackPass(function(devices) {394 chrome.test.assertEq(initialActiveIds, getDeviceIds(devices));395 }));396 }));397 }));398 },399 function clearActiveDevicesTest() {400 chrome.audio.getDevices({401 isActive: true402 }, chrome.test.callbackPass(function(initial) {403 chrome.test.assertTrue(getDeviceIds(initial).length > 0);404 chrome.audio.setActiveDevices({405 input: [],406 output: []407 }, chrome.test.callbackPass(function() {408 chrome.audio.getDevices({409 isActive: true410 }, chrome.test.callbackPass(function(devices) {411 chrome.test.assertEq([], devices);412 }));413 }));414 }));415 },416 function verifyNoDeviceChangedEvents() {417 chrome.test.assertTrue(!!deviceChangedListener);418 chrome.test.assertEq(0, deviceChangedListener.eventCount);419 deviceChangedListener.reset();420 deviceChangedListener = null;421 chrome.test.succeed();422 },423 // Tests verifying the app doesn't have access to deprecated part of the API:424 function deprecated_GetInfoTest() {425 chrome.audio.getInfo(chrome.test.callbackFail(426 'audio.getInfo is deprecated, use audio.getDevices instead.'));427 },428 function deprecated_setProperties_isMuted() {429 chrome.audio.getDevices(chrome.test.callbackPass(function(initial) {430 var expectedDevices = deviceListToExpectedDevicesMap(initial);431 var expectedError =432 '|isMuted| property is deprecated, use |audio.setMute|.';433 chrome.audio.setProperties('30001', {434 isMuted: true,435 // Output device - should have volume set.436 level: 55437 }, chrome.test.callbackFail(expectedError, function() {438 // Assert that device properties haven't changed.439 chrome.audio.getDevices(chrome.test.callbackPass(function(devices) {440 assertDevicesMatch(expectedDevices, devices);441 }));442 }));443 }));444 },445 function deprecated_setProperties_volume() {446 chrome.audio.getDevices(chrome.test.callbackPass(function(initial) {447 var expectedDevices = deviceListToExpectedDevicesMap(initial);448 var expectedError = '|volume| property is deprecated, use |level|.';449 chrome.audio.setProperties('30001', {450 volume: 2,451 // Output device - should have volume set.452 level: 55453 }, chrome.test.callbackFail(expectedError, function() {454 // Assert that device properties haven't changed.455 chrome.audio.getDevices(chrome.test.callbackPass(function(devices) {456 assertDevicesMatch(expectedDevices, devices);457 }));458 }));459 }));460 },461 function deprecated_setProperties_gain() {462 chrome.audio.getDevices(chrome.test.callbackPass(function(initial) {463 var expectedDevices = deviceListToExpectedDevicesMap(initial);464 var expectedError = '|gain| property is deprecated, use |level|.';465 chrome.audio.setProperties('40001', {466 gain: 2,467 // Output device - should have volume set.468 level: 55469 }, chrome.test.callbackFail(expectedError, function() {470 // Assert that device properties haven't changed.471 chrome.audio.getDevices(chrome.test.callbackPass(function(devices) {472 assertDevicesMatch(expectedDevices, devices);473 }));474 }));475 }));476 },477 function deprecated_SetActiveDevicesTest() {478 var kExpectedError =479 'String list |ids| is deprecated, use DeviceIdLists type.';480 chrome.audio.setActiveDevices([481 '30003',482 '40002'483 ], chrome.test.callbackFail(kExpectedError));484 },485]);
Using AI Code Generation
1var wptoolkit = require('wptoolkit');2wptoolkit.getDevices(function(devices){3 console.log(devices);4});5{6 "dependencies": {7 }8}
Using AI Code Generation
1var wptools = require('wp-tools');2wptools.getDevices(function (err, devices) {3 if (err) {4 console.log(err);5 }6 console.log(devices);7});8var wptools = require('wp-tools');9wptools.getDevice('iPhone 5', function (err, device) {10 if (err) {11 console.log(err);12 }13 console.log(device);14});15var wptools = require('wp-tools');16wptools.getDeviceCategories(function (err, deviceCategories) {17 if (err) {18 console.log(err);19 }20 console.log(deviceCategories);21});22var wptools = require('wp-tools');23wptools.getDeviceCategory('Apple', function (err, deviceCategory) {24 if (err) {25 console.log(err);26 }27 console.log(deviceCategory);28});29var wptools = require('wp-tools');30wptools.getDeviceCategoryDevices('Apple', function (err, devices) {31 if (err) {32 console.log(err);33 }34 console.log(devices);35});36var wptools = require('wp-tools');37wptools.getDeviceCategoryDevice('Apple', 'iPhone 5', function (err, device) {38 if (err) {39 console.log(err);40 }41 console.log(device);42});43var wptools = require('wp-tools');44wptools.getDeviceCategoryDeviceVersions('Apple', 'iPhone 5', function (err, versions) {45 if (err) {
Using AI Code Generation
1const wptools = require('wp-tools');2wptools.getDevices(function(devices) {3 console.log(devices);4});5const wptools = require('wp-tools');6wptools.getEmulators(function(emulators) {7 console.log(emulators);8});9const wptools = require('wp-tools');10wptools.getDevicesAndEmulators(function(devicesAndEmulators) {11 console.log(devicesAndEmulators);12});13const wptools = require('wp-tools');14wptools.getDevice('Nexus 5', function(device) {15 console.log(device);16});17const wptools = require('wp-tools');18wptools.getEmulator('Nexus_5X_API_23', function(emulator) {19 console.log(emulator);20});21const wptools = require('wp-tools');22wptools.getDeviceAndEmulator('Nexus 5', function(deviceAndEmulator) {23 console.log(deviceAndEmulator);24});25const wptools = require('wp-tools');26wptools.getDeviceAndEmulator('Nexus 5', function(deviceAndEmulator) {27 console.log(deviceAndEmulator);28});29const wptools = require('wp-tools');30wptools.getDeviceAndEmulator('Nexus 5', function(deviceAndEmulator) {31 console.log(deviceAndEmulator);32});
Using AI Code Generation
1var wptools = require('wptools');2var devices = require('wptools/lib/devices.json');3var device = devices['iPhone 5'];4var options = {5};6wptools.getDevices(options, function (err, devices) {7 if (err) {8 console.log(err);9 } else {10 console.log(devices);11 }12});
Learn to execute automation testing from scratch with LambdaTest Learning Hub. Right from setting up the prerequisites to run your first automation test, to following best practices and diving deeper into advanced test scenarios. LambdaTest Learning Hubs compile a list of step-by-step guides to help you be proficient with different test automation frameworks i.e. Selenium, Cypress, TestNG etc.
You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.
Get 100 minutes of automation test minutes FREE!!