/* Copyright 2009 Palm, Inc.  All rights reserved. */

// see http://developer.palm.com/palm-sdk/jsdoc/symbols/Mojo.html

function TelephonyCommandsTests() {
}

TelephonyCommandsTests.timeoutInterval = 5000; // palm://com.palm.systemservice/setPreferences is slower than the default of a second

TelephonyCommandsTests.prototype.testSubscribePreference = function(reportResults) {
	var uid = (new Date()).valueOf(), key = "test_key_"+uid, value = "value_"+uid;
	
	TelephonyCommands.subscribePreference(key, function(v) {
		reportResults(v === value ? Mojo.Test.passed : "Failed, value returned was "+v);
	});
	
	var params = {};
	params[key] = value;
	new Mojo.Service.Request('palm://com.palm.systemservice', {
		method: 'setPreferences', 
		parameters: params,
		onFailure: function(r) {
			reportResults("setPreferences#onFailure with response "+Object.toJSON(r));
		}
	});
};