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/05/14 22:21:01 UTC
[6/8] removed duplicate mobile-spec tests,
test project now redirects to tests hosted in the gh_pages branch of
mobilespec
http://git-wip-us.apache.org/repos/asf/incubator-cordova-wp7/blob/4251cf3e/tests/MobileSpecUnitTests/www/autotest/tests/filetransfer.tests.js
----------------------------------------------------------------------
diff --git a/tests/MobileSpecUnitTests/www/autotest/tests/filetransfer.tests.js b/tests/MobileSpecUnitTests/www/autotest/tests/filetransfer.tests.js
deleted file mode 100644
index 822e7da..0000000
--- a/tests/MobileSpecUnitTests/www/autotest/tests/filetransfer.tests.js
+++ /dev/null
@@ -1,45 +0,0 @@
-describe('FileTransfer', function() {
- it("should exist and be constructable", function() {
- var ft = new FileTransfer();
- expect(ft).toBeDefined();
- });
- it("should contain proper functions", function() {
- var ft = new FileTransfer();
- expect(typeof ft.upload).toBe('function');
- expect(typeof ft.download).toBe('function');
- });
- describe('FileTransferError', function() {
- it("FileTransferError constants should be defined", function() {
- expect(FileTransferError.FILE_NOT_FOUND_ERR).toBe(1);
- expect(FileTransferError.INVALID_URL_ERR).toBe(2);
- expect(FileTransferError.CONNECTION_ERR).toBe(3);
- });
- });
- describe('download method', function() {
- it("should be able to download a file", function() {
- var fail = jasmine.createSpy();
- var remoteFile = "https://ajax.googleapis.com/ajax/libs/dojo/1.7.2/dojo/dojo.js";
- var localFileName = remoteFile.substring(remoteFile.lastIndexOf('/')+1);
- var downloadWin = jasmine.createSpy().andCallFake(function(entry) {
- console.log("got download callback");
- expect(entry.name).toBe(localFileName);
- });
- var fileWin = function(fileEntry) {
- var ft = new FileTransfer();
- ft.download(remoteFile, fileEntry.fullPath, downloadWin,fail);
- };
-
- // root is defined in the html page containing these tests
- runs(function() {
- root.getFile(localFileName, {create: true, exclusive: false}, fileWin, fail);
- });
-
- waitsFor(function() { return downloadWin.wasCalled; }, "downloadWin", Tests.TEST_TIMEOUT);
-
- runs(function() {
- expect(downloadWin).toHaveBeenCalled();
- expect(fail).not.toHaveBeenCalled();
- });
- });
- });
-});
http://git-wip-us.apache.org/repos/asf/incubator-cordova-wp7/blob/4251cf3e/tests/MobileSpecUnitTests/www/autotest/tests/geolocation.tests.js
----------------------------------------------------------------------
diff --git a/tests/MobileSpecUnitTests/www/autotest/tests/geolocation.tests.js b/tests/MobileSpecUnitTests/www/autotest/tests/geolocation.tests.js
deleted file mode 100644
index 718d582..0000000
--- a/tests/MobileSpecUnitTests/www/autotest/tests/geolocation.tests.js
+++ /dev/null
@@ -1,100 +0,0 @@
-describe('Geolocation (navigator.geolocation)', function () {
- it("should exist", function() {
- expect(navigator.geolocation).toBeDefined();
- });
-
- it("should contain a getCurrentPosition function", function() {
- expect(typeof navigator.geolocation.getCurrentPosition).toBeDefined();
- expect(typeof navigator.geolocation.getCurrentPosition == 'function').toBe(true);
- });
-
- it("should contain a watchPosition function", function() {
- expect(typeof navigator.geolocation.watchPosition).toBeDefined();
- expect(typeof navigator.geolocation.watchPosition == 'function').toBe(true);
- });
-
- it("should contain a clearWatch function", function() {
- expect(typeof navigator.geolocation.clearWatch).toBeDefined();
- expect(typeof navigator.geolocation.clearWatch == 'function').toBe(true);
- });
-
- it("getCurrentPosition success callback should be called with a Position object", function() {
- var win = jasmine.createSpy().andCallFake(function(a) {
- expect(p.coords).not.toBe(null);
- expect(p.timestamp).not.toBe(null);
- }),
- fail = jasmine.createSpy();
-
- runs(function () {
- navigator.geolocation.getCurrentPosition(win, fail, {
- maximumAge:300000 // 5 minutes maximum age of cached position
- });
- });
-
- waitsFor(function () { return win.wasCalled; }, "win never called", Tests.TEST_TIMEOUT);
-
- runs(function () {
- expect(fail).not.toHaveBeenCalled();
- });
- });
-
- it("getCurrentPosition success callback should be called with a cached Position", function() {
- var win = jasmine.createSpy().andCallFake(function(a) {
- expect(p.coords instanceof Position).toBe(true);
- }),
- fail = jasmine.createSpy();
-
- runs(function () {
- navigator.geolocation.getCurrentPosition(win, fail, {
- maximumAge:300000 // 5 minutes
- });
- });
-
- waitsFor(function () { return win.wasCalled; }, "win never called", Tests.TEST_TIMEOUT);
-
- runs(function () {
- expect(fail).not.toHaveBeenCalled();
- });
- });
-
- it("getCurrentPosition error callback should be called if we set timeout to 0 and maximumAge to a very small number", function() {
- var win = jasmine.createSpy(),
- fail = jasmine.createSpy();
-
- runs(function () {
- navigator.geolocation.getCurrentPosition(win, fail, {
- maximumAge: 0,
- timeout: 0
- });
- });
-
- waitsFor(function () { return fail.wasCalled; }, "fail never called", Tests.TEST_TIMEOUT);
-
- runs(function () {
- expect(win).not.toHaveBeenCalled();
- });
- });
-
- // TODO: Need to test error callback... how?
- // TODO: Need to test watchPosition success callback, test that makes sure clearPosition works (how to test that a timer is getting cleared?)
- describe("Geolocation model", function () {
- it("should be able to define a Position object with coords and timestamp properties", function() {
- var pos = new Position({}, new Date());
- expect(pos).toBeDefined();
- expect(pos.coords).toBeDefined();
- expect(pos.timestamp).toBeDefined();
- });
-
- it("should be able to define a Coordinates object with latitude, longitude, accuracy, altitude, heading, speed and altitudeAccuracy properties", function() {
- var coords = new Coordinates(1,2,3,4,5,6,7);
- expect(coords).toBeDefined();
- expect(coords.latitude).toBeDefined();
- expect(coords.longitude).toBeDefined();
- expect(coords.accuracy).toBeDefined();
- expect(coords.altitude).toBeDefined();
- expect(coords.heading).toBeDefined();
- expect(coords.speed).toBeDefined();
- expect(coords.altitudeAccuracy).toBeDefined();
- });
- });
-});
http://git-wip-us.apache.org/repos/asf/incubator-cordova-wp7/blob/4251cf3e/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
deleted file mode 100644
index d0e6c4f..0000000
--- a/tests/MobileSpecUnitTests/www/autotest/tests/media.tests.js
+++ /dev/null
@@ -1,144 +0,0 @@
-describe('Media', function () {
- it("should exist", function() {
- expect(Media).toBeDefined();
- expect(typeof Media).toBe("function");
- });
-
- it("should have the following properties", function() {
- var media1 = new Media("dummy");
- expect(media1.id).toBeDefined();
- expect(media1.src).toBeDefined();
- expect(media1._duration).toBeDefined();
- expect(media1._position).toBeDefined();
- media1.release();
- });
-
- it("should define constants for Media errors", function() {
- expect(MediaError).toBeDefined();
- expect(MediaError.MEDIA_ERR_NONE_ACTIVE).toBe(0);
- expect(MediaError.MEDIA_ERR_ABORTED).toBe(1);
- expect(MediaError.MEDIA_ERR_NETWORK).toBe(2);
- expect(MediaError.MEDIA_ERR_DECODE).toBe(3);
- expect(MediaError.MEDIA_ERR_NONE_SUPPORTED).toBe(4);
- });
-
- it("should contain a play function", function() {
- var media1 = new Media();
- expect(media1.play).toBeDefined();
- expect(typeof media1.play).toBe('function');
- media1.release();
- });
-
- it("should contain a stop function", function() {
- var media1 = new Media();
- expect(media1.stop).toBeDefined();
- expect(typeof media1.stop).toBe('function');
- media1.release();
- });
-
- it("should contain a seekTo function", function() {
- var media1 = new Media();
- expect(media1.seekTo).toBeDefined();
- expect(typeof media1.seekTo).toBe('function');
- media1.release();
- });
-
- it("should contain a pause function", function() {
- var media1 = new Media();
- expect(media1.pause).toBeDefined();
- expect(typeof media1.pause).toBe('function');
- media1.release();
- });
-
- it("should contain a getDuration function", function() {
- var media1 = new Media();
- expect(media1.getDuration).toBeDefined();
- expect(typeof media1.getDuration).toBe('function');
- media1.release();
- });
-
- it("should contain a getCurrentPosition function", function() {
- var media1 = new Media();
- expect(media1.getCurrentPosition).toBeDefined();
- expect(typeof media1.getCurrentPosition).toBe('function');
- media1.release();
- });
-
- it("should contain a startRecord function", function() {
- var media1 = new Media();
- expect(media1.startRecord).toBeDefined();
- expect(typeof media1.startRecord).toBe('function');
- media1.release();
- });
-
- it("should contain a stopRecord function", function() {
- var media1 = new Media();
- expect(media1.stopRecord).toBeDefined();
- expect(typeof media1.stopRecord).toBe('function');
- media1.release();
- });
-
- it("should contain a release function", function() {
- var media1 = new Media();
- expect(media1.release).toBeDefined();
- expect(typeof media1.release).toBe('function');
- media1.release();
- });
-
- it("should contain a setVolume function", function() {
- var media1 = new Media();
- expect(media1.setVolume).toBeDefined();
- expect(typeof media1.setVolume).toBe('function');
- media1.release();
- });
-
- it("should return MediaError for bad filename", function() {
- var badMedia = null,
- win = jasmine.createSpy(),
- fail = jasmine.createSpy().andCallFake(function (result) {
- expect(result).toBeDefined();
- expect(result.code).toBe(MediaError.MEDIA_ERR_ABORTED);
- });
-
- runs(function () {
- badMedia = new Media("invalid.file.name", win,fail);
- badMedia.play();
- });
-
- waitsFor(function () { return fail.wasCalled; }, Tests.TEST_TIMEOUT);
-
- runs(function () {
- expect(win).not.toHaveBeenCalled();
- badMedia.release();
- });
- });
-
- it("position should be set properly", function() {
- var media1 = new Media("http://audio.ibeat.org/content/p1rj1s/p1rj1s_-_rockGuitar.mp3"),
- test = jasmine.createSpy().andCallFake(function(position) {
- console.log("position = " + position);
- expect(position).toBeGreaterThan(0.0);
- media1.stop()
- media1.release();
- });
-
- media1.play();
-
- waits(5000);
-
- runs(function () {
- media1.getCurrentPosition(test, function () {});
- });
-
- waitsFor(function () { return test.wasCalled; }, Tests.TEST_TIMEOUT);
- });
-
- it("duration should be set properly", function() {
- var media1 = new Media("http://audio.ibeat.org/content/p1rj1s/p1rj1s_-_rockGuitar.mp3");
- media1.play();
- waits(5000);
- runs(function () {
- expect(media1.getDuration()).toBeGreaterThan(0.0);
- });
- });
-});
http://git-wip-us.apache.org/repos/asf/incubator-cordova-wp7/blob/4251cf3e/tests/MobileSpecUnitTests/www/autotest/tests/network.tests.js
----------------------------------------------------------------------
diff --git a/tests/MobileSpecUnitTests/www/autotest/tests/network.tests.js b/tests/MobileSpecUnitTests/www/autotest/tests/network.tests.js
deleted file mode 100644
index 780097f..0000000
--- a/tests/MobileSpecUnitTests/www/autotest/tests/network.tests.js
+++ /dev/null
@@ -1,25 +0,0 @@
-describe('Network (navigator.network)', function () {
- it("should exist", function() {
- expect(navigator.network).toBeDefined();
- });
-
- describe('Network Information API', function () {
- it("connection should exist", function() {
- expect(navigator.network.connection).toBeDefined();
- });
-
- it("should contain connection properties", function() {
- expect(navigator.network.connection.type).toBeDefined();
- });
-
- it("should define constants for connection status", function() {
- expect(Connection.UNKNOWN).toBe("unknown");
- expect(Connection.ETHERNET).toBe("ethernet");
- expect(Connection.WIFI).toBe("wifi");
- expect(Connection.CELL_2G).toBe("2g");
- expect(Connection.CELL_3G).toBe("3g");
- expect(Connection.CELL_4G).toBe("4g");
- expect(Connection.NONE).toBe("none");
- });
- });
-});
http://git-wip-us.apache.org/repos/asf/incubator-cordova-wp7/blob/4251cf3e/tests/MobileSpecUnitTests/www/autotest/tests/notification.tests.js
----------------------------------------------------------------------
diff --git a/tests/MobileSpecUnitTests/www/autotest/tests/notification.tests.js b/tests/MobileSpecUnitTests/www/autotest/tests/notification.tests.js
deleted file mode 100644
index 61c795d..0000000
--- a/tests/MobileSpecUnitTests/www/autotest/tests/notification.tests.js
+++ /dev/null
@@ -1,20 +0,0 @@
-describe('Notification (navigator.notification)', function () {
- it("should exist", function() {
- expect(navigator.notification).toBeDefined();
- });
-
- it("should contain a vibrate function", function() {
- expect(typeof navigator.notification.vibrate).toBeDefined();
- expect(typeof navigator.notification.vibrate).toBe("function");
- });
-
- it("should contain a beep function", function() {
- expect(typeof navigator.notification.beep).toBeDefined();
- expect(typeof navigator.notification.beep).toBe("function");
- });
-
- it("should contain a alert function", function() {
- expect(typeof navigator.notification.alert).toBeDefined();
- expect(typeof navigator.notification.alert).toBe("function");
- });
-});
http://git-wip-us.apache.org/repos/asf/incubator-cordova-wp7/blob/4251cf3e/tests/MobileSpecUnitTests/www/autotest/tests/orientation.tests.js
----------------------------------------------------------------------
diff --git a/tests/MobileSpecUnitTests/www/autotest/tests/orientation.tests.js b/tests/MobileSpecUnitTests/www/autotest/tests/orientation.tests.js
deleted file mode 100644
index 5dcfcf1..0000000
--- a/tests/MobileSpecUnitTests/www/autotest/tests/orientation.tests.js
+++ /dev/null
@@ -1,34 +0,0 @@
-Tests.prototype.OrientationTests = function() {
- module('Orientation (navigator.orientation)');
- test("should exist", function() {
- expect(1);
- ok(navigator.orientation != null, "navigator.orientation should not be null.");
- });
- test("should have an initially null lastPosition property", function() {
- expect(1);
- ok(typeof navigator.orientation.currentOrientation != 'undefined' && navigator.orientation.currentOrientation == null, "navigator.orientation.currentOrientation should be initially null.");
- });
- test("should contain a getCurrentOrientation function", function() {
- expect(2);
- ok(typeof navigator.orientation.getCurrentOrientation != 'undefined' && navigator.orientation.getCurrentOrientation != null, "navigator.orientation.getCurrentOrientation should not be null.");
- ok(typeof navigator.orientation.getCurrentOrientation == 'function', "navigator.orientation.getCurrentOrientation should be a function.");
- });
- test("should contain a watchOrientation function", function() {
- expect(2);
- ok(typeof navigator.orientation.watchOrientation != 'undefined' && navigator.orientation.watchOrientation != null, "navigator.orientation.watchOrientation should not be null.");
- ok(typeof navigator.orientation.watchOrientation == 'function', "navigator.orientation.watchOrientation should be a function.");
- });
- // TODO: add tests for DisplayOrientation constants?
- test("getCurrentOrientation success callback should be called with an Orientation enumeration", function() {
- expect(2);
- QUnit.stop(Tests.TEST_TIMEOUT);
- var win = function(orient) {
- ok(0 <= orient <= 6, "Position object returned in getCurrentPosition success callback is a valid DisplayOrientation value.");
- equals(orient, navigator.orientation.currentOrientation, "Orientation value returned in getCurrentOrientation success callback equals navigator.orientation.currentOrientation.");
- start();
- };
- var fail = function() { start(); };
- navigator.orientation.getCurrentOrientation(win, fail);
- });
- // TODO: Need to test watchPosition success callback, test that makes sure clearPosition works (how to test that a timer is getting cleared?)
-};
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-cordova-wp7/blob/4251cf3e/tests/MobileSpecUnitTests/www/autotest/tests/platform.tests.js
----------------------------------------------------------------------
diff --git a/tests/MobileSpecUnitTests/www/autotest/tests/platform.tests.js b/tests/MobileSpecUnitTests/www/autotest/tests/platform.tests.js
deleted file mode 100644
index cf05356..0000000
--- a/tests/MobileSpecUnitTests/www/autotest/tests/platform.tests.js
+++ /dev/null
@@ -1,35 +0,0 @@
-describe('Platform (cordova)', function () {
- it("should exist", function() {
- expect(cordova).toBeDefined();
- });
- describe('Platform (Cordova)', function () {
- it("should exist", function() {
- expect(window.Cordova).toBeDefined();
- });
- });
- describe('Platform (PhoneGap)', function () {
- it("should exist", function() {
- expect(PhoneGap).toBeDefined();
- });
-
- it("exec method should exist", function() {
- expect(PhoneGap.exec).toBeDefined();
- expect(typeof PhoneGap.exec).toBe('function');
- });
-
- it("addPlugin method should exist", function() {
- expect(PhoneGap.addPlugin).toBeDefined();
- expect(typeof PhoneGap.addPlugin).toBe('function');
- });
-
- it("addConstructor method should exist", function() {
- expect(PhoneGap.addConstructor).toBeDefined();
- expect(typeof PhoneGap.addConstructor).toBe('function');
- });
- });
- describe('Platform (window.plugins)', function () {
- it("should exist", function() {
- expect(window.plugins).toBeDefined();
- });
- });
-});
http://git-wip-us.apache.org/repos/asf/incubator-cordova-wp7/blob/4251cf3e/tests/MobileSpecUnitTests/www/autotest/tests/storage.tests.js
----------------------------------------------------------------------
diff --git a/tests/MobileSpecUnitTests/www/autotest/tests/storage.tests.js b/tests/MobileSpecUnitTests/www/autotest/tests/storage.tests.js
deleted file mode 100644
index a921de3..0000000
--- a/tests/MobileSpecUnitTests/www/autotest/tests/storage.tests.js
+++ /dev/null
@@ -1,161 +0,0 @@
-describe("Session Storage", function () {
- it("should exist", function () {
- expect(window.sessionStorage).toBeDefined();
- expect(typeof window.sessionStorage.length).not.toBe('undefined');
- expect(typeof(window.sessionStorage.key)).toBe('function');
- expect(typeof(window.sessionStorage.getItem)).toBe('function');
- expect(typeof(window.sessionStorage.setItem)).toBe('function');
- expect(typeof(window.sessionStorage.removeItem)).toBe('function');
- expect(typeof(window.sessionStorage.clear)).toBe('function');
- });
-
- it("check length", function () {
- expect(window.sessionStorage.length).toBe(0);
- window.sessionStorage.setItem("key","value");
- expect(window.sessionStorage.length).toBe(1);
- window.sessionStorage.removeItem("key");
- expect(window.sessionStorage.length).toBe(0);
- });
-
- it("check key", function () {
- expect(window.sessionStorage.key(0)).toBe(null);
- window.sessionStorage.setItem("test","value");
- expect(window.sessionStorage.key(0)).toBe("test");
- window.sessionStorage.removeItem("test");
- expect(window.sessionStorage.key(0)).toBe(null);
- });
-
- it("check getItem", function() {
- expect(window.sessionStorage.getItem("item")).toBe(null);
- window.sessionStorage.setItem("item","value");
- expect(window.sessionStorage.getItem("item")).toBe("value");
- window.sessionStorage.removeItem("item");
- expect(window.sessionStorage.getItem("item")).toBe(null);
- });
-
- it("check setItem", function() {
- expect(window.sessionStorage.getItem("item")).toBe(null);
- window.sessionStorage.setItem("item","value");
- expect(window.sessionStorage.getItem("item")).toBe("value");
- window.sessionStorage.setItem("item","newval");
- expect(window.sessionStorage.getItem("item")).toBe("newval");
- window.sessionStorage.removeItem("item");
- expect(window.sessionStorage.getItem("item")).toBe(null);
- });
-
- it("can remove an item", function () {
- expect(window.sessionStorage.getItem("item")).toBe(null);
- window.sessionStorage.setItem("item","value");
- expect(window.sessionStorage.getItem("item")).toBe("value");
- window.sessionStorage.removeItem("item");
- expect(window.sessionStorage.getItem("item")).toBe(null);
- });
-
- it("check clear", function() {
- window.sessionStorage.setItem("item1","value");
- window.sessionStorage.setItem("item2","value");
- window.sessionStorage.setItem("item3","value");
- expect(window.sessionStorage.length).toBe(3);
- window.sessionStorage.clear();
- expect(window.sessionStorage.length).toBe(0);
- });
-
- it("check dot notation", function() {
- expect(window.sessionStorage.item).not.toBeDefined();
- window.sessionStorage.item = "value";
- expect(window.sessionStorage.item).toBe("value");
- window.sessionStorage.removeItem("item");
- expect(window.sessionStorage.item).not.toBeDefined();
- });
-
- describe("Local Storage", function () {
- it("should exist", function() {
- expect(window.localStorage).toBeDefined();
- expect(window.localStorage.length).toBeDefined();
- expect(typeof window.localStorage.key).toBe("function");
- expect(typeof window.localStorage.getItem).toBe("function");
- expect(typeof window.localStorage.setItem).toBe("function");
- expect(typeof window.localStorage.removeItem).toBe("function");
- expect(typeof window.localStorage.clear).toBe("function");
- });
-
- it("check length", function() {
- expect(window.localStorage.length).toBe(0);
- window.localStorage.setItem("key","value");
- expect(window.localStorage.length).toBe(1);
- window.localStorage.removeItem("key");
- expect(window.localStorage.length).toBe(0);
- });
-
- it("check key", function() {
- expect(window.localStorage.key(0)).toBe(null);
- window.localStorage.setItem("test","value");
- expect(window.localStorage.key(0)).toBe("test");
- window.localStorage.removeItem("test");
- expect(window.localStorage.key(0)).toBe(null);
- });
-
- it("check getItem", function() {
- expect(window.localStorage.getItem("item")).toBe(null);
- window.localStorage.setItem("item","value");
- expect(window.localStorage.getItem("item")).toBe("value");
- window.localStorage.removeItem("item");
- expect(window.localStorage.getItem("item")).toBe(null);
- });
-
- it("check setItem", function() {
- expect(window.localStorage.getItem("item")).toBe(null);
- window.localStorage.setItem("item","value");
- expect(window.localStorage.getItem("item")).toBe("value");
- window.localStorage.setItem("item","newval");
- expect(window.localStorage.getItem("item")).toBe("newval");
- window.localStorage.removeItem("item");
- expect(window.localStorage.getItem("item")).toBe(null);
- });
-
- it("check removeItem", function() {
- expect(window.localStorage.getItem("item")).toBe(null);
- window.localStorage.setItem("item","value");
- expect(window.localStorage.getItem("item")).toBe("value");
- window.localStorage.removeItem("item");
- expect(window.localStorage.getItem("item")).toBe(null);
- });
-
- it("check clear", function() {
- expect(window.localStorage.getItem("item1")).toBe(null);
- expect(window.localStorage.getItem("item2")).toBe(null);
- expect(window.localStorage.getItem("item3")).toBe(null);
- window.localStorage.setItem("item1","value");
- window.localStorage.setItem("item2","value");
- window.localStorage.setItem("item3","value");
- expect(window.localStorage.getItem("item1")).toBe("value");
- expect(window.localStorage.getItem("item2")).toBe("value");
- expect(window.localStorage.getItem("item3")).toBe("value");
- expect(window.localStorage.length).toBe(3);
- window.localStorage.clear();
- expect(window.localStorage.length).toBe(0);
- expect(window.localStorage.getItem("item1")).toBe(null);
- expect(window.localStorage.getItem("item2")).toBe(null);
- expect(window.localStorage.getItem("item3")).toBe(null);
- });
-
- it("check dot notation", function() {
- expect(window.localStorage.item).not.toBeDefined();
- window.localStorage.item = "value";
- expect(window.localStorage.item).toBe("value");
- window.localStorage.removeItem("item");
- expect(window.localStorage.item).not.toBeDefined();
- });
- });
-
- describe("HTML 5 Storage", function () {
- it("should exist", function() {
- expect(window.openDatabase);
- });
-
- it("Should open a database", function() {
- var db = openDatabase("Database", "1.0", "HTML5 Database API example", 200000);
- expect(db).toBeDefined();
- });
- });
-});
http://git-wip-us.apache.org/repos/asf/incubator-cordova-wp7/blob/4251cf3e/tests/MobileSpecUnitTests/www/autotest/tests/system.tests.js
----------------------------------------------------------------------
diff --git a/tests/MobileSpecUnitTests/www/autotest/tests/system.tests.js b/tests/MobileSpecUnitTests/www/autotest/tests/system.tests.js
deleted file mode 100644
index c76fdb5..0000000
--- a/tests/MobileSpecUnitTests/www/autotest/tests/system.tests.js
+++ /dev/null
@@ -1,261 +0,0 @@
-Tests.prototype.SystemTests = function() {
- module('System Information (navigator.system)');
- test("should exist", function() {
- expect(1);
- ok(navigator.system != null, "navigator.system should not be null.");
- });
- test("should contain a get function", function() {
- expect(2);
- ok(typeof navigator.system.get != 'undefined' && navigator.system.get != null, "navigator.system.get should not be null.");
- ok(typeof navigator.system.get == 'function', "navigator.system.get should be a function.");
- });
- test("should contain a has function", function() {
- expect(2);
- ok(typeof navigator.system.has != 'undefined' && navigator.system.has != null, "navigator.system.has should not be null.");
- ok(typeof navigator.system.has == 'function', "navigator.system.has should be a function.");
- });
- test("should contain a monitor function", function() {
- expect(2);
- ok(typeof navigator.system.monitor != 'undefined' && navigator.system.monitor != null, "navigator.system.monitor should not be null.");
- ok(typeof navigator.system.monitor == 'function', "navigator.system.monitor should be a function.");
- });
- module('System Information Options');
- test("should be able to define a SystemInfoOptions object", function() {
- expect(6);
- var systemInfoOptions = new SystemInfoOptions(0.0, 0.0, "a", 0, "b");
- ok(systemInfoOptions != null, "new SystemInfoOptions() should not be null.");
- ok(typeof systemInfoOptions.highThreshold != 'undefined' && systemInfoOptions.highThreshold != null && systemInfoOptions.highThreshold == 0.0, "new SystemInfoOptions() should include a 'highThreshold' property.");
- ok(typeof systemInfoOptions.lowThreshold != 'undefined' && systemInfoOptions.lowThreshold != null && systemInfoOptions.lowThreshold == 0.0, "new SystemInfoOptions() should include a 'lowThreshold' property.");
- ok(typeof systemInfoOptions.thresholdTarget != 'undefined' && systemInfoOptions.thresholdTarget != null && systemInfoOptions.thresholdTarget == "a", "new SystemInfoOptions() should include a 'thresholdTarget' property.");
- ok(typeof systemInfoOptions.timeout != 'undefined' && systemInfoOptions.timeout != null && systemInfoOptions.timeout == 0, "new SystemInfoOptions() should include a 'timeout' property.");
- ok(typeof systemInfoOptions.id != 'undefined' && systemInfoOptions.id != null && systemInfoOptions.id == "b", "new SystemInfoOptions() should include a 'id' property.");
- });
- module('Power Property');
- test("should be able to define a Power Property object", function() {
- expect(7);
- var power = new PowerAttributes("a","b",0.0,0,true,false);
- ok(power != null, "new PowerAttributes() should not be null.");
- ok(typeof power.info != 'undefined' && power.info != null && power.info == "a", "new PowerAttributes() should include a 'info' property.");
- ok(typeof power.id != 'undefined' && power.id != null && power.id == "b", "new PowerAttributes() should include a 'id' property.");
- ok(typeof power.level != 'undefined' && power.level != null && power.level == 0.0, "new PowerAttributes() should include a 'level' property.");
- ok(typeof power.timeRemaining != 'undefined' && power.timeRemaining != null && power.timeRemaining == 0, "new PowerAttributes() should include a 'timeRemaining' property.");
- ok(typeof power.isBattery != 'undefined' && power.isBattery != null && power.isBattery == true, "new PowerAttributes() should include a 'isBattery' property.");
- ok(typeof power.isCharging != 'undefined' && power.isCharging != null && power.isCharging == false, "new PowerAttributes() should include a 'isCharging' property.");
- });
- module('CPU Property');
- test("should be able to define a CPU Property object", function() {
- expect(4);
- var cpu = new CPUAttributes("a", "b", 0.0);
- ok(cpu != null, "new CPUAttributes() should not be null.");
- ok(typeof cpu.info != 'undefined' && cpu.info != null && cpu.info == "a", "new CPUAttributes() should include a 'info' property.");
- ok(typeof cpu.id != 'undefined' && cpu.id != null && cpu.id == "b", "new CPUAttributes() should include a 'id' property.");
- ok(typeof cpu.usage != 'undefined' && cpu.usage != null && cpu.usage == 0.0, "new CPUAttributes() should include a 'usage' property.");
- });
- module('Thermal Property');
- test("should be able to define a Thermal Property object", function() {
- expect(4);
- var thermal = new ThermalAttributes("a", "b", 0.0);
- ok(thermal != null, "new ThermalAttributes() should not be null.");
- ok(typeof thermal.info != 'undefined' && thermal.info != null && thermal.info == "a", "new ThermalAttributes() should include a 'info' property.");
- ok(typeof thermal.id != 'undefined' && thermal.id != null && thermal.id == "b", "new ThermalAttributes() should include a 'id' property.");
- ok(typeof thermal.state != 'undefined' && thermal.state != null && thermal.state == 0.0, "new ThermalAttributes() should include a 'state' property.");
- });
- module('Network Property');
- test("should be able to define a Network Property object", function() {
- expect(4);
- var network = new NetworkAttributes("a", "b", []);
- ok(network != null, "new NetworkAttributes() should not be null.");
- ok(typeof network.info != 'undefined' && network.info != null && network.info == "a", "new NetworkAttributes() should include a 'info' property.");
- ok(typeof network.id != 'undefined' && network.id != null && network.id == "b", "new NetworkAttributes() should include a 'id' property.");
- ok(typeof network.activeConnections != 'undefined' && network.activeConnections != null, "new NetworkAttributes() should include a 'activeConnections' property.");
- });
- module('Connection Type Property');
- test("should be able to define a display Type Property object", function() {
- expect(10);
- var connection = new ConnectionAttributes('a', 'b', ConnectionType.UNKNOWN, 0, 0, 0, 0, 0.0, false);
- ok(connection != null, "new displayAttributes() should not be null.");
- ok(typeof connection.info != 'undefined' && connection.info != null && connection.info == "a", "new ConnectionAttributes() should include a 'info' property.");
- ok(typeof connection.id != 'undefined' && connection.id != null && connection.id == "b", "new ConnectionAttributes() should include a 'id' property.");
- ok(typeof connection.type != 'undefined' && connection.type != null && connection.type == 'unknown', "new ConnectionAttributes() should include a 'type' property.");
- ok(typeof connection.currentDownloadBandwidth != 'undefined' && connection.currentDownloadBandwidth != null && connection.currentDownloadBandwidth == 0, "new ConnectionAttributes() should include a 'currentDownloadBandwidth' property.");
- ok(typeof connection.currentUploadBandwidth != 'undefined' && connection.currentUploadBandwidth != null && connection.currentUploadBandwidth == 0, "new ConnectionAttributes() should include a 'currentUploadBandwidth' property.");
- ok(typeof connection.maxDownloadBandwidth != 'undefined' && connection.maxDownloadBandwidth != null && connection.maxDownloadBandwidth == 0, "new ConnectionAttributes() should include a 'maxDownloadBandwidth' property.");
- ok(typeof connection.maxUploadBandwidth != 'undefined' && connection.maxUploadBandwidth != null && connection.maxUploadBandwidth == 0, "new ConnectionAttributes() should include a 'maxUploadBandwidth' property.");
- ok(typeof connection.currentSignalStrength != 'undefined' && connection.currentSignalStrength != null && connection.currentSignalStrength == 0.0, "new ConnectionAttributes() should include a 'currentSignalStrength' property.");
- ok(typeof connection.roaming != 'undefined' && connection.roaming != null && connection.roaming == false, "new ConnectionAttributes() should include a 'roaming' property.");
- });
- module('Sensor Property');
- test("should be able to define a Sensor Property object", function() {
- expect(5);
- var sensor = new SensorAttributes(0.0,0.0,0.0,0.0);
- ok(sensor != null, "new SensorAttributes() should not be null.");
- ok(typeof sensor.value != 'undefined' && sensor.value != null && sensor.value == 0.0, "new SensorAttributes() should include a 'value' property.");
- ok(typeof sensor.min != 'undefined' && sensor.min != null && sensor.min == 0.0, "new SensorAttributes() should include a 'min' property.");
- ok(typeof sensor.max != 'undefined' && sensor.max != null && sensor.max == 0.0, "new SensorAttributes() should include a 'max' property.");
- ok(typeof sensor.normalizedValue != 'undefined' && sensor.normalizedValue != null && sensor.normalizedValue == 0.0, "new SensorAttributes() should include a 'normalizedValue' property.");
- });
- module('AVCodecs Property');
- test("should be able to define a AVCodecs Property object", function() {
- expect(5);
- var avcodecs = new AVCodecsAttributes("a", "b", [], []);
- ok(avcodecs != null, "new AVCodecsAttributes() should not be null.");
- ok(typeof avcodecs.info != 'undefined' && avcodecs.info != null && avcodecs.info == "a", "new AVCodecsAttributes() should include a 'info' property.");
- ok(typeof avcodecs.id != 'undefined' && avcodecs.id != null && avcodecs.id == "b", "new AVCodecsAttributes() should include a 'id' property.");
- ok(typeof avcodecs.audioCodecs != 'undefined' && avcodecs.audioCodecs != null, "new AVCodecsAttributes() should include a 'audioCodecs' property.");
- ok(typeof avcodecs.videoCodecs != 'undefined' && avcodecs.videoCodecs != null, "new AVCodecsAttributes() should include a 'videoCodecs' property.");
- });
- module('Audio Codec Property');
- test("should be able to define a Audio Codec Property object", function() {
- expect(6);
- var codec = new AudioCodecAttributes("a", "b", 'a',true,true);
- ok(codec != null, "new AudioCodecAttributes() should not be null.");
- ok(typeof codec.info != 'undefined' && codec.info != null && codec.info == "a", "new AudioCodecAttributes() should include a 'info' property.");
- ok(typeof codec.id != 'undefined' && codec.id != null && codec.id == "b", "new AudioCodecAttributes() should include a 'id' property.");
- ok(typeof codec.compFormats != 'undefined' && codec.compFormats != null && codec.compFormats == 'a', "new AudioCodecAttributes() should include a 'compFormats' property.");
- ok(typeof codec.encode != 'undefined' && codec.encode != null && codec.encode == true, "new AudioCodecAttributes() should include a 'encode' property.");
- ok(typeof codec.decode != 'undefined' && codec.decode != null && codec.decode == true, "new AudioCodecAttributes() should include a 'decode' property.");
- });
- module('Video Codec Property');
- test("should be able to define a Video Codec Property object", function() {
- expect(9);
- var codec = new VideoCodecAttributes("a", "b", [],[],[],[],[],[]);
- ok(codec != null, "new VideoCodecAttributes() should not be null.");
- ok(typeof codec.info != 'undefined' && codec.info != null && codec.info == "a", "new VideoCodecAttributes() should include a 'info' property.");
- ok(typeof codec.id != 'undefined' && codec.id != null && codec.id == "b", "new VideoCodecAttributes() should include a 'id' property.");
- ok(typeof codec.compFormats != 'undefined' && codec.compFormats != null, "new VideoCodecAttributes() should include a 'compFormats' property.");
- ok(typeof codec.containerFormats != 'undefined' && codec.containerFormats != null, "new VideoCodecAttributes() should include a 'containerFormats' property.");
- ok(typeof codec.hwAccel != 'undefined' && codec.hwAccel != null, "new VideoCodecAttributes() should include a 'hwAccel' property.");
- ok(typeof codec.profiles != 'undefined' && codec.profiles != null, "new VideoCodecAttributes() should include a 'profiles' property.");
- ok(typeof codec.frameTypes != 'undefined' && codec.frameTypes != null, "new VideoCodecAttributes() should include a 'frameTypes' property.");
- ok(typeof codec.rateTypes != 'undefined' && codec.rateTypes != null, "new VideoCodecAttributes() should include a 'rateTypes' property.");
- });
- module('Storage Unit Property');
- test("should be able to define a Storage Property object", function() {
- expect(8);
- var storage = new StorageUnitAttributes('a','b',0,true,0,0,true);
- ok(storage != null, "new StorageUnitAttributes() should not be null.");
- ok(typeof storage.info != 'undefined' && storage.info != null && storage.info == "a", "new StorageUnitAttributes() should include a 'info' property.");
- ok(typeof storage.id != 'undefined' && storage.id != null && storage.id == "b", "new StorageUnitAttributes() should include a 'id' property.");
- ok(typeof storage.type != 'undefined' && storage.type != null && storage.type == 0, "new StorageUnitAttributes() should include a 'type' property.");
- ok(typeof storage.isWritable != 'undefined' && storage.isWritable != null && storage.isWritable == true, "new StorageUnitAttributes() should include a 'isWritable' property.");
- ok(typeof storage.capacity != 'undefined' && storage.capacity != null && storage.capacity == 0, "new StorageUnitAttributes() should include a 'capacity' property.");
- ok(typeof storage.availableCapacity != 'undefined' && storage.availableCapacity != null && storage.availableCapacity == 0, "new StorageUnitAttributes() should include a 'availableCapacity' property.");
- ok(typeof storage.isRemoveable != 'undefined' && storage.isRemoveable != null && storage.isRemoveable == true, "new StorageUnitAttributes() should include a 'isRemoveable' property.");
- });
- module('Output Devices Property');
- test("should be able to define a Input Devices Property object", function() {
- expect(11);
- var output = new OutputDevicesAttributes('a','b',[],[],[],"a",[],"a",[],[]);
- ok(output != null, "new OutputDevicesAttributes() should not be null.");
- ok(typeof output.info != 'undefined' && output.info != null && output.info == "a", "new OutputDevicesAttributes() should include a 'info' property.");
- ok(typeof output.id != 'undefined' && output.id != null && output.id == "b", "new OutputDevicesAttributes() should include a 'id' property.");
- ok(typeof output.displayDevices != 'undefined' && output.displayDevices != null, "new OutputDevicesAttributes() should include a 'displayDevices' property.");
- ok(typeof output.activeDisplayDevices != 'undefined' && output.activeDisplayDevices != null, "new OutputDevicesAttributes() should include a 'activeDisplayDevices' property.");
- ok(typeof output.printingDevices != 'undefined' && output.printingDevices != null, "new OutputDevicesAttributes() should include a 'printingDevices' property.");
- ok(typeof output.activePrintingDevice != 'undefined' && output.activePrintingDevice != null && output.activePrintingDevice == "a", "new OutputDevicesAttributes() should include a 'activePrintingDevice' property.");
- ok(typeof output.brailleDevices != 'undefined' && output.brailleDevices != null, "new OutputDevicesAttributes() should include a 'brailleDevices' property.");
- ok(typeof output.activeBrailleDevice != 'undefined' && output.activeBrailleDevice != null && output.activeBrailleDevice == "a", "new OutputDevicesAttributes() should include a 'activeBrailleDevice' property.");
- ok(typeof output.audioDevices != 'undefined' && output.audioDevices != null, "new OutputDevicesAttributes() should include a 'audioDevices' property.");
- ok(typeof output.activeAudioDevices != 'undefined' && output.activeAudioDevices != null, "new OutputDevicesAttributes() should include a 'activeAudioDevices' property.");
- });
- module('Display Device Type Property');
- test("should be able to define a Display Device Property object", function() {
- expect(10);
- var display = new DisplayDeviceAttributes(0,0.0,0.0,true,0,0,0.0,0.0,"a");
- ok(display != null, "new DisplayDeviceAttributes() should not be null.");
- ok(typeof display.orientation != 'undefined' && display.orientation != null && display.orientation == 0, "new DisplayDeviceAttributes() should include a 'orientation' property.");
- ok(typeof display.brightness != 'undefined' && display.brightness != null && display.brightness == 0.0, "new DisplayDeviceAttributes() should include a 'brightness' property.");
- ok(typeof display.contrast != 'undefined' && display.contrast != null && display.contrast == 0.0, "new DisplayDeviceAttributes() should include a 'contrast' property.");
- ok(typeof display.blanked != 'undefined' && display.blanked != null && display.blanked == true, "new DisplayDeviceAttributes() should include a 'blanked' property.");
- ok(typeof display.dotsPerInchW != 'undefined' && display.dotsPerInchW != null && display.dotsPerInchW == 0, "new DisplayDeviceAttributes() should include a 'dotsPerInchW' property.");
- ok(typeof display.dotsPerInchH != 'undefined' && display.dotsPerInchH != null && display.dotsPerInchH == 0, "new DisplayDeviceAttributes() should include a 'dotsPerInchH' property.");
- ok(typeof display.physicalWidth != 'undefined' && display.physicalWidth != null && display.physicalWidth == 0.0, "new DisplayDeviceAttributes() should include a 'physicalWidth' property.");
- ok(typeof display.physicalHeight != 'undefined' && display.physicalHeight != null && display.physicalHeight == 0.0, "new DisplayDeviceAttributes() should include a 'physicalHeight' property.");
- ok(typeof display.info != 'undefined' && display.info != null && display.info == 'a', "new DisplayDeviceAttributes() should include a 'info' property.");
- });
- module('Audio Device Type Property');
- test("should be able to define a Audio Device Property object", function() {
- expect(6);
- var audio = new AudioDeviceAttributes(0,0,0,0,"a");
- ok(audio != null, "new AudioDeviceAttributes() should not be null.");
- ok(typeof audio.type != 'undefined' && audio.type != null && audio.type == 0, "new AudioDeviceAttributes() should include a 'type' property.");
- ok(typeof audio.freqRangeLow != 'undefined' && audio.freqRangeLow != null && audio.freqRangeLow == 0, "new AudioDeviceAttributes() should include a 'freqRangeLow' property.");
- ok(typeof audio.freqRangeHigh != 'undefined' && audio.freqRangeHigh != null && audio.freqRangeHigh == 0, "new AudioDeviceAttributes() should include a 'freqRangeHigh' property.");
- ok(typeof audio.volumeLevel != 'undefined' && audio.volumeLevel != null && audio.volumeLevel == 0, "new AudioDeviceAttributes() should include a 'volumeLevel' property.");
- ok(typeof audio.info != 'undefined' && audio.info != null && audio.info == "a", "new AudioDeviceAttributes() should include a 'info' property.");
- });
- module('Printing Device Type Property');
- test("should be able to define a Printing Device Property object", function() {
- expect(5);
- var printer = new PrintingDeviceAttributes(0,0,0,"a");
- ok(printer != null, "new PrintingDeviceAttributes() should not be null.");
- ok(typeof printer.type != 'undefined' && printer.type != null && printer.type == 0, "new PrintingDeviceAttributes() should include a 'type' property.");
- ok(typeof printer.resolution != 'undefined' && printer.resolution != null && printer.resolution == 0, "new PrintingDeviceAttributes() should include a 'resolution' property.");
- ok(typeof printer.color != 'undefined' && printer.color != null && printer.color == 0, "new PrintingDeviceAttributes() should include a 'color' property.");
- ok(typeof printer.info != 'undefined' && printer.info != null && printer.info == "a", "new PrintingDeviceAttributes() should include a 'info' property.");
- });
- module('Braille Device Type Property');
- test("should be able to define a Printing Device Property object", function() {
- expect(3);
- var braille = new BrailleDeviceAttributes(0,"a");
- ok(braille != null, "new BrailleDeviceAttributes() should not be null.");
- ok(typeof braille.nbCells != 'undefined' && braille.nbCells != null && braille.nbCells == 0, "new BrailleDeviceAttributes() should include a 'nbCells' property.");
- ok(typeof braille.info != 'undefined' && braille.info != null && braille.info == "a", "new BrailleDeviceAttributes() should include a 'info' property.");
- });
- module('Input Devices Property');
- test("should be able to define a Input Devices Property object", function() {
- expect(11);
- var input = new InputDevicesAttributes('a','b',[],[],[],[],[],[],[],[]);
- ok(input != null, "new InputDevicesAttributes() should not be null.");
- ok(typeof input.info != 'undefined' && input.info != null && input.info == "a", "new InputDevicesAttributes() should include a 'info' property.");
- ok(typeof input.id != 'undefined' && input.id != null && input.id == "b", "new InputDevicesAttributes() should include a 'id' property.");
- ok(typeof input.pointingDevices != 'undefined' && input.pointingDevices != null, "new InputDevicesAttributes() should include a 'pointingDevices' property.");
- ok(typeof input.activePointingDevices != 'undefined' && input.activePointingDevices != null, "new InputDevicesAttributes() should include a 'activePointingDevices' property.");
- ok(typeof input.keyboards != 'undefined' && input.keyboards != null, "new InputDevicesAttributes() should include a 'keyboards' property.");
- ok(typeof input.activeKeyboards != 'undefined' && input.activeKeyboards != null, "new InputDevicesAttributes() should include a 'activeKeyboards' property.");
- ok(typeof input.cameras != 'undefined' && input.cameras != null, "new InputDevicesAttributes() should include a 'cameras' property.");
- ok(typeof input.activeCameras != 'undefined' && input.activeCameras != null, "new InputDevicesAttributes() should include a 'activeCameras' property.");
- ok(typeof input.microphones != 'undefined' && input.microphones != null, "new InputDevicesAttributes() should include a 'microphones' property.");
- ok(typeof input.activeMicrophones != 'undefined' && input.activeMicrophones != null, "new InputDevicesAttributes() should include a 'activeMicrophones' property.");
- });
- module('Pointer Property');
- test("should be able to define a Pointer Property object", function() {
- expect(4);
- var pointer = new PointerAttributes(0,true,"a");
- ok(pointer != null, "new PointerAttributes() should not be null.");
- ok(typeof pointer.type != 'undefined' && pointer.type != null && pointer.type == 0, "new PointerAttributes() should include a 'type' property.");
- ok(typeof pointer.supportsMultiTouch != 'undefined' && pointer.supportsMultiTouch != null && pointer.supportsMultiTouch == true, "new PointerAttributes() should include a 'supportsMultiTouch' property.");
- ok(typeof pointer.info != 'undefined' && pointer.info != null && pointer.info == "a", "new PointerAttributes() should include a 'info' property.");
- });
- module('Keyboard Property');
- test("should be able to define a Keyboard Property object", function() {
- expect(4);
- var keyboard = new KeyboardAttributes(0,true,"a");
- ok(keyboard != null, "new KeyboardAttributes() should not be null.");
- ok(typeof keyboard.type != 'undefined' && keyboard.type != null && keyboard.type == 0, "new KeyboardAttributes() should include a 'type' property.");
- ok(typeof keyboard.isHardware != 'undefined' && keyboard.isHardware != null && keyboard.isHardware == true, "new KeyboardAttributes() should include a 'isHardware' property.");
- ok(typeof keyboard.info != 'undefined' && keyboard.info != null && keyboard.info == "a", "new KeyboardAttributes() should include a 'info' property.");
- });
- module('Camera Property');
- test("should be able to define a Camera Property object", function() {
- expect(5);
- var camera = new CameraAttributes(true,true,0,0.0);
- ok(camera != null, "new CameraAttributes() should not be null.");
- ok(typeof camera.supportsVideo != 'undefined' && camera.supportsVideo != null && camera.supportsVideo == true, "new CameraAttributes() should include a 'supportsVideo' property.");
- ok(typeof camera.hasFlash != 'undefined' && camera.hasFlash != null && camera.hasFlash == true, "new CameraAttributes() should include a 'hasFlash' property.");
- ok(typeof camera.sensorPixels != 'undefined' && camera.sensorPixels != null && camera.sensorPixels == 0, "new CameraAttributes() should include a 'sensorPixels' property.");
- ok(typeof camera.maxZoomFactor != 'undefined' && camera.maxZoomFactor != null && camera.maxZoomFactor == 0.0, "new CameraAttributes() should include a 'maxZoomFactor' property.");
- });
- module('Microphone Property');
- test("should be able to define a Microphone Property object", function() {
- expect(7);
- var mic = new MicrophoneAttributes(0,0,0,"a","b",[]);
- ok(mic != null, "new MicrophoneAttributes() should not be null.");
- ok(typeof mic.type != 'undefined' && mic.type != null && mic.type == 0, "new MicrophoneAttributes() should include a 'type' property.");
- ok(typeof mic.freqRangeLow != 'undefined' && mic.freqRangeLow != null && mic.freqRangeLow == 0, "new MicrophoneAttributes() should include a 'freqRangeLow' property.");
- ok(typeof mic.freqRangeHigh != 'undefined' && mic.freqRangeHigh != null && mic.freqRangeHigh == 0, "new MicrophoneAttributes() should include a 'freqRangeHigh' property.");
- ok(typeof mic.info != 'undefined' && mic.info != null && mic.info == "a", "new MicrophoneAttributes() should include a 'info' property.");
- ok(typeof mic.name != 'undefined' && mic.name != null && mic.name == "b", "new MicrophoneAttributes() should include a 'name' property.");
- ok(typeof mic.types != 'undefined' && mic.types != null, "new MicrophoneAttributes() should include a 'types' property.");
- });
-};
http://git-wip-us.apache.org/repos/asf/incubator-cordova-wp7/blob/4251cf3e/tests/MobileSpecUnitTests/www/battery/index.html
----------------------------------------------------------------------
diff --git a/tests/MobileSpecUnitTests/www/battery/index.html b/tests/MobileSpecUnitTests/www/battery/index.html
deleted file mode 100644
index 394988c..0000000
--- a/tests/MobileSpecUnitTests/www/battery/index.html
+++ /dev/null
@@ -1,96 +0,0 @@
-<!DOCTYPE html>
-<html>
- <head>
- <meta name="viewport" content="width=device-width,height=device-height,user-scalable=no,maximum-scale=1.0,initial-scale=1.0" />
- <meta http-equiv="Content-type" content="text/html; charset=utf-8"> <!-- ISO-8859-1 -->
- <title>Cordova Mobile Spec</title>
- <link rel="stylesheet" href="../master.css" type="text/css" media="screen" title="no title" charset="utf-8">
- <script type="text/javascript" charset="utf-8" src="../cordova.js"></script>
-
-
-<script type="text/javascript" charset="utf-8">
-
- var deviceReady = false;
-
- /**
- * Function called when page has finished loading.
- */
- function init() {
- document.addEventListener("deviceready", function() {
- deviceReady = true;
- console.log("Device="+device.platform+" "+device.version);
- }, false);
- window.setTimeout(function() {
- if (!deviceReady) {
- alert("Error: PhoneGap did not initialize. Demo will not run correctly.");
- }
- },1000);
- }
-
- /* Battery */
- function updateInfo(info) {
- document.getElementById('level').innerText = info.level;
- document.getElementById('isPlugged').innerText = info.isPlugged;
- if (info.level > 5) {
- document.getElementById('crit').innerText = "false";
- }
- if (info.level > 20) {
- document.getElementById('low').innerText = "false";
- }
- }
-
- function batteryLow(info) {
- document.getElementById('low').innerText = "true";
- }
-
- function batteryCritical(info) {
- document.getElementById('crit').innerText = "true";
- }
-
- function addBattery() {
- window.addEventListener("batterystatus", updateInfo, false);
- }
-
- function removeBattery() {
- window.removeEventListener("batterystatus", updateInfo, false);
- }
-
- function addLow() {
- window.addEventListener("batterylow", batteryLow, false);
- }
-
- function removeLow() {
- window.removeEventListener("batterylow", batteryLow, false);
- }
-
- function addCritical() {
- window.addEventListener("batterycritical", batteryCritical, false);
- }
-
- function removeCritical() {
- window.removeEventListener("batterycritical", batteryCritical, false);
- }
-
-</script>
-
- </head>
- <body onload="init();" id="stage" class="theme">
-
- <h1>Battery</h1>
- <div id="info">
- <b>Status:</b> <span id="battery_status"></span><br>
- Level: <span id="level"></span><br/>
- Plugged: <span id="isPlugged"></span><br/>
- Low: <span id="low"></span><br/>
- Critical: <span id="crit"></span><br/>
- </div>
- <h2>Action</h2>
- <div class="btn large" onclick="addBattery();">Add "batterystatus" listener</div>
- <div class="btn large" onclick="removeBattery();">Remove "batterystatus" listener</div>
- <div class="btn large" onclick="addLow();">Add "batterylow" listener</div>
- <div class="btn large" onclick="removeLow();">Remove "batterylow" listener</div>
- <div class="btn large" onclick="addCritical();">Add "batterycritical" listener</div>
- <div class="btn large" onclick="removeCritical();">Remove "batterycritical" listener</div>
- <h2> </h2><div class="backBtn" onclick="backHome();">Back</div>
- </body>
-</html>
http://git-wip-us.apache.org/repos/asf/incubator-cordova-wp7/blob/4251cf3e/tests/MobileSpecUnitTests/www/camera/index.html
----------------------------------------------------------------------
diff --git a/tests/MobileSpecUnitTests/www/camera/index.html b/tests/MobileSpecUnitTests/www/camera/index.html
deleted file mode 100644
index bc3b554..0000000
--- a/tests/MobileSpecUnitTests/www/camera/index.html
+++ /dev/null
@@ -1,96 +0,0 @@
-<!DOCTYPE html>
-<html>
- <head>
- <meta name="viewport" content="width=device-width,height=device-height,user-scalable=no,maximum-scale=1.0,initial-scale=1.0" />
- <meta http-equiv="Content-type" content="text/html; charset=utf-8"> <!-- ISO-8859-1 -->
- <title>Cordova Mobile Spec</title>
- <link rel="stylesheet" href="../master.css" type="text/css" media="screen" title="no title" charset="utf-8">
- <script type="text/javascript" charset="utf-8" src="../cordova.js"></script>
-
-
-<script type="text/javascript" charset="utf-8">
-
- var deviceReady = false;
-
- //-------------------------------------------------------------------------
- // Camera
- //-------------------------------------------------------------------------
-
- /**
- * Capture picture
- */
- function getPicture() {
-
- //navigator.camera.getPicture(onPhotoDataSuccess, onFail, { quality: 50,
- // destinationType: Camera.DestinationType.FILE_URI, sourceType : Camera.PictureSourceType.CAMERA });
-
- navigator.camera.getPicture(
- function(data) {
- var img = document.getElementById('camera_image');
- img.style.visibility = "visible";
- img.style.display = "block";
- //img.src = "data:image/jpeg;base64," + data;
- img.src = data;
- document.getElementById('camera_status').innerHTML = "Success";
- },
- function(e) {
- console.log("Error getting picture: " + e);
- document.getElementById('camera_status').innerHTML = "Error getting picture.";
- },
- { quality: 50, destinationType:
- Camera.DestinationType.FILE_URI, sourceType : Camera.PictureSourceType.CAMERA});
- };
-
- /**
- * Select image from library
- */
- function getImage() {
- navigator.camera.getPicture(
- function(data) {
- var img = document.getElementById('camera_image');
- img.style.visibility = "visible";
- img.style.display = "block";
- //img.src = "data:image/jpeg;base64," + data;
- img.src = data;
- document.getElementById('camera_status').innerHTML = "Success";
- },
- function(e) {
- console.log("Error getting picture: " + e);
- document.getElementById('camera_status').innerHTML = "Error getting picture.";
- },
- { quality: 50, destinationType:
- Camera.DestinationType.FILE_URI, sourceType: Camera.PictureSourceType.PHOTOLIBRARY});
- };
-
-
- /**
- * Function called when page has finished loading.
- */
- function init() {
- document.addEventListener("deviceready", function() {
- deviceReady = true;
- console.log("Device="+device.platform+" "+device.version);
- }, false);
- window.setTimeout(function() {
- if (!deviceReady) {
- alert("Error: PhoneGap did not initialize. Demo will not run correctly.");
- }
- },1000);
- }
-
-</script>
-
- </head>
- <body onload="init();" id="stage" class="theme">
-
- <h1>Camera</h1>
- <div id="info">
- <b>Status:</b> <span id="camera_status"></span><br>
- <img style="width:120px;height:120px;visibility:hidden;display:none;" id="camera_image" src="" />
- </div>
- <h2>Action</h2>
- <div class="btn large" onclick="getPicture();">Take Picture</div>
- <div class="btn large" onclick="getImage();">Select Image from Library</div>
- <h2> </h2><div class="backBtn" onclick="backHome();">Back</div>
- </body>
-</html>
http://git-wip-us.apache.org/repos/asf/incubator-cordova-wp7/blob/4251cf3e/tests/MobileSpecUnitTests/www/compass/index.html
----------------------------------------------------------------------
diff --git a/tests/MobileSpecUnitTests/www/compass/index.html b/tests/MobileSpecUnitTests/www/compass/index.html
deleted file mode 100644
index 8dbf99a..0000000
--- a/tests/MobileSpecUnitTests/www/compass/index.html
+++ /dev/null
@@ -1,128 +0,0 @@
-<!DOCTYPE html>
-<html>
- <head>
- <meta name="viewport" content="width=device-width,height=device-height,user-scalable=no,maximum-scale=1.0,initial-scale=1.0" />
- <meta http-equiv="Content-type" content="text/html; charset=utf-8"> <!-- ISO-8859-1 -->
- <title>Cordova Mobile Spec</title>
- <link rel="stylesheet" href="../master.css" type="text/css" media="screen" title="no title" charset="utf-8">
- <script type="text/javascript" charset="utf-8" src="../cordova.js"></script>
-
-
-<script type="text/javascript" charset="utf-8">
-
- var deviceReady = false;
-
- function roundNumber(num) {
- var dec = 3;
- var result = Math.round(num*Math.pow(10,dec))/Math.pow(10,dec);
- return result;
- }
-
- //-------------------------------------------------------------------------
- // Compass
- //-------------------------------------------------------------------------
- var watchCompassId = null;
-
- /**
- * Start watching compass
- */
- var watchCompass = function() {
- console.log("watchCompass()");
-
- // Success callback
- var success = function(a){
- document.getElementById('compassHeading').innerHTML = roundNumber(a.magneticHeading);
- };
-
- // Fail callback
- var fail = function(e){
- console.log("watchCompass fail callback with error code "+e);
- stopCompass();
- setCompassStatus(e);
- };
-
- // Update heading every 1 sec
- var opt = {};
- opt.frequency = 1000;
- watchCompassId = navigator.compass.watchHeading(success, fail, opt);
-
- setCompassStatus("Running");
- };
-
- /**
- * Stop watching the acceleration
- */
- var stopCompass = function() {
- setCompassStatus("Stopped");
- if (watchCompassId) {
- navigator.compass.clearWatch(watchCompassId);
- watchCompassId = null;
- }
- };
-
- /**
- * Get current compass
- */
- var getCompass = function() {
- console.log("getCompass()");
-
- // Stop compass if running
- stopCompass();
-
- // Success callback
- var success = function(a){
- document.getElementById('compassHeading').innerHTML = roundNumber(a.magneticHeading);
- };
-
- // Fail callback
- var fail = function(e){
- console.log("getCompass fail callback with error code "+e);
- setCompassStatus(e);
- };
-
- // Make call
- var opt = {};
- navigator.compass.getCurrentHeading(success, fail, opt);
- };
-
- /**
- * Set compass status
- */
- var setCompassStatus = function(status) {
- document.getElementById('compass_status').innerHTML = status;
- };
-
- /**
- * Function called when page has finished loading.
- */
- function init() {
- document.addEventListener("deviceready", function() {
- deviceReady = true;
- console.log("Device="+device.platform+" "+device.version);
- }, false);
- window.setTimeout(function() {
- if (!deviceReady) {
- alert("Error: PhoneGap did not initialize. Demo will not run correctly.");
- }
- },1000);
- }
-
-</script>
-
- </head>
- <body onload="init();" id="stage" class="theme">
-
- <h1>Compass</h1>
- <div id="info">
- <b>Status:</b> <span id="compass_status">Stopped</span>
- <table width="100%"><tr>
- <td width="33%">Heading: <span id="compassHeading"> </span></td>
- </tr></table>
- </div>
- <h2>Action</h2>
- <div class="btn large" onclick="getCompass();">Get Compass</div>
- <div class="btn large" onclick="watchCompass();">Start Watching Compass</div>
- <div class="btn large" onclick="stopCompass();">Stop Watching Compass</div>
- <h2> </h2><div class="backBtn" onclick="backHome();">Back</div>
- </body>
-</html>
http://git-wip-us.apache.org/repos/asf/incubator-cordova-wp7/blob/4251cf3e/tests/MobileSpecUnitTests/www/contacts/index.html
----------------------------------------------------------------------
diff --git a/tests/MobileSpecUnitTests/www/contacts/index.html b/tests/MobileSpecUnitTests/www/contacts/index.html
deleted file mode 100644
index 950e1cc..0000000
--- a/tests/MobileSpecUnitTests/www/contacts/index.html
+++ /dev/null
@@ -1,112 +0,0 @@
-<!DOCTYPE html>
-<html>
- <head>
- <meta name="viewport" content="width=device-width,height=device-height,user-scalable=no,maximum-scale=1.0,initial-scale=1.0" />
- <meta http-equiv="Content-type" content="text/html; charset=utf-8"> <!-- ISO-8859-1 -->
- <title>Cordova Mobile Spec</title>
- <link rel="stylesheet" href="../master.css" type="text/css" media="screen" title="no title" charset="utf-8">
- <script type="text/javascript" charset="utf-8" src="../cordova.js"></script>
-
-
-<script type="text/javascript" charset="utf-8">
-
- var deviceReady = false;
-
- //-------------------------------------------------------------------------
- // Contacts
- //-------------------------------------------------------------------------
- function getContacts() {
- obj = new ContactFindOptions();
- obj.filter = "D"; //Brooks";
- obj.multiple = true;
- navigator.contacts.find(
- ["displayName", "name", "phoneNumbers", "emails", "urls", "note"],
- function(contacts) {
- var s = "";
- if (contacts.length == 0) {
- s = "No contacts found";
- }
- else {
- s = "Number of contacts: "+contacts.length+"<br><table width='100%'><tr><th>Name</th><td>Phone</td><td>Email</td></tr>";
- for (var i=0; i<contacts.length; i++) {
- var contact = contacts[i];
- s = s + "<tr><td>" + contact.name.formatted + "</td><td>";
- if (contact.phoneNumbers && contact.phoneNumbers.length > 0) {
- s = s + contact.phoneNumbers[0].value;
- }
- s = s + "</td><td>"
- if (contact.emails && contact.emails.length > 0) {
- s = s + contact.emails[0].value;
- }
- s = s + "</td></tr>";
- }
- s = s + "</table>";
- }
- document.getElementById('contacts_results').innerHTML = s;
- },
- function(e) {
- document.getElementById('contacts_results').innerHTML = "Error: "+e.code;
- },
- obj);
- };
-
- function addContact(){
- console.log("addContact()");
- try{
- var contact = navigator.contacts.create({"displayName": "Dooney Evans"});
- var contactName = {
- formatted: "Dooney Evans",
- familyName: "Evans",
- givenName: "Dooney",
- middleName: ""
- };
-
- contact.name = contactName;
-
- var phoneNumbers = [1];
- phoneNumbers[0] = new ContactField('work', '512-555-1234', true);
- contact.phoneNumbers = phoneNumbers;
-
- contact.save(
- function() { alert("Contact saved.");},
- function(e) { alert("Contact save failed: " + e.code); }
- );
- console.log("you have saved the contact");
- }
- catch (e){
- alert(e);
- }
-
- };
-
- /**
- * Function called when page has finished loading.
- */
- function init() {
- document.addEventListener("deviceready", function() {
- deviceReady = true;
- console.log("Device="+device.platform+" "+device.version);
- }, false);
- window.setTimeout(function() {
- if (!deviceReady) {
- alert("Error: PhoneGap did not initialize. Demo will not run correctly.");
- }
- },1000);
- }
-
-</script>
-
- </head>
- <body onload="init();" id="stage" class="theme">
-
- <h1>Contacts</h1>
- <div id="info">
- <b>Results:</b><br>
- <span id="contacts_results"> </span>
- </div>
- <h2>Action</h2>
- <div class="btn large" onclick="getContacts();">Get phone's contacts</div>
- <div class="btn large" onclick="addContact();">Add a new contact 'Dooney Evans'</div>
- <h2> </h2><div class="backBtn" onclick="backHome();">Back</div>
- </body>
-</html>
http://git-wip-us.apache.org/repos/asf/incubator-cordova-wp7/blob/4251cf3e/tests/MobileSpecUnitTests/www/cordova.js
----------------------------------------------------------------------
diff --git a/tests/MobileSpecUnitTests/www/cordova.js b/tests/MobileSpecUnitTests/www/cordova.js
deleted file mode 100644
index 044a06b..0000000
--- a/tests/MobileSpecUnitTests/www/cordova.js
+++ /dev/null
@@ -1,13 +0,0 @@
-document.write('<script type="text/javascript" charset="utf-8" src="../../cordova.wp7.js"></script>');
-document.write('<script type="text/javascript" charset="utf-8" src="../cordova.wp7.js"></script>');
-document.write('<script type="text/javascript" charset="utf-8" src="cordova.wp7.js"></script>');
-
-function backHome() {
-
- if (window.device && device.platform && device.platform.toLowerCase() == 'android') {
- navigator.app.backHistory();
- }
- else {
- window.history.go(-1);
- }
-}