Bug 1062912 - Part 3: move getNeighboringCellIds and getCellInfoList to nsIMobileConnectionService (tests). r=hsinyi

This commit is contained in:
Jessica Jong 2014-10-22 18:12:09 +08:00
parent 508fc043eb
commit 94d92feea1
4 changed files with 39 additions and 34 deletions

View File

@ -36,3 +36,4 @@ disabled = Bug 979137
[test_dsds_mobile_data_connection.js]
[test_mobile_clir.js]
[test_mobile_clir_radio_off.js]
[test_mobile_neighboring_cell_ids.js]

View File

@ -0,0 +1,38 @@
/* Any copyright is dedicated to the Public Domain.
* http://creativecommons.org/publicdomain/zero/1.0/ */
MARIONETTE_TIMEOUT = 30000;
// This test must run in chrome context.
MARIONETTE_CONTEXT = "chrome";
let Promise = Cu.import("resource://gre/modules/Promise.jsm").Promise;
let service = Cc["@mozilla.org/mobileconnection/mobileconnectionservice;1"]
.getService(Ci.nsIMobileConnectionService);
ok(service, "service.constructor is " + service.constructor);
let mobileConnection = service.getItemByServiceId(0);
ok(mobileConnection, "mobileConnection.constructor is " + mobileConnection.constrctor);
function testGetNeighboringCellIds() {
log("Test getting mobile neighboring cell ids");
let deferred = Promise.defer();
mobileConnection.getNeighboringCellIds({
notifyGetNeighboringCellIds: function(aResult) {
deferred.resolve(aResult);
},
notifyGetNeighboringCellIdsFailed: function(aError) {
deferred.reject(aError);
}
});
return deferred.promise;
}
// Start tests
testGetNeighboringCellIds()
.then(function resolve(aResult) {
ok(false, "getNeighboringCellIds should not success");
}, function reject(aError) {
is(aError, "RequestNotSupported", "failed to getNeighboringCellIds");
}).then(finish);

View File

@ -12,4 +12,3 @@ disabled = Bug 808783
[test_data_connection.js]
[test_network_active_changed.js]
[test_multiple_data_connection.js]
[test_neighboring_cell_ids.js]

View File

@ -1,33 +0,0 @@
/* Any copyright is dedicated to the Public Domain.
* http://creativecommons.org/publicdomain/zero/1.0/ */
MARIONETTE_TIMEOUT = 30000;
MARIONETTE_HEAD_JS = "head.js";
function testGetNeighboringCellIds() {
log("Test getting neighboring cell ids");
let deferred = Promise.defer();
radioInterface.getNeighboringCellIds({
notifyGetNeighboringCellIds: function(aResult) {
deferred.resolve(aResult);
},
notifyGetNeighboringCellIdsFailed: function(aError) {
deferred.reject(aError);
}
});
return deferred.promise;
}
// Start tests
startTestBase(function() {
// TODO: Bug 1028837 - B2G Emulator: support neighboring cell ids.
// Currently, emulator does not support RIL_REQUEST_NEIGHBORING_CELL_IDS,
// so we expect to get a 'RequestNotSupported' error here.
return testGetNeighboringCellIds()
.then(function resolve(aResult) {
ok(false, "getNeighboringCellIds should not success");
}, function reject(aError) {
is(aError, "RequestNotSupported", "failed to getNeighboringCellIds");
});
});