(inputsRecord)
| 588 | } |
| 589 | |
| 590 | function replayInputs(inputsRecord) { |
| 591 | assert( |
| 592 | inputsRecord.version === _INPUTS_RECORD_VERSION, |
| 593 | 'Not supported inputs record version. expect' + _INPUTS_RECORD_VERSION + ' Need to re-record.' |
| 594 | ); |
| 595 | for (var idx = 0; idx < inputsRecord.operations.length; idx++) { |
| 596 | var opItem = inputsRecord.operations[idx]; |
| 597 | findInputCreatedAndCheck(opItem.id, {throw: true}); |
| 598 | assert( |
| 599 | !shouldPrevent(opItem.id, NANES_PREVENT_RECORD_INPUTS), |
| 600 | 'Input (id:' + opItem.id + ') has prevented recording. This may caused by test case change.' |
| 601 | ); |
| 602 | var inputRecorderWrapper = _inputRecorderWrapperMap[opItem.id]; |
| 603 | assert(inputRecorderWrapper); |
| 604 | assert(getType(opItem.op) === 'string', 'Invalid op: ' + opItem.op); |
| 605 | var listenerDefine = inputRecorderWrapper.listenerDefineMap[opItem.op]; |
| 606 | assert( |
| 607 | listenerDefine, |
| 608 | 'Can not find listener by op: ' + opItem.op + ' This may caused by test case change.' |
| 609 | ); |
| 610 | var prepared = {this: [], arguments: {}}; |
| 611 | if (listenerDefine.prepareReplay) { |
| 612 | prepared = listenerDefine.prepareReplay(opItem.args); |
| 613 | assert( |
| 614 | isObject(prepared) |
| 615 | && prepared.hasOwnProperty('this') |
| 616 | && getType(prepared.arguments) === 'array', |
| 617 | '`prepareReplay` must return an object: {this: any, arguments: []}.' |
| 618 | ); |
| 619 | } |
| 620 | listenerDefine.listener.apply(prepared.this, prepared.arguments); |
| 621 | } |
| 622 | } |
| 623 | |
| 624 | function makeInputRecorder() { |
| 625 | var _inputId = null; |
nothing calls this directly
no test coverage detected
searching dependent graphs…