http://git-wip-us.apache.org/repos/asf/incubator-cordova-android/blob/ae8bc77e/test/assets/www/autotest/tests/accelerometer.tests.js
----------------------------------------------------------------------
diff --git a/test/assets/www/autotest/tests/accelerometer.tests.js 
b/test/assets/www/autotest/tests/accelerometer.tests.js
new file mode 100644
index 0000000..a99d459
--- /dev/null
+++ b/test/assets/www/autotest/tests/accelerometer.tests.js
@@ -0,0 +1,55 @@
+Tests.prototype.AccelerometerTests = function() {
+       module('Accelerometer (navigator.accelerometer)');
+       test("should exist", function() {
+               expect(1);
+               ok(navigator.accelerometer != null, "navigator.accelerometer 
should not be null.");
+       });
+       test("should contain a getCurrentAcceleration function", function() {
+               expect(2);
+               ok(typeof navigator.accelerometer.getCurrentAcceleration != 
'undefined' && navigator.accelerometer.getCurrentAcceleration != null, 
"navigator.accelerometer.getCurrentAcceleration should not be null.");
+               ok(typeof navigator.accelerometer.getCurrentAcceleration == 
'function', "navigator.accelerometer.getCurrentAcceleration should be a 
function.");
+       });
+       test("getCurrentAcceleration success callback should be called with an 
Acceleration object", function() {
+               expect(7);
+               QUnit.stop(Tests.TEST_TIMEOUT);
+               var win = function(a) {
+                       ok(typeof a == 'object', "Acceleration object returned 
in getCurrentAcceleration success callback should be of type 'object'.");
+                       ok(a.x != null, "Acceleration object returned in 
getCurrentAcceleration success callback should have an 'x' property.");
+                       ok(typeof a.x == 'number', "Acceleration object's 'x' 
property returned in getCurrentAcceleration success callback should be of type 
'number'.");
+                       ok(a.y != null, "Acceleration object returned in 
getCurrentAcceleration success callback should have a 'y' property.");
+                       ok(typeof a.y == 'number', "Acceleration object's 'y' 
property returned in getCurrentAcceleration success callback should be of type 
'number'.");
+                       ok(a.z != null, "Acceleration object returned in 
getCurrentAcceleration success callback should have a 'z' property.");
+                       ok(typeof a.z == 'number', "Acceleration object's 'z' 
property returned in getCurrentAcceleration success callback should be of type 
'number'.");
+                       start();
+               };
+               var fail = function() { start(); };
+               navigator.accelerometer.getCurrentAcceleration(win, fail);
+       });
+       test("should contain a watchAcceleration function", function() {
+               expect(2);
+               ok(typeof navigator.accelerometer.watchAcceleration != 
'undefined' && navigator.accelerometer.watchAcceleration != null, 
"navigator.accelerometer.watchAcceleration should not be null.");
+               ok(typeof navigator.accelerometer.watchAcceleration == 
'function', "navigator.accelerometer.watchAcceleration should be a function.");
+       });
+       test("should contain a clearWatch function", function() {
+               expect(2);
+               ok(typeof navigator.accelerometer.clearWatch != 'undefined' && 
navigator.accelerometer.clearWatch != null, "navigator.accelerometer.clearWatch 
should not be null.");
+               ok(typeof navigator.accelerometer.clearWatch == 'function', 
"navigator.accelerometer.clearWatch should be a function!");
+       });
+       module('Acceleration model');
+       test("should be able to define a new Acceleration object with x, y, z 
and timestamp properties.", function () {
+               expect(9);
+               var x = 1;
+               var y = 2;
+               var z = 3;
+               var a = new Acceleration(x, y, z);
+               ok(a != null, "new Acceleration object should not be null.");
+               ok(typeof a == 'object', "new Acceleration object should be of 
type 'object'.");
+               ok(a.x != null, "new Acceleration object should have an 'x' 
property.");
+               equals(a.x, x, "new Acceleration object should have 'x' 
property equal to first parameter passed in Acceleration constructor.");
+               ok(a.y != null, "new Acceleration object should have a 'y' 
property.");
+               equals(a.y, y, "new Acceleration object should have 'y' 
property equal to second parameter passed in Acceleration constructor.");
+               ok(a.z != null, "new Acceleration object should have a 'z' 
property.");
+               equals(a.z, z, "new Acceleration object should have 'z' 
property equal to third parameter passed in Acceleration constructor.");
+               ok(a.timestamp != null, "new Acceleration object should have a 
'timestamp' property.");
+       });
+};
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-cordova-android/blob/ae8bc77e/test/assets/www/autotest/tests/battery.tests.js
----------------------------------------------------------------------
diff --git a/test/assets/www/autotest/tests/battery.tests.js 
b/test/assets/www/autotest/tests/battery.tests.js
new file mode 100644
index 0000000..bce3079
--- /dev/null
+++ b/test/assets/www/autotest/tests/battery.tests.js
@@ -0,0 +1,18 @@
+Tests.prototype.BatteryTests = function() {  
+    module('Battery (navigator.battery)');
+    test("should exist", function() {
+        expect(1);
+        ok(navigator.battery != null, "navigator.battery should not be null.");
+    });
+    /**
+     * Tests add for Battery Status API spec
+     * http://www.w3.org/TR/2011/WD-battery-status-20111129/
+     */
+    test("should have properties", function() {
+        expect(4);
+        ok(typeof navigator.battery.charging != 'undefined' && 
navigator.battery.charging != null, "navigator.battery.charging should be a 
boolean value.");
+        ok(typeof navigator.battery.chargingTime != 'undefined' && 
navigator.battery.chargingTime != null, "navigator.battery.chargingTime should 
be a double value.");
+        ok(typeof navigator.battery.level != 'undefined' && 
navigator.battery.level != null, "navigator.battery.level should be a double 
value.");
+        ok(typeof navigator.battery.dischargingTime != 'undefined' && 
navigator.battery.dischargingTime != null, "navigator.battery.dischargingTime 
should be a double value.");
+    });
+};
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-cordova-android/blob/ae8bc77e/test/assets/www/autotest/tests/camera.tests.js
----------------------------------------------------------------------
diff --git a/test/assets/www/autotest/tests/camera.tests.js 
b/test/assets/www/autotest/tests/camera.tests.js
new file mode 100644
index 0000000..c52b7f5
--- /dev/null
+++ b/test/assets/www/autotest/tests/camera.tests.js
@@ -0,0 +1,40 @@
+Tests.prototype.CameraTests = function() {     
+       module('Camera (navigator.camera)');
+       test("should exist", function() {
+      expect(1);
+      ok(navigator.camera !== null, "navigator.camera should not be null.");
+       });
+       test("should contain a getPicture function", function() {
+               expect(2);
+               ok(typeof navigator.camera.getPicture != 'undefined' && 
navigator.camera.getPicture !== null, "navigator.camera.getPicture should not 
be null.");
+               ok(typeof navigator.camera.getPicture == 'function', 
"navigator.camera.getPicture should be a function.");
+       });
+
+  module('Camera Constants (window.Camera)');
+  test("should exist", function() {
+    expect(1);
+    ok(window.Camera !== null, "window.Camera should not be null.");
+  });
+  test("should contain two DestinationType constants", function() {
+    expect(2);
+    equals(Camera.DestinationType.DATA_URL, 0, "DestinationType.DATA_URL 
should equal to 0");
+    equals(Camera.DestinationType.FILE_URI, 1, "DestinationType.DATA_URL 
should equal to 1");
+  });
+  test("should contain two EncodingType constants", function() {
+    expect(2);
+    equals(Camera.EncodingType.JPEG, 0, "EncodingType.JPEG should equal to 0");
+    equals(Camera.EncodingType.PNG, 1, "EncodingType.PNG should equal to 1");
+  });
+  test("should contain three MediaType constants", function() {
+    expect(3);
+    equals(Camera.MediaType.PICTURE, 0, 'MediaType.PICTURE should equal to 0');
+    equals(Camera.MediaType.VIDEO, 1, 'MediaType.VIDEO should equal to 1');
+    equals(Camera.MediaType.ALLMEDIA, 2, 'MediaType.ALLMEDIA should equal to 
2');
+  });
+  test("should contain three PictureSourceType constants", function() {
+    expect(3);
+    equals(Camera.PictureSourceType.PHOTOLIBRARY, 0, 
'PictureSourceType.PHOTOLIBRARY should equal to 0');
+    equals(Camera.PictureSourceType.CAMERA, 1, 'PictureSourceType.CAMERA 
should equal to 1');
+    equals(Camera.PictureSourceType.SAVEDPHOTOALBUM, 2, 
'PictureSourceType.SAVEDPHOTOALBUM should equal to 2');
+  });
+};

http://git-wip-us.apache.org/repos/asf/incubator-cordova-android/blob/ae8bc77e/test/assets/www/autotest/tests/capture.tests.js
----------------------------------------------------------------------
diff --git a/test/assets/www/autotest/tests/capture.tests.js 
b/test/assets/www/autotest/tests/capture.tests.js
new file mode 100644
index 0000000..746b6f9
--- /dev/null
+++ b/test/assets/www/autotest/tests/capture.tests.js
@@ -0,0 +1,97 @@
+Tests.prototype.CaptureTests = function() {  
+    module('Capture (navigator.device.capture)');
+    test("should exist", function() {
+        expect(2);
+        ok(navigator.device !== null, "navigator.device should not be null.");
+        ok(navigator.device.capture !== null, "navigator.device.capture should 
not be null.");
+    });
+    test("should have the correct properties ", function() {
+        expect(3);
+        ok(typeof navigator.device.capture.supportedAudioModes != 'undefined' 
&& navigator.device.capture.supportedAudioModes !== null , "there should be a 
supported audio modes property");
+        ok(typeof navigator.device.capture.supportedImageModes != 'undefined' 
&& navigator.device.capture.supportedImageModes !== null , "there should be a 
supported image modes property");
+        ok(typeof navigator.device.capture.supportedVideoModes != 'undefined' 
&& navigator.device.capture.supportedVideoModes !== null , "there should be a 
supported video modes property");
+    });
+    test("should contain a captureAudio function", function() {
+        expect(2);
+        ok(typeof navigator.device.capture.captureAudio != 'undefined' && 
navigator.device.capture.captureAudio !== null, 
"navigator.device.capture.captureAudio should not be null.");
+        ok(typeof navigator.device.capture.captureAudio == 'function', 
"navigator.device.capture.captureAudio should be a function.");
+    });
+    test("should contain a captureImage function", function() {
+        expect(2);
+        ok(typeof navigator.device.capture.captureImage != 'undefined' && 
navigator.device.capture.captureImage !== null, 
"navigator.device.capture.captureImage should not be null.");
+        ok(typeof navigator.device.capture.captureImage == 'function', 
"navigator.device.capture.captureImage should be a function.");
+    });
+    test("should contain a captureVideo function", function() {
+        expect(2);
+        ok(typeof navigator.device.capture.captureVideo != 'undefined' && 
navigator.device.capture.captureVideo !== null, 
"navigator.device.capture.captureVideo should not be null.");
+        ok(typeof navigator.device.capture.captureVideo == 'function', 
"navigator.device.capture.captureVideo should be a function.");
+    });
+
+    module('CaptureAudioOptions');
+    test("CaptureAudioOptions constructor should exist", function() {
+        expect(4);
+        var options = new CaptureAudioOptions();
+        ok(options !== null, "CaptureAudioOptions object should not be null.");
+        ok(typeof options.limit !== 'undefined', "CaptureAudioOptions object 
should have a 'limit' property.");
+        ok(typeof options.duration !== 'undefined', "CaptureAudioOptions 
object should have a 'duration' property.");
+        ok(typeof options.mode !== 'undefined', "CaptureAudioOptions object 
should have a 'mode' property.");
+    });
+
+    module('CaptureImageOptions');
+    test("CaptureImageOptions constructor should exist", function() {
+        expect(3);
+        var options = new CaptureImageOptions();
+        ok(options !== null, "CaptureImageOptions object should not be null.");
+        ok(typeof options.limit !== 'undefined', "CaptureImageOptions object 
should have a 'limit' property.");
+        ok(typeof options.mode !== 'undefined', "CaptureImageOptions object 
should have a 'mode' property.");
+    });
+
+    module('CaptureVideoOptions');
+    test("CaptureVideoOptions constructor should exist", function() {
+        expect(4);
+        var options = new CaptureVideoOptions();
+        ok(options !== null, "CaptureVideoOptions object should not be null.");
+        ok(typeof options.limit !== 'undefined', "CaptureVideoOptions object 
should have a 'limit' property.");
+        ok(typeof options.duration !== 'undefined', "CaptureVideoOptions 
object should have a 'duration' property.");
+        ok(typeof options.mode !== 'undefined', "CaptureVideoOptions object 
should have a 'mode' property.");
+    });
+
+    module('CaptureError interface');
+    test("CaptureError constants should be defined", function() {
+        expect(4);
+        equal(CaptureError.CAPTURE_INTERNAL_ERR, 0, 
"CaptureError.CAPTURE_INTERNAL_ERR should be defined");
+        equal(CaptureError.CAPTURE_APPLICATION_BUSY, 1, 
"CaptureError.CAPTURE_APPLICATION_BUSY should be defined");
+        equal(CaptureError.CAPTURE_INVALID_ARGUMENT, 2, 
"CaptureError.CAPTURE_INVALID_ARGUMENT should be defined");
+        equal(CaptureError.CAPTURE_NO_MEDIA_FILES, 3, 
"CaptureError.CAPTURE_NO_MEDIA_FILES should be defined");
+    });
+    test("CaptureError properties should exist", function() {
+        expect(2);
+        var error = new CaptureError();
+        ok(error !== null, "CaptureError object should not be null.");
+        ok(typeof error.code !== 'undefined', "CaptureError object should have 
a 'code' property.");
+    });
+
+    module('MediaFileData');
+    test("MediaFileData constructor should exist", function() {
+        expect(6);
+        var fileData = new MediaFileData();
+        ok(fileData !== null, "MediaFileData object should not be null.");
+        ok(typeof fileData.bitrate !== 'undefined', "MediaFileData object 
should have a 'bitrate' property.");
+        ok(typeof fileData.codecs !== 'undefined', "MediaFileData object 
should have a 'codecs' property.");
+        ok(typeof fileData.duration !== 'undefined', "MediaFileData object 
should have a 'duration' property.");
+        ok(typeof fileData.height !== 'undefined', "MediaFileData object 
should have a 'height' property.");
+        ok(typeof fileData.width !== 'undefined', "MediaFileData object should 
have a 'width' property.");
+    });
+
+    module('MediaFile');
+    test("MediaFile constructor should exist", function() {
+        expect(6);
+        var fileData = new MediaFileData();
+        ok(fileData !== null, "MediaFileData object should not be null.");
+        ok(typeof fileData.name !== 'undefined', "MediaFile object should have 
a 'name' property.");
+        ok(typeof fileData.fullPath !== 'undefined', "MediaFile object should 
have a 'fullPath' property.");
+        ok(typeof fileData.type !== 'undefined', "MediaFile object should have 
a 'type' property.");
+        ok(typeof fileData.lastModifiedDate !== 'undefined', "MediaFile object 
should have a 'lastModifiedDate' property.");
+        ok(typeof fileData.size !== 'undefined', "MediaFile object should have 
a 'size' property.");
+    });
+};

http://git-wip-us.apache.org/repos/asf/incubator-cordova-android/blob/ae8bc77e/test/assets/www/autotest/tests/compass.tests.js
----------------------------------------------------------------------
diff --git a/test/assets/www/autotest/tests/compass.tests.js 
b/test/assets/www/autotest/tests/compass.tests.js
new file mode 100644
index 0000000..e0b1fa6
--- /dev/null
+++ b/test/assets/www/autotest/tests/compass.tests.js
@@ -0,0 +1,62 @@
+Tests.prototype.CompassTests = function() {
+  module('Compass (navigator.compass)');
+       test("should exist", function() {
+      expect(1);
+      ok(navigator.compass !== null, "navigator.compass should not be null.");
+       });
+       test("should contain a getCurrentHeading function", function() {
+               expect(2);
+               ok(typeof navigator.compass.getCurrentHeading != 'undefined' && 
navigator.compass.getCurrentHeading !== null, 
"navigator.compass.getCurrentHeading should not be null.");
+               ok(typeof navigator.compass.getCurrentHeading == 'function', 
"navigator.compass.getCurrentHeading should be a function.");
+       });
+       test("getCurrentHeading success callback should be called with a 
Heading object", function() {
+               expect(9);
+               QUnit.stop(Tests.TEST_TIMEOUT);
+               var win = function(a) {
+                       ok(typeof a == 'object', "Heading object returned in 
getCurrentHeading success callback should be of type 'object'.");
+                       ok(a.magneticHeading !== null, "Heading object returned 
in getCurrentHeading success callback should have an 'magneticHeading' 
property.");
+                       ok(typeof a.magneticHeading == 'number', "Heading 
object's 'magneticHeading' property returned in getCurrentHeading success 
callback should be of type 'number'.");
+                       ok(a.trueHeading !== null, "Heading object returned in 
getCurrentHeading success callback should have a 'trueHeading' property.");
+                       ok(typeof a.trueHeading == 'number', "Heading object's 
'trueHeading' property returned in getCurrentHeading success callback should be 
of type 'number'.");
+                       ok(a.headingAccuracy !== null, "Heading object returned 
in getCurrentHeading success callback should have a 'headingAccuracy' 
property.");
+                       ok(typeof a.headingAccuracy == 'number', "Heading 
object's 'headingAccuracy' property returned in getCurrentHeading success 
callback should be of type 'number'.");
+                       ok(a.timestamp !== null, "Heading object returned in 
getCurrentHeading success callback should have a 'timestamp' property.");
+                       ok(a.timestamp instanceof Date, "Heading object's 
'timestamp' property returned in getCurrentHeading success callback should be 
an instance of Date.");
+                       QUnit.start();
+               };
+               var fail = function() { QUnit.start(); };
+               navigator.compass.getCurrentHeading(win, fail);
+       });
+       test("should contain a watchHeading function", function() {
+               expect(2);
+               ok(typeof navigator.compass.watchHeading != 'undefined' && 
navigator.compass.watchHeading !== null, "navigator.compass.watchHeading should 
not be null.");
+               ok(typeof navigator.compass.watchHeading == 'function', 
"navigator.compass.watchHeading should be a function.");
+       });
+       test("should contain a clearWatch function", function() {
+               expect(2);
+               ok(typeof navigator.compass.clearWatch != 'undefined' && 
navigator.compass.clearWatch !== null, "navigator.compass.clearWatch should not 
be null.");
+               ok(typeof navigator.compass.clearWatch == 'function', 
"navigator.compass.clearWatch should be a function!");
+       });
+
+  module('Compass Constants (window.CompassError)');
+  test("CompassError globals should exist", function() {
+    expect(3);
+    ok(window.CompassError !== null, 'window.CompassError should not be null');
+    equals(window.CompassError.COMPASS_INTERNAL_ERR, 0, 
'window.CompassError.COMPASS_INTERNAL_ERR should be 0');
+    equals(window.CompassError.COMPASS_NOT_SUPPORTED, 20, 
'window.CompassError.COMPASS_NOT_SUPPORTED should be 20');
+  });
+
+  module('Compass Heading model (CompassHeading)');
+  test("CompassHeading function should exist", function() {
+    expect(1);
+    ok(typeof CompassHeading != 'undefined' && CompassHeading !== null, 
'CompassHeading should not be null');
+  });
+  test("Creating a new CompassHeading instance", function() {
+    expect(4);
+    var h = new CompassHeading();
+    equals(h.magneticHeading, null, "CompassHeading instance should have null 
magneticHeading property by default");
+    equals(h.trueHeading, null, "CompassHeading instance should have null 
trueHeading property by default");
+    equals(h.headingAccuracy, null, "CompassHeading instance should have null 
headingAccuracy property by default");
+    ok(h.timestamp !== null, "CompassHeading instance should have timestamp 
that is not null by default");
+  });
+};

http://git-wip-us.apache.org/repos/asf/incubator-cordova-android/blob/ae8bc77e/test/assets/www/autotest/tests/contacts.tests.js
----------------------------------------------------------------------
diff --git a/test/assets/www/autotest/tests/contacts.tests.js 
b/test/assets/www/autotest/tests/contacts.tests.js
new file mode 100644
index 0000000..b13eec3
--- /dev/null
+++ b/test/assets/www/autotest/tests/contacts.tests.js
@@ -0,0 +1,219 @@
+Tests.prototype.ContactsTests = function() {
+       module("Contacts (navigator.contacts)");
+       test("should exist", function() {
+               expect(1);
+               ok(navigator.contacts != null, "navigator.contacts should not 
be null.");
+       });     
+       test("should contain a find function", function() {
+               expect(2);
+               ok(typeof navigator.contacts.find != 'undefined' && 
navigator.contacts.find != null, "navigator.contacts.find should not be null.");
+               ok(typeof navigator.contacts.find == 'function', 
"navigator.contacts.find should be a function.");
+       });
+    test("contacts.find success callback should be called with an array", 
function() {
+        expect(2);
+        QUnit.stop(Tests.TEST_TIMEOUT);
+        var win = function(result) {
+            ok(typeof result == 'object', "Object returned in contacts.find 
success callback is of type 'object' (actually array).");
+            ok(typeof result.length == 'number', "Object returned in 
contacts.find success callback has a length property which is numerical.");
+            QUnit.start();
+        };
+        var fail = function() { QUnit.start(); };
+        var obj = new ContactFindOptions();
+        obj.filter="";
+        obj.multiple=true;
+        navigator.contacts.find(["displayName", "name", "phoneNumbers", 
"emails"], win, fail, obj);
+    }); 
+    test("contacts.find success callback should not be null", function() {
+        expect(1);
+        var fail = function() {};
+        var obj = new ContactFindOptions();
+        obj.filter="";
+        obj.multiple=true;
+        try {
+            navigator.contacts.find(["displayName", "name", "emails", 
"phoneNumbers"], null, fail, obj);
+        } catch(e) {
+            ok(true, "Trying to find with a null success call back should 
throw TypeError.");
+        }
+    }); 
+    test("contacts.find error callback should be called when no fields are 
specified", function() {
+        expect(2);
+        QUnit.stop(Tests.TEST_TIMEOUT);
+        var win = function(result) {
+            QUnit.start();
+        };
+        var fail = function(result) { 
+            ok(typeof result == 'object', "Object returned in contact.find 
failure callback is of type 'object' (actually ContactError).");
+            ok(result.code == ContactError.INVALID_ARGUMENT_ERROR, "Object 
returned in contacts.find failure callback has a code property which equal to 
ContactError.INVALID_ARGUMENT_ERROR.");
+            QUnit.start(); 
+        };
+        var obj = new ContactFindOptions();
+        obj.filter="";
+        obj.multiple=true;
+        navigator.contacts.find([], win, fail, obj);
+    }); 
+       test("should contain a create function", function() {
+               expect(2);
+               ok(typeof navigator.contacts.create != 'undefined' && 
navigator.contacts.create != null, "navigator.contacts.create should not be 
null.");
+               ok(typeof navigator.contacts.create == 'function', 
"navigator.contacts.create should be a function.");
+       });
+       test("contacts.create should return a Contact object", function() {
+               expect(9);
+               var obj = navigator.contacts.create({"displayName": "test 
name", "gender": "male", "note": "my note", "name": {"formatted": "Mr. Test 
Name"}, "emails": [{"value": "[email protected]"}, {"value": "[email protected]"}]}); 
          
+               ok(obj != 'undefined' && obj != null, 
"navigator.contacts.create should return a Contact object.");
+               ok(obj.displayName == 'test name', "Contact should contain a 
displayName property.");
+               ok(obj.gender == 'male', "Contact should contain a gender 
property.");
+               ok(obj.note == 'my note', "Contact should contain a note 
property.");
+               ok(obj.name.formatted == 'Mr. Test Name', "Contact should 
contain a name.formatted property.");
+               ok(obj.emails.length == 2, "Contact should contain and array of 
emails with 2 entries");
+               ok(obj.emails[0].value == '[email protected]', "Contact.emails[1] 
should contain a value.");
+               ok(obj.emails[1].value == '[email protected]', "Contact.emails[2] 
should contain a value.");       
+               ok(obj.birthday == null, "Contact object should not contain a 
birthday property.");
+       });
+       module("Contact model");
+       test("should be able to define a Contact object", function() {
+               expect(15);
+               var contact = new Contact("a", "b", new ContactName("a", "b", 
"c", "d", "e", "f"), "c", [], [], [], [], [], "f", "i",  
+                               [], [], []);
+               ok(contact != null, "new Contact() should not be null.");
+               ok(typeof contact.id != 'undefined' && contact.id != null && 
contact.id == "a", "new Contact() should include a 'id' property.");
+               ok(typeof contact.displayName != 'undefined' && 
contact.displayName != null && contact.displayName == "b", "new Contact() 
should include a 'displayName' property.");
+               ok(typeof contact.name != 'undefined' && contact.name != null 
&& contact.name.formatted == "a", "new Contact() should include a 'name' 
property.");
+               ok(typeof contact.nickname != 'undefined' && contact.nickname 
!= null && contact.nickname == "c", "new Contact() should include a 'nickname' 
property.");
+               ok(typeof contact.phoneNumbers != 'undefined' && 
contact.phoneNumbers != null, "new Contact() should include a 'phoneNumbers' 
property.");
+               ok(typeof contact.emails != 'undefined' && contact.emails != 
null, "new Contact() should include a 'emails' property.");
+               ok(typeof contact.addresses != 'undefined' && contact.addresses 
!= null, "new Contact() should include a 'addresses' property.");
+               ok(typeof contact.ims != 'undefined' && contact.ims != null, 
"new Contact() should include a 'ims' property.");
+               ok(typeof contact.organizations != 'undefined' && 
contact.organizations != null, "new Contact() should include a 'organizations' 
property.");
+               ok(typeof contact.birthday != 'undefined' && contact.birthday 
!= null && contact.birthday == "f", "new Contact() should include a 'birthday' 
property.");
+               ok(typeof contact.note != 'undefined' && contact.note != null 
&& contact.note == "i", "new Contact() should include a 'note' property.");
+               ok(typeof contact.photos != 'undefined' && contact.photos != 
null, "new Contact() should include a 'photos' property.");
+               ok(typeof contact.categories != 'undefined' && 
contact.categories != null, "new Contact() should include a 'categories' 
property.");
+               ok(typeof contact.urls != 'undefined' && contact.urls != null, 
"new Contact() should include a 'urls' property.");
+       });     
+       test("should be able to define a ContactName object", function() {
+               expect(7);
+               var contactName = new ContactName("Dr. First Last Jr.", "Last", 
"First", "Middle", "Dr.", "Jr.");
+               ok(contactName != null, "new ContactName() should not be 
null.");
+               ok(typeof contactName.formatted != 'undefined' && 
contactName.formatted != null && contactName.formatted == "Dr. First Last Jr.", 
"new ContactName() should include a 'formatted' property.");
+               ok(typeof contactName.familyName != 'undefined' && 
contactName.familyName != null && contactName.familyName == "Last", "new 
ContactName() should include a 'familyName' property.");
+               ok(typeof contactName.givenName != 'undefined' && 
contactName.givenName != null && contactName.givenName == "First", "new 
ContactName() should include a 'givenName' property.");
+               ok(typeof contactName.middleName != 'undefined' && 
contactName.middleName != null && contactName.middleName == "Middle", "new 
ContactName() should include a 'middleName' property.");
+               ok(typeof contactName.honorificPrefix != 'undefined' && 
contactName.honorificPrefix != null && contactName.honorificPrefix == "Dr.", 
"new ContactName() should include a 'honorificPrefix' property.");
+               ok(typeof contactName.honorificSuffix != 'undefined' && 
contactName.honorificSuffix != null && contactName.honorificSuffix == "Jr.", 
"new ContactName() should include a 'honorificSuffix' property.");
+       });     
+       test("should be able to define a ContactField object", function() {
+               expect(4);
+               var contactField = new ContactField("home", "8005551212", true);
+               ok(contactField != null, "new ContactField() should not be 
null.");
+               ok(typeof contactField.type != 'undefined' && contactField.type 
!= null && contactField.type == "home", "new ContactField() should include a 
'type' property.");
+               ok(typeof contactField.value != 'undefined' && 
contactField.value != null && contactField.value == "8005551212", "new 
ContactField() should include a 'value' property.");
+               ok(typeof contactField.pref != 'undefined' && contactField.pref 
!= null && contactField.pref == true, "new ContactField() should include a 
'pref' property.");
+       });     
+       test("should be able to define a ContactAddress object", function() {
+               expect(9);
+               var contactAddress = new ContactAddress(true, "home", 
"a","b","c","d","e","f");
+               ok(contactAddress != null, "new ContactAddress() should not be 
null.");
+        ok(typeof contactAddress.pref != 'undefined' && contactAddress.pref != 
null && contactAddress.pref == true, "new ContactAddress() should include a 
'pref' property.");
+        ok(typeof contactAddress.type != 'undefined' && contactAddress.type != 
null && contactAddress.type == "home", "new ContactAddress() should include a 
'type' property.");
+               ok(typeof contactAddress.formatted != 'undefined' && 
contactAddress.formatted != null && contactAddress.formatted == "a", "new 
ContactAddress() should include a 'formatted' property.");
+               ok(typeof contactAddress.streetAddress != 'undefined' && 
contactAddress.streetAddress != null && contactAddress.streetAddress == "b", 
"new ContactAddress() should include a 'streetAddress' property.");
+               ok(typeof contactAddress.locality != 'undefined' && 
contactAddress.locality != null && contactAddress.locality == "c", "new 
ContactAddress() should include a 'locality' property.");
+               ok(typeof contactAddress.region != 'undefined' && 
contactAddress.region != null && contactAddress.region == "d", "new 
ContactAddress() should include a 'region' property.");
+               ok(typeof contactAddress.postalCode != 'undefined' && 
contactAddress.postalCode != null && contactAddress.postalCode == "e", "new 
ContactAddress() should include a 'postalCode' property.");
+               ok(typeof contactAddress.country != 'undefined' && 
contactAddress.country != null && contactAddress.country == "f", "new 
ContactAddress() should include a 'country' property.");
+       });     
+       test("should be able to define a ContactOrganization object", 
function() {
+               expect(6);
+               var contactOrg = new ContactOrganization(true, "home", 
"a","b","c","d","e","f","g");
+               ok(contactOrg != null, "new ContactOrganization() should not be 
null.");
+        ok(typeof contactOrg.pref != 'undefined' && contactOrg.pref != null && 
contactOrg.pref == true, "new ContactOrganization() should include a 'pref' 
property.");
+        ok(typeof contactOrg.type != 'undefined' && contactOrg.type != null && 
contactOrg.type == "home", "new ContactOrganization() should include a 'type' 
property.");
+               ok(typeof contactOrg.name != 'undefined' && contactOrg.name != 
null && contactOrg.name == "a", "new ContactOrganization() should include a 
'name' property.");
+               ok(typeof contactOrg.department != 'undefined' && 
contactOrg.department != null && contactOrg.department == "b", "new 
ContactOrganization() should include a 'department' property.");
+               ok(typeof contactOrg.title != 'undefined' && contactOrg.title 
!= null && contactOrg.title == "c", "new ContactOrganization() should include a 
'title' property.");
+       });     
+       test("should be able to define a ContactFindOptions object", function() 
{
+               expect(3);
+               var contactFindOptions = new ContactFindOptions("a", true, "b");
+               ok(contactFindOptions != null, "new ContactFindOptions() should 
not be null.");
+               ok(typeof contactFindOptions.filter != 'undefined' && 
contactFindOptions.filter != null && contactFindOptions.filter == "a", "new 
ContactFindOptions() should include a 'filter' property.");
+               ok(typeof contactFindOptions.multiple != 'undefined' && 
contactFindOptions.multiple != null && contactFindOptions.multiple == true, 
"new ContactFindOptions() should include a 'multiple' property.");
+       });     
+       module("Contact Object");
+       test("should contain a clone function", function() {
+               expect(2);
+               var contact = new Contact();
+               ok(typeof contact.clone != 'undefined' && contact.clone != 
null, "contact.clone should not be null.");
+               ok(typeof contact.clone == 'function', "contact.clone should be 
a function.");
+       });
+       test("clone function should make deep copy of Contact Object", 
function() {
+               expect(8);
+               var contact = new Contact();
+               contact.id=1;
+               contact.displayName="Test Name";
+               contact.nickname="Testy";
+               contact.gender="male";
+               contact.note="note to be cloned";
+               contact.name = new ContactName("Mr. Test Name");
+               
+               var clonedContact = contact.clone();
+               
+               ok(contact.id == 1, "contact.id should be 1.");
+               ok(clonedContact.id == null, "clonedContact.id should be 
null.");
+               ok(clonedContact.displayName == contact.displayName, 
"displayName's should be equal");
+               ok(clonedContact.nickname == contact.nickname, "nickname's 
should be equal");
+               ok(clonedContact.gender == contact.gender, "gender's should be 
equal");
+               ok(clonedContact.note == contact.note, "note's should be 
equal");
+               ok(clonedContact.name.formatted == contact.name.formatted, 
"name.formatted's should be equal");
+               ok(clonedContact.connected == contact.connected, "connected's 
should be equal (null)");
+       });
+       test("should contain a remove function", function() {
+               expect(2);
+               var contact = new Contact();
+               ok(typeof contact.remove != 'undefined' && contact.remove != 
null, "contact.remove should not be null.");
+               ok(typeof contact.remove == 'function', "contact.remove should 
be a function.");
+       });
+       test("calling remove on a contact has an id of null should return 
ContactError.UNKNOWN_ERROR", function() {
+        QUnit.stop(Tests.TEST_TIMEOUT);
+               expect(2);
+               var win = function(result) {
+               };
+               var fail = function(result) {
+                       ok(typeof result == 'object', "Object returned in 
contact.remove failure callback is of type 'object' (actually ContactError).");
+                       ok(result.code == ContactError.UNKNOWN_ERROR, "Object 
returned in contacts.remove failure callback has a code property which equal to 
ContactError.UNKNOWN_ERROR.");
+                       QUnit.start();
+               };
+               var rmContact = new Contact();
+               rmContact.remove(win, fail);
+       });
+       test("calling remove on a contact that does not exist should return 
ContactError.UNKNOWN_ERROR", function() {
+        QUnit.stop(Tests.TEST_TIMEOUT);
+               expect(2);
+               var win = function(result) {
+               };
+               var fail = function(result) {
+                       ok(typeof result == 'object', "Object returned in 
contact.remove failure callback is of type 'object' (actually ContactError).");
+                       ok(result.code == ContactError.UNKNOWN_ERROR, "Object 
returned in contacts.remove failure callback has a code property which equal to 
ContactError.UNKNOWN_ERROR.");
+                       QUnit.start();
+               };
+               var contact = new Contact(99);
+               contact.remove(win, fail);              
+       });
+       test("should contain a save function", function() {
+               expect(2);
+               var contact = new Contact();
+               ok(typeof contact.save != 'undefined' && contact.save != null, 
"contact.save should not be null.");
+               ok(typeof contact.save == 'function', "contact.save should be a 
function.");
+       });
+    module('ContactError interface');
+    test("ContactError constants should be defined", function() {
+        expect(7);
+        equal(ContactError.UNKNOWN_ERROR, 0, "ContactError.UNKNOWN_ERROR 
should be defined");
+        equal(ContactError.INVALID_ARGUMENT_ERROR, 1, 
"ContactError.INVALID_ARGUMENT_ERROR should be defined");
+        equal(ContactError.TIMEOUT_ERROR, 2, "ContactError.TIMEOUT_ERROR 
should be defined");
+        equal(ContactError.PENDING_OPERATION_ERROR, 3, 
"ContactError.PENDING_OPERATION_ERROR should be defined");
+        equal(ContactError.IO_ERROR, 4, "ContactError.IO_ERROR should be 
defined");
+        equal(ContactError.NOT_SUPPORTED_ERROR, 5, 
"ContactError.NOT_SUPPORTED_ERROR should be defined");
+        equal(ContactError.PERMISSION_DENIED_ERROR, 20, 
"ContactError.PERMISSION_DENIED_ERROR should be defined");
+    });
+};

http://git-wip-us.apache.org/repos/asf/incubator-cordova-android/blob/ae8bc77e/test/assets/www/autotest/tests/device.tests.js
----------------------------------------------------------------------
diff --git a/test/assets/www/autotest/tests/device.tests.js 
b/test/assets/www/autotest/tests/device.tests.js
new file mode 100644
index 0000000..537aeda
--- /dev/null
+++ b/test/assets/www/autotest/tests/device.tests.js
@@ -0,0 +1,36 @@
+Tests.prototype.DeviceTests = function() {
+       module('Device Information (window.device)');
+       test("should exist", function() {
+               expect(1);
+               ok(window.device != null, "window.device should not be null.");
+       });
+       test("should contain a platform specification that is a string", 
function() {
+               expect(2);
+               ok(typeof window.device.platform != 'undefined' && 
window.device.platform != null, "window.device.platform should not be null.")
+               ok((new String(window.device.platform)).length > 0, 
"window.device.platform should contain some sort of description.")
+       });
+       test("should contain a version specification that is a string", 
function() {
+               expect(2);
+               ok(typeof window.device.version != 'undefined' && 
window.device.version != null, "window.device.version should not be null.")
+               ok((new String(window.device.version)).length > 0, 
"window.device.version should contain some kind of description.")
+       });
+       test("should contain a name specification that is a string", function() 
{
+               expect(2);
+               ok(typeof window.device.name != 'undefined' && 
window.device.name != null, "window.device.name should not be null.")
+               ok((new String(window.device.name)).length > 0, 
"window.device.name should contain some kind of description.")
+       });
+       test("should contain a UUID specification that is a string or a 
number", function() {
+               expect(2);
+               ok(typeof window.device.uuid != 'undefined' && 
window.device.uuid != null, "window.device.uuid should not be null.")
+               if (typeof window.device.uuid == 'string' || typeof 
window.device.uuid == 'object') {
+                       ok((new String(window.device.uuid)).length > 0, 
"window.device.uuid, as a string, should have at least one character.")
+               } else {
+                       ok(window.device.uuid > 0, "window.device.uuid, as a 
number, should be greater than 0. (should it, even?)")
+               }
+       });
+       test("should contain a phonegap specification that is a string", 
function() {
+               expect(2);
+               ok(typeof window.device.phonegap != 'undefined' && 
window.device.phonegap != null, "window.device.phonegap should not be null.")
+               ok((new String(window.device.phonegap)).length > 0, 
"window.device.phonegap should contain some kind of description.")
+       });
+};
\ No newline at end of file

Reply via email to