Closed
Bug 1034522
Opened 10 years ago
Closed 8 years ago
B2G Emulator: Add console command - sim status
Categories
(Firefox OS Graveyard :: Emulator, defect)
Tracking
(Not tracked)
RESOLVED
INCOMPLETE
People
(Reporter: aknow, Assigned: aknow)
References
Details
Attachments
(2 files, 2 obsolete files)
Add a console command to alter sim status. It could be used for testing empty sim as following steps:
1. send emulator console command "sim status absent"
2. turn radio off and on
Assignee | ||
Comment 1•10 years ago
|
||
Attachment #8450870 -
Flags: review?(vyang)
Comment 2•10 years ago
|
||
Comment on attachment 8450870 [details] [review]
platform_external_qemu: PR #106
Looks good to me, but I need test cases to see how this works actually before placing a review comment.
Assignee | ||
Comment 4•10 years ago
|
||
I modify the card state test to show an example of using this console command.
Attachment #8455999 -
Flags: feedback?(vyang)
Flags: needinfo?(szchen)
Comment 5•10 years ago
|
||
Comment on attachment 8455999 [details] [diff] [review]
card state test
Review of attachment 8455999 [details] [diff] [review]:
-----------------------------------------------------------------
::: dom/icc/tests/marionette/test_icc_card_state.js
@@ +29,5 @@
> /* Test cardstatechange event by switching radio off */
> taskHelper.push(function testCardStateChange() {
> // Turn off radio.
> + setRadioEnabled(false, function() {
> + icc.addEventListener("cardstatechange", function oncardstatechange() {
You may lose this event because that addEventListener is not necessarily installed before 'cardstatechange' has ever been emitted.
Basiscally when you do:
<some request that emits 'event-foo'>();
yet_another_async_op(function callback() {
<register_event_foo>();
...
});
That can result in intermittent failure on try server/emulator.
Attachment #8455999 -
Flags: feedback?(vyang) → feedback-
Assignee | ||
Comment 6•10 years ago
|
||
Attachment #8455999 -
Attachment is obsolete: true
Attachment #8456051 -
Flags: feedback?(vyang)
Comment 7•10 years ago
|
||
Comment on attachment 8456051 [details] [diff] [review]
#2 card state test
Review of attachment 8456051 [details] [diff] [review]:
-----------------------------------------------------------------
Can you have something like:
function setRadioAndWaitForNamedEvent(aEnable, aEventName, aCallback) {
setRadioEnabled(false);
icc.addEventListener(aEventName, function onevent() {
if (aCallback()) {
icc.removeEventListener(aEventName, onevent);
}
});
}
// In that |testCardStateChange()| you have:
setRadioAndWaitForNamedEvent(false, "cardstatechange" function() {
if (icc.cardState !== null) {
return false;
}
setRadioAndWaitForNamedEvent(true, "iccdetected", function() {
window.setTimeout(() => taskHelper.runNext(), 0);
// Unregister "iccdetected".
return true;
});
// Unregister "cardstatechange".
return true;
});
// In |testRemoveCard()| you have:
function emulatorChangeSimStatus(aCardStatus, aCallback) {
setRadioAndWaitForNamedEvent(false, "cardstatechange", function() {
if (icc.cardState !== null) {
return false;
}
emulatorHelper.sendCommand("sim status " + status, aCallback);
// Unregister "cardstatechange".
return true;
}
}
emulatorChangeSimStatus("absent", function() {
setRadioAndWaitForNamedEvent(true, "cardstatechange", function() {
if (icc.cardState === null) {
return false;
}
emulatorChangeSimStatus("ready", function() {
setRadioAndWaitForNamedEvent(true, "iccdetected", function() {
window.setTimeout(() => taskHelper.runNext(), 0);
// Unregister "iccdetected".
return true;
});
});
// Unregister "cardstatechange".
return true;
});
});
::: dom/icc/tests/marionette/test_icc_card_state.js
@@ +5,3 @@
> MARIONETTE_HEAD_JS = "icc_header.js";
>
> +connection = navigator.mozMobileConnections[0];
nit: let connection = ...
@@ +81,5 @@
> + })
> + }, function() {
> + let duration = Date.now() - startTime;
> + // Make sure that the card state is still null after 5s.
> + return duration >= 5000 && icc.cardState === null;
We'd probably avoid timeouts whenever possible.
Attachment #8456051 -
Flags: feedback?(vyang) → feedback-
Assignee | ||
Comment 8•10 years ago
|
||
Attachment #8456051 -
Attachment is obsolete: true
Attachment #8458411 -
Flags: review?(vyang)
Updated•10 years ago
|
Attachment #8458411 -
Flags: review?(vyang) → review+
Updated•10 years ago
|
Attachment #8450870 -
Flags: review?(vyang) → review+
Updated•8 years ago
|
Status: NEW → RESOLVED
Closed: 8 years ago
Resolution: --- → INCOMPLETE
You need to log in
before you can comment on or make changes to this bug.
Description
•