Publish Vulpes Preview 15 sources for desktop, Android and Tundra
Share Gaia assets and adapters, keep private profiles and development documents local, and update both public READMEs.
This commit is contained in:
parent
93e3a48004
commit
b38dea0597
25901 changed files with 9982925 additions and 369 deletions
80
gaia/shared/test/unit/mocks/mock_icc_helper.js
Executable file
80
gaia/shared/test/unit/mocks/mock_icc_helper.js
Executable file
|
|
@ -0,0 +1,80 @@
|
|||
'use strict';
|
||||
/* exported MockIccHelper */
|
||||
|
||||
var MockIccHelper = {
|
||||
mProps: {'cardState': null, 'iccInfo': {}, 'retryCount': 0},
|
||||
|
||||
mEventListeners: {'cardstatechange': [], 'iccinfochange': []},
|
||||
|
||||
mSetup: function icch_suite_setup() {
|
||||
this.mProps = {
|
||||
'cardState': null,
|
||||
'iccInfo': {},
|
||||
'retryCount': 0
|
||||
};
|
||||
this.mEventListeners = {'cardstatechange': [], 'iccinfochange': []};
|
||||
},
|
||||
|
||||
mTeardown: function icch_teardown() {
|
||||
this.mProps = {};
|
||||
this.mEventListeners = {};
|
||||
},
|
||||
|
||||
mTriggerEventListeners: function icch_triggerEventListeners(type, evt) {
|
||||
if (!this.mEventListeners[type]) {
|
||||
return;
|
||||
}
|
||||
this.mEventListeners[type].forEach(function(callback) {
|
||||
if (typeof callback === 'function') {
|
||||
callback(evt);
|
||||
} else if (typeof callback == 'object' &&
|
||||
typeof callback.handleEvent === 'function') {
|
||||
callback.handleEvent(evt);
|
||||
}
|
||||
});
|
||||
|
||||
if (typeof this['on' + type] === 'function') {
|
||||
this['on' + type](evt);
|
||||
}
|
||||
},
|
||||
|
||||
get cardState() {
|
||||
return this.mProps.cardState;
|
||||
},
|
||||
|
||||
get iccInfo() {
|
||||
return this.mProps.iccInfo;
|
||||
},
|
||||
|
||||
getCardLockRetryCount: function(lockType, onresult) {
|
||||
onresult(this.mProps.retryCount);
|
||||
},
|
||||
|
||||
setProperty: function _setProperty(property, newState) {
|
||||
this.mProps[property] = newState;
|
||||
},
|
||||
|
||||
addEventListener: function icch_addEventListener(type, callback) {
|
||||
if (this.mEventListeners[type]) {
|
||||
this.mEventListeners[type][this.mEventListeners[type].length] = callback;
|
||||
}
|
||||
},
|
||||
|
||||
removeEventListener: function icch_removeEventListener(type, callback) {
|
||||
if (this.mEventListeners[type]) {
|
||||
var idx = this.mEventListeners[type].indexOf(callback);
|
||||
this.mEventListeners[type].splice(idx, 1);
|
||||
}
|
||||
},
|
||||
|
||||
unlockCardLock: function() {
|
||||
var settingsRequest = {
|
||||
result: {},
|
||||
set onsuccess(callback) {
|
||||
callback.call(this);
|
||||
},
|
||||
set onerror(callback) {}
|
||||
};
|
||||
return settingsRequest;
|
||||
}
|
||||
};
|
||||
Loading…
Reference in a new issue