You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cordova.apache.org by pu...@apache.org on 2012/02/22 09:15:23 UTC
[13/29] Moar renames
http://git-wip-us.apache.org/repos/asf/incubator-cordova-wp7/blob/f95d8786/framework/js/phonegap.js.base
----------------------------------------------------------------------
diff --git a/framework/js/phonegap.js.base b/framework/js/phonegap.js.base
deleted file mode 100644
index d87821c..0000000
--- a/framework/js/phonegap.js.base
+++ /dev/null
@@ -1,651 +0,0 @@
-/*
- * PhoneGap is available under *either* the terms of the modified BSD license *or* the
- * MIT License (2008). See http://opensource.org/licenses/alphabetical for full text.
- *
- * Copyright (c) 2005-2010, Nitobi Software Inc.
- * Copyright (c) 2010-2011, IBM Corporation
- * Copyright (c) 2011, Microsoft Corporation
- */
-
-
-
-
-
-/**
- * The order of events during page load and PhoneGap startup is as follows:
- *
- * onDOMContentLoaded Internal event that is received when the web page is loaded and parsed.
- * window.onload Body onload event.
- * onNativeReady Internal event that indicates the PhoneGap native side is ready.
- * onPhoneGapInit Internal event that kicks off creation of all PhoneGap JavaScript objects (runs constructors).
- * onPhoneGapReady Internal event fired when all PhoneGap JavaScript objects have been created
- * onPhoneGapInfoReady Internal event fired when device properties are available
- * onDeviceReady User event fired to indicate that PhoneGap is ready
- * onResume User event fired to indicate a start/resume lifecycle event
- * onPause User event fired to indicate a pause lifecycle event
- * onDestroy Internal event fired when app is being destroyed (User should use window.onunload event, not this one).
- *
- * The only PhoneGap events that user code should register for are:
- * onDeviceReady
- * onResume
- *
- * Listeners can be registered as:
- * document.addEventListener("deviceready", myDeviceReadyListener, false);
- * document.addEventListener("resume", myResumeListener, false);
- * document.addEventListener("pause", myPauseListener, false);
- */
-
- if (typeof(DeviceInfo) !== 'object') {
- var DeviceInfo = {};
-}
-
-var PhoneGap = {
- queue: {
- ready: true,
- commands: [],
- timer: null
- },
- available:false,
- callbackId:0,
- callbacks:{},
- resources:{}
-};
-
-PhoneGap.callbackStatus = {
- NO_RESULT: 0,
- OK: 1,
- CLASS_NOT_FOUND_EXCEPTION: 2,
- ILLEGAL_ACCESS_EXCEPTION: 3,
- INSTANTIATION_EXCEPTION: 4,
- MALFORMED_URL_EXCEPTION: 5,
- IO_EXCEPTION: 6,
- INVALID_ACTION: 7,
- JSON_EXCEPTION: 8,
- ERROR: 9
-};
-
-/**
- * Determine if resource has been loaded by PhoneGap
- *
- * @param name
- * @return
- */
-PhoneGap.hasResource = function(name) {
- return PhoneGap.resources[name];
-};
-
-/**
- * Add a resource to list of loaded resources by PhoneGap
- *
- * @param name
- */
-PhoneGap.addResource = function(name) {
- PhoneGap.resources[name] = true;
-};
-
-PhoneGap.exec = function(success, fail, service, action, args)
-{
-
- var callbackId = service + PhoneGap.callbackId++;
- if (typeof success == "function" || typeof fail == "function")
- {
- PhoneGap.callbacks[callbackId] = {success:success, fail:fail};
- }
-
- // generate a new command string, ex. DebugConsole/log/DebugConsole23/{"message":"wtf dude?"}
- var command = service + "/" + action + "/" + callbackId + "/" + JSON.stringify(args);
- // pass it on to Notify
- window.external.Notify(command);
-};
-
-PhoneGapCommandResult = function(status,callbackId,args,cast)
-{
- if(status === "backbutton") {
-
- PhoneGap.fireEvent(document,"backbutton");
- return "true";
-
- } else if(status === "resume") {
-
- PhoneGap.onResume.fire();
- return "true";
-
- } else if(status === "pause") {
-
- PhoneGap.onPause.fire();
- return "true";
- }
-
- var safeStatus = parseInt(status);
- if(safeStatus === PhoneGap.callbackStatus.NO_RESULT ||
- safeStatus === PhoneGap.callbackStatus.OK) {
- PhoneGap.CallbackSuccess(callbackId,args,cast);
- }
- else
- {
- PhoneGap.CallbackError(callbackId,args,cast);
- }
-};
-
-/**
- * Called by native code when returning successful result from an action.
- *
- * @param callbackId
- * @param args
- * @param cast
- */
-PhoneGap.CallbackSuccess = function(callbackId, args, cast)
-{
-
- var commandResult;
- try
- {
- commandResult = JSON.parse(args);
-
- if (typeof cast !== 'undefined')
- {
- eval('commandResult = ' + cast + '(commandResult);');
- }
-
- }
- catch(exception)
- {
- return exception.message;
- }
-
- if (PhoneGap.callbacks[callbackId] ) {
-
- // If result is to be sent to callback
- if (commandResult.status === PhoneGap.callbackStatus.OK) {
- try {
- if (PhoneGap.callbacks[callbackId].success) {
- result = PhoneGap.callbacks[callbackId].success(commandResult.message);
- }
- }
- catch (e) {
- console.log("Error in success callback: "+callbackId+" = " + e.message);
- }
- }
-
- // Clear callback if not expecting any more results
- if (!commandResult.keepCallback) {
- delete PhoneGap.callbacks[callbackId];
- }
- }
- // Note that in WP7, this method can return a value to the native calling code
- return "";
-};
-
-/**
- * Called by native code when returning error result from an action.
- *
- * @param callbackId
- * @param args
- * @param cast - not supported
- */
-PhoneGap.CallbackError = function (callbackId, args, cast) {
-
- var commandResult;
- try
- {
- commandResult = JSON.parse(args);
- }
- catch(exception)
- {
- return exception.message;
- }
-
- if (PhoneGap.callbacks[callbackId]) {
- try {
- if (PhoneGap.callbacks[callbackId].fail) {
- PhoneGap.callbacks[callbackId].fail(commandResult.message);
- }
- }
- catch (e) {
- console.log("Error in error callback: "+callbackId+" = "+e);
- }
-
- // Clear callback if not expecting any more results
- if (!args.keepCallback) {
- delete PhoneGap.callbacks[callbackId];
- }
- }
-};
-
-/**
- * Create a UUID
- *
- * @return {String}
- */
-PhoneGap.createUUID = function() {
- return PhoneGap.UUIDcreatePart(4) + '-' +
- PhoneGap.UUIDcreatePart(2) + '-' +
- PhoneGap.UUIDcreatePart(2) + '-' +
- PhoneGap.UUIDcreatePart(2) + '-' +
- PhoneGap.UUIDcreatePart(6);
-};
-
-PhoneGap.UUIDcreatePart = function(length) {
- var uuidpart = "";
- var i, uuidchar;
- for (i=0; i<length; i++) {
- uuidchar = parseInt((Math.random() * 256),0).toString(16);
- if (uuidchar.length === 1) {
- uuidchar = "0" + uuidchar;
- }
- uuidpart += uuidchar;
- }
- return uuidpart;
-};
-
-/**
- * Does a deep clone of the object.
- *
- * @param obj
- * @return {Object}
- */
-PhoneGap.clone = function(obj) {
- var i, retVal;
- if(!obj) {
- return obj;
- }
-
- if(obj instanceof Array){
- retVal = [];
- for(i = 0; i < obj.length; ++i){
- retVal.push(PhoneGap.clone(obj[i]));
- }
- return retVal;
- }
-
- if (typeof obj === "function") {
- return obj;
- }
-
- if(!(obj instanceof Object)){
- return obj;
- }
-
- if (obj instanceof Date) {
- return obj;
- }
-
- retVal = {};
- for(i in obj){
- if(!(i in retVal) || retVal[i] !== obj[i]) {
- retVal[i] = PhoneGap.clone(obj[i]);
- }
- }
- return retVal;
-};
-
-/*Clones object, but catches exception*/
-PhoneGap.safeClone = function(obj)
-{
- try
- {
- return PhoneGap.clone(obj);
- }
- catch(e)
- {
- console.log("CloneError::" + e.message);
- }
- return null;
-};
-
-
-/**
- * Custom pub-sub channel that can have functions subscribed to it
- * @constructor
- */
-PhoneGap.Channel = function(type)
-{
- this.type = type;
- this.handlers = {};
- this.guid = 0;
- this.fired = false;
- this.enabled = true;
-};
-
-/**
- * Subscribes the given function to the channel. Any time that
- * Channel.fire is called so too will the function.
- * Optionally specify an execution context for the function
- * and a guid that can be used to stop subscribing to the channel.
- * Returns the guid.
- */
-PhoneGap.Channel.prototype.subscribe = function(f, c, g) {
- // need a function to call
- if (f === null) { return; }
-
- var func = f;
- if (typeof c === "object" && typeof f === "function") { func = PhoneGap.close(c, f); }
-
- g = g || func.observer_guid || f.observer_guid || this.guid++;
- func.observer_guid = g;
- f.observer_guid = g;
- this.handlers[g] = func;
- return g;
-};
-
-/**
- * Like subscribe but the function is only called once and then it
- * auto-unsubscribes itself.
- */
-PhoneGap.Channel.prototype.subscribeOnce = function(f, c) {
- var g = null;
- var _this = this;
- var m = function() {
- f.apply(c || null, arguments);
- _this.unsubscribe(g);
- };
- if (this.fired) {
- if (typeof c === "object" && typeof f === "function") { f = PhoneGap.close(c, f); }
- f.apply(this, this.fireArgs);
- } else {
- g = this.subscribe(m);
- }
- return g;
-};
-
-/**
- * Unsubscribes the function with the given guid from the channel.
- */
-PhoneGap.Channel.prototype.unsubscribe = function(g) {
- if (typeof g === "function") { g = g.observer_guid; }
- this.handlers[g] = null;
- delete this.handlers[g];
-};
-
-/**
- * Calls all functions subscribed to this channel.
- */
-PhoneGap.Channel.prototype.fire = function(e) {
- if (this.enabled) {
- var fail = false;
- var item, handler, rv;
- for (item in this.handlers) {
- if (this.handlers.hasOwnProperty(item)) {
- handler = this.handlers[item];
- if (typeof handler === "function") {
- rv = (handler.apply(this, arguments) === false);
- fail = fail || rv;
- }
- }
- }
- this.fired = true;
- this.fireArgs = arguments;
- return !fail;
- }
- return true;
-};
-
-/**
- * Calls the provided function only after all of the channels specified
- * have been fired.
- */
-PhoneGap.Channel.join = function(h, c) {
- var i = c.length;
- var f = function() {
- if (!(--i)) {
- h();
- }
- };
- var len = i;
- var j;
- for (j=0; j<len; j++) {
- if (!c[j].fired) {
- c[j].subscribeOnce(f);
- }
- else {
- i--;
- }
- }
- if (!i) {
- h();
- }
-};
-
-/**
- * Boolean flag indicating if the PhoneGap API is available and initialized.
- */ // TODO: Remove this, it is unused here ... -jm
-PhoneGap.available = DeviceInfo.uuid !== undefined;
-
-/**
- * Add an initialization function to a queue that ensures it will run and initialize
- * application constructors only once PhoneGap has been initialized.
- * @param {Function} func The function callback you want run once PhoneGap is initialized
- */
-PhoneGap.addConstructor = function(func)
-{
- PhoneGap.onPhoneGapInit.subscribeOnce(function() {
- try {
- func();
- } catch(e) {
- console.log("Failed to run constructor: " + e);
- }
- });
-};
-
-/**
- * Plugins object
- */
-if (!window.plugins) {
- window.plugins = {};
-};
-
-/**
- * Adds a plugin object to window.plugins.
- * The plugin is accessed using window.plugins.<name>
- *
- * @param name The plugin name
- * @param obj The plugin object
- */
-PhoneGap.addPlugin = function(name, obj) {
- if (!window.plugins[name]) {
- window.plugins[name] = obj;
- }
- else {
- console.log("Error: Plugin "+name+" already exists.");
- }
-};
-
-/**
- * onDOMContentLoaded channel is fired when the DOM content
- * of the page has been parsed.
- */
-PhoneGap.onDOMContentLoaded = new PhoneGap.Channel('onDOMContentLoaded');
-
-/**
- * onNativeReady channel is fired when the PhoneGap native code
- * has been initialized.
- */
-PhoneGap.onNativeReady = new PhoneGap.Channel('onNativeReady');
-
-/**
- * onPhoneGapInit channel is fired when the web page is fully loaded and
- * PhoneGap native code has been initialized.
- */
-PhoneGap.onPhoneGapInit = new PhoneGap.Channel('onPhoneGapInit');
-
-/**
- * onPhoneGapReady channel is fired when the JS PhoneGap objects have been created.
- */
-PhoneGap.onPhoneGapReady = new PhoneGap.Channel('onPhoneGapReady');
-
-/**
- * onPhoneGapInfoReady channel is fired when the PhoneGap device properties
- * has been set.
- */
-PhoneGap.onPhoneGapInfoReady = new PhoneGap.Channel('onPhoneGapInfoReady');
-
-/**
- * onPhoneGapConnectionReady channel is fired when the PhoneGap connection properties
- * has been set.
- */
-PhoneGap.onPhoneGapConnectionReady = new PhoneGap.Channel('onPhoneGapConnectionReady');
-
-/**
- * onResume channel is fired when the PhoneGap native code
- * resumes.
- */
-PhoneGap.onResume = new PhoneGap.Channel('onResume');
-
-/**
- * onPause channel is fired when the PhoneGap native code
- * pauses.
- */
-PhoneGap.onPause = new PhoneGap.Channel('onPause');
-
-/**
- * onDestroy channel is fired when the PhoneGap native code
- * is destroyed. It is used internally.
- * Window.onunload should be used by the user.
- */
-PhoneGap.onDestroy = new PhoneGap.Channel('onDestroy');
-PhoneGap.onDestroy.subscribeOnce(function() {
- PhoneGap.shuttingDown = true;
-});
-PhoneGap.shuttingDown = false;
-
-// _nativeReady is global variable that the native side can set
-// to signify that the native code is ready. It is a global since
-// it may be called before any PhoneGap JS is ready.
-if (typeof _nativeReady !== 'undefined') { PhoneGap.onNativeReady.fire(); }
-
-/**
- * onDeviceReady is fired only after all PhoneGap objects are created and
- * the device properties are set.
- */
-PhoneGap.onDeviceReady = new PhoneGap.Channel('onDeviceReady');
-
-
-// Array of channels that must fire before "deviceready" is fired
-PhoneGap.deviceReadyChannelsArray = [ PhoneGap.onPhoneGapReady, PhoneGap.onPhoneGapInfoReady, PhoneGap.onPhoneGapConnectionReady];
-
-// Hashtable of user defined channels that must also fire before "deviceready" is fired
-PhoneGap.deviceReadyChannelsMap = {};
-
-/**
- * Indicate that a feature needs to be initialized before it is ready to be used.
- * This holds up PhoneGap's "deviceready" event until the feature has been initialized
- * and PhoneGap.initComplete(feature) is called.
- *
- * @param feature {String} The unique feature name
- */
-PhoneGap.waitForInitialization = function(feature) {
- if (feature) {
- var channel = new PhoneGap.Channel(feature);
- PhoneGap.deviceReadyChannelsMap[feature] = channel;
- PhoneGap.deviceReadyChannelsArray.push(channel);
- }
-};
-
-/**
- * Indicate that initialization code has completed and the feature is ready to be used.
- *
- * @param feature {String} The unique feature name
- */
-PhoneGap.initializationComplete = function(feature) {
- var channel = PhoneGap.deviceReadyChannelsMap[feature];
- if (channel) {
- channel.fire();
- }
-};
-
-/**
- * Create all PhoneGap objects once page has fully loaded and native side is ready.
- */
-PhoneGap.Channel.join(
- function()
- {
-
- setTimeout(function()
- {
-
- PhoneGap.UsePolling = false;
- //PhoneGap.JSCallback();
- },1);
-
- // Run PhoneGap constructors
- PhoneGap.onPhoneGapInit.fire();
-
- // Fire event to notify that all objects are created
- PhoneGap.onPhoneGapReady.fire();
-
- // Fire onDeviceReady event once all constructors have run and PhoneGap info has been
- // received from native side, and any user defined initialization channels.
- PhoneGap.Channel.join(function() {
- PhoneGap.onDeviceReady.fire();
-
- // Fire the onresume event, since first one happens before JavaScript is loaded
- PhoneGap.onResume.fire();
- }, PhoneGap.deviceReadyChannelsArray);
-
- },
- [ PhoneGap.onDOMContentLoaded ]);
-
-
-
-// Listen for DOMContentLoaded and notify our channel subscribers
-document.addEventListener('DOMContentLoaded', function() {
- PhoneGap.onDOMContentLoaded.fire();
-}, false);
-
-PhoneGap.m_document_addEventListener = document.addEventListener;
-document.addEventListener = function(evt, handler, capture)
-{
- console.log("document.addEventListener event named " + evt);
-
- var e = evt.toLowerCase();
- if (e === 'deviceready')
- {
- PhoneGap.onDeviceReady.subscribeOnce(handler);
- }
- else if (e === 'resume')
- {
- PhoneGap.onResume.subscribe(handler);
- if (PhoneGap.onDeviceReady.fired)
- {
- PhoneGap.onResume.fire();
- }
- }
- else if (e === 'pause')
- {
- PhoneGap.onPause.subscribe(handler);
- }
- else
- {
-
- if (e === 'backbutton')
- {
- PhoneGap.exec(null, null, "CoreEvents", "overrideBackbutton", [true]);
- }
- PhoneGap.m_document_addEventListener.call(document, evt, handler, capture);
- }
-};
-
-PhoneGap.m_document_removeEventListener = document.removeEventListener;
-document.removeEventListener = function(evt, handler, capture)
-{
- console.log("document.removeEventListener event named " + evt);
-
- var e = evt.toLowerCase();
-
- if (e === 'backbutton')
- {
- PhoneGap.exec(null, null, "CoreEvents", "overrideBackbutton", [false]);
- }
- PhoneGap.m_document_removeEventListener.call(document, evt, handler, capture);
-
-}
-
-
-PhoneGap.fireEvent = function(_targ,evtName)
-{
- var target = _targ || window;
- var eventObj = document.createEvent('MouseEvents');
- eventObj.initEvent( evtName, true, false );
- target.dispatchEvent( eventObj );
-}
-
http://git-wip-us.apache.org/repos/asf/incubator-cordova-wp7/blob/f95d8786/tests/MobileSpecUnitTests/Calculator.cs
----------------------------------------------------------------------
diff --git a/tests/MobileSpecUnitTests/Calculator.cs b/tests/MobileSpecUnitTests/Calculator.cs
index 092321d..6e59bcf 100644
--- a/tests/MobileSpecUnitTests/Calculator.cs
+++ b/tests/MobileSpecUnitTests/Calculator.cs
@@ -7,11 +7,11 @@
*/
using System.Runtime.Serialization;
-using WP7GapClassLib.PhoneGap;
-using WP7GapClassLib.PhoneGap.Commands;
-using WP7GapClassLib.PhoneGap.JSON;
+using WP7GapClassLib.Cordova;
+using WP7GapClassLib.Cordova.Commands;
+using WP7GapClassLib.Cordova.JSON;
-namespace PhoneGap.Extension.Commands
+namespace Cordova.Extension.Commands
{
public class Calculator : BaseCommand
{
http://git-wip-us.apache.org/repos/asf/incubator-cordova-wp7/blob/f95d8786/tests/MobileSpecUnitTests/GapSourceDictionary.xml
----------------------------------------------------------------------
diff --git a/tests/MobileSpecUnitTests/GapSourceDictionary.xml b/tests/MobileSpecUnitTests/GapSourceDictionary.xml
index a8b6622..f81582f 100644
--- a/tests/MobileSpecUnitTests/GapSourceDictionary.xml
+++ b/tests/MobileSpecUnitTests/GapSourceDictionary.xml
@@ -1,9 +1,9 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- This file is auto-generated, do not edit! -jm -->
<GapSourceDictionary>
+ <FilePath Value="www\cordova-1.4.1.js"/>
<FilePath Value="www\index.html"/>
<FilePath Value="www\master.css"/>
- <FilePath Value="www\phonegap-1.3.0.js"/>
<FilePath Value="www\autotest\index.html"/>
<FilePath Value="www\autotest\qunit.css"/>
<FilePath Value="www\autotest\qunit.js"/>
http://git-wip-us.apache.org/repos/asf/incubator-cordova-wp7/blob/f95d8786/tests/MobileSpecUnitTests/MobileSpecUnitTests.csproj
----------------------------------------------------------------------
diff --git a/tests/MobileSpecUnitTests/MobileSpecUnitTests.csproj b/tests/MobileSpecUnitTests/MobileSpecUnitTests.csproj
index 186f3e4..233a264 100644
--- a/tests/MobileSpecUnitTests/MobileSpecUnitTests.csproj
+++ b/tests/MobileSpecUnitTests/MobileSpecUnitTests.csproj
@@ -88,7 +88,7 @@
<Content Include="Background.png">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
- <Content Include="www\phonegap-1.3.0.js" />
+ <Content Include="www\cordova-1.4.1.js" />
<None Include="ManifestProcessor.js" />
<Content Include="GapSourceDictionary.xml">
<SubType>Designer</SubType>
http://git-wip-us.apache.org/repos/asf/incubator-cordova-wp7/blob/f95d8786/tests/MobileSpecUnitTests/www/autotest/index.html
----------------------------------------------------------------------
diff --git a/tests/MobileSpecUnitTests/www/autotest/index.html b/tests/MobileSpecUnitTests/www/autotest/index.html
index c78c3ad..1e133a6 100644
--- a/tests/MobileSpecUnitTests/www/autotest/index.html
+++ b/tests/MobileSpecUnitTests/www/autotest/index.html
@@ -40,7 +40,7 @@
<!-- Source -->
- <script type="text/javascript" src="../phonegap-1.3.0.js"></script>
+ <script type="text/javascript" src="../cordova-1.4.1.js"></script>
<!-- Load Test Runner -->
<script type="text/javascript" src="test-runner.js"></script>
@@ -49,25 +49,25 @@
<!-- Individual Tests -->
- <script type="text/javascript" src="tests/accelerometer.tests.js"></script>
+ <!--<script type="text/javascript" src="tests/accelerometer.tests.js"></script>
<script type="text/javascript" src="tests/camera.tests.js"></script>
<script type="text/javascript" src="tests/capture.tests.js"></script>
<script type="text/javascript" src="tests/notification.tests.js"></script>
<script type="text/javascript" src="tests/network.tests.js"></script>
- <script type="text/javascript" src="tests/geolocation.tests.js"></script>
+ <script type="text/javascript" src="tests/geolocation.tests.js"></script>-->
<script type="text/javascript" src="tests/compass.tests.js"></script>
- <script type="text/javascript" src="tests/contacts.tests.js"></script>
+ <!--<script type="text/javascript" src="tests/contacts.tests.js"></script>
<script type="text/javascript" src="tests/file.tests.js"></script>
<script type="text/javascript" src="tests/filetransfer.tests.js"></script>
<script type="text/javascript" src="tests/media.tests.js"></script>
- <script type="text/javascript" src="tests/storage.tests.js"></script>
+ <script type="text/javascript" src="tests/storage.tests.js"></script>-->
<!--
http://git-wip-us.apache.org/repos/asf/incubator-cordova-wp7/blob/f95d8786/tests/MobileSpecUnitTests/www/autotest/tests/compass.tests.js
----------------------------------------------------------------------
diff --git a/tests/MobileSpecUnitTests/www/autotest/tests/compass.tests.js b/tests/MobileSpecUnitTests/www/autotest/tests/compass.tests.js
index 8c0e4ee..e9f629a 100644
--- a/tests/MobileSpecUnitTests/www/autotest/tests/compass.tests.js
+++ b/tests/MobileSpecUnitTests/www/autotest/tests/compass.tests.js
@@ -17,16 +17,31 @@ Tests.prototype.CompassTests = function()
test("getCurrentHeading success callback should be called with an heading (string)",
function() {
- expect(1);
+ expect(9);
QUnit.stop(Tests.TEST_TIMEOUT);
var win = function(a)
{
- ok(typeof a == 'string', "Compass heading object returned in getCurrentHeading success callback should be of type 'string'.");
- start();
+ ok(typeof a == 'Object', "Compass heading object returned in getCurrentHeading success callback should be of type 'Object'.");
+ ok(a.magneticHeading != null, "Compass heading object has a magneticHeading property");
+ ok(typeof a.magneticHeading == "Number", "Compass heading.magneticHeading is a Number");
+
+ ok(a.trueHeading != null, "Compass heading object has a magneticHeading property");
+ ok(typeof a.trueHeading == "Number", "Compass heading.trueHeading is a Number");
+
+ ok(a.headingAccuracy != null, "Compass heading object has a magneticHeading property");
+ ok(typeof a.headingAccuracy == "Number", "Compass heading.headingAccuracy is a Number");
+
+ ok(a.timestamp != null, "Compass heading object has a magneticHeading property");
+ ok(typeof a.timestamp == "Number", "Compass heading.timestamp is a Number");
+
+ start();
};
var fail = function(a)
{
- ok(typeof a == 'string', "Compass heading object returned in getCurrentHeading FAIL callback should be of type 'string'.");
+ console.log("compass failed to return a result :: " + a);
+ ok(typeof a == 'object', "Compass heading object returned in getCurrentHeading FAIL callback should be of type 'object'.");
+ ok(a.code != null, "Compass error result should have a 'code' property");
+ ok(typeof a.code == 'string', "Compass error result should have a 'code' property of type string");
start();
};
navigator.compass.getCurrentHeading(win, fail);
http://git-wip-us.apache.org/repos/asf/incubator-cordova-wp7/blob/f95d8786/tests/MobileSpecUnitTests/www/autotest/tests/media.tests.js
----------------------------------------------------------------------
diff --git a/tests/MobileSpecUnitTests/www/autotest/tests/media.tests.js b/tests/MobileSpecUnitTests/www/autotest/tests/media.tests.js
index 86f64dd..dc47d19 100644
--- a/tests/MobileSpecUnitTests/www/autotest/tests/media.tests.js
+++ b/tests/MobileSpecUnitTests/www/autotest/tests/media.tests.js
@@ -100,9 +100,9 @@ Tests.prototype.MediaTests = function () {
ok(typeof media.stopRecord == 'function', "media.stopRecord should be a function.");
});
- test("should PhoneGap.Media.onStatus exist", function () {
+ test("should Cordova.Media.onStatus exist", function () {
expect(1);
- ok(typeof PhoneGap.Media.onStatus === "function" || typeof PhoneGap.Media.onStatus === "object", "'Audio' should be defined as a function in global scope.");
+ ok(typeof Cordova.Media.onStatus === "function" || typeof Cordova.Media.onStatus === "object", "'Audio' should be defined as a function in global scope.");
});
test("record audio", function () {