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/09/11 01:57:44 UTC
[47/52] [abbrv] [partial] re-org
http://git-wip-us.apache.org/repos/asf/incubator-cordova-windows/blob/03bf0cde/src/cordova-win8/test/tests/filetransfer.tests.js
----------------------------------------------------------------------
diff --git a/src/cordova-win8/test/tests/filetransfer.tests.js b/src/cordova-win8/test/tests/filetransfer.tests.js
deleted file mode 100644
index b231dc3..0000000
--- a/src/cordova-win8/test/tests/filetransfer.tests.js
+++ /dev/null
@@ -1,72 +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://github.com/ajaxorg/cloud9/blob/master/server.js";
- var localFileName = remoteFile.substring(remoteFile.lastIndexOf('/')+1);
- var downloadWin = jasmine.createSpy().andCallFake(function(entry) {
- expect(entry.name).toBe(localFileName);
- });
- var fileWin = function(fileEntry) {
- var ft = new FileTransfer();
- ft.download(remoteFile, fileEntry.fullPath, downloadWin);
- };
-
- // 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();
- });
- });
- });
- describe('upload method', function () {
- it("should be able to upload a file", function () {
- var fail = jasmine.createSpy();
- var localFileName = "server.js";
- var localFile = root.fullPath + "\\" + localFileName;
- var Url = "http://localhost:5000/upload";
- var uploadWin = jasmine.createSpy().andCallFake(function (entry) {
- expect(entry.responseCode).toBe(200);
- });
- var fileWin = function (fileEntry) {
- console.log("1========");
- var ft = new FileTransfer();
- ft.upload(localFile, Url, uploadWin,fail,null);
- };
-
- // root is defined in the html page containing these tests
- runs(function () {
- root.getFile(localFileName, { create: false }, fileWin, fail);
- });
-
- waitsFor(function () { return uploadWin.wasCalled; }, "uploadWin", Tests.TEST_TIMEOUT);
-
- runs(function () {
- expect(uploadWin).toHaveBeenCalled();
- expect(fail).not.toHaveBeenCalled();
- });
- });
- });
-});
http://git-wip-us.apache.org/repos/asf/incubator-cordova-windows/blob/03bf0cde/src/cordova-win8/test/tests/geolocation.tests.js
----------------------------------------------------------------------
diff --git a/src/cordova-win8/test/tests/geolocation.tests.js b/src/cordova-win8/test/tests/geolocation.tests.js
deleted file mode 100644
index 71e0c2e..0000000
--- a/src/cordova-win8/test/tests/geolocation.tests.js
+++ /dev/null
@@ -1,106 +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(a.coords).not.toBe(null);
- expect(a.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) {
- if (a instanceof Position) {
- expect(a instanceof Position).toBe(true);
- } else {
- expect(a.toString() === '[object 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?
- // You could close your geolocation capability and expect the error code to be 3.(already tested in Win8 Implementation)
- // 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-windows/blob/03bf0cde/src/cordova-win8/test/tests/media.tests.js
----------------------------------------------------------------------
diff --git a/src/cordova-win8/test/tests/media.tests.js b/src/cordova-win8/test/tests/media.tests.js
deleted file mode 100644
index 1154493..0000000
--- a/src/cordova-win8/test/tests/media.tests.js
+++ /dev/null
@@ -1,137 +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 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-windows/blob/03bf0cde/src/cordova-win8/test/tests/network.tests.js
----------------------------------------------------------------------
diff --git a/src/cordova-win8/test/tests/network.tests.js b/src/cordova-win8/test/tests/network.tests.js
deleted file mode 100644
index 780097f..0000000
--- a/src/cordova-win8/test/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-windows/blob/03bf0cde/src/cordova-win8/test/tests/notification.tests.js
----------------------------------------------------------------------
diff --git a/src/cordova-win8/test/tests/notification.tests.js b/src/cordova-win8/test/tests/notification.tests.js
deleted file mode 100644
index 61c795d..0000000
--- a/src/cordova-win8/test/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-windows/blob/03bf0cde/src/cordova-win8/test/tests/platform.tests.js
----------------------------------------------------------------------
diff --git a/src/cordova-win8/test/tests/platform.tests.js b/src/cordova-win8/test/tests/platform.tests.js
deleted file mode 100644
index cf05356..0000000
--- a/src/cordova-win8/test/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-windows/blob/03bf0cde/src/cordova-win8/test/tests/storage.tests.js
----------------------------------------------------------------------
diff --git a/src/cordova-win8/test/tests/storage.tests.js b/src/cordova-win8/test/tests/storage.tests.js
deleted file mode 100644
index 72ef3a4..0000000
--- a/src/cordova-win8/test/tests/storage.tests.js
+++ /dev/null
@@ -1,405 +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");
- //console.log("============" + window.localStorage.key(0));
- 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();
- });
-
- it("should retrieve a correct database object", function () {
- var db = openDatabase("Database", "1.0", "HTML5 Database API example", 200000);
- expect(db).toBeDefined();
- expect(typeof (db.transaction)).toBe('function');
- //expect(typeof (db.changeVersion)).toBe('function');
- });
-
- it("Should insert data and return SQLResultSet objects", function () {
- function populateDB(tx) {
- tx.executeSql('CREATE TABLE Item (name TEXT, price REAL, id INT PRIMARY KEY)');
- tx.executeSql('INSERT INTO Item (name, price, id) VALUES (?, ?, ?)', ['Apple', 1.2, 1]);
- tx.executeSql('INSERT INTO Item (name, price, id) VALUES (?, ?, ?)', ['Orange', 2.5, 2]);
- tx.executeSql('INSERT INTO Item (name, price, id) VALUES (?, ?, ?)', ['Banana', 3, 3]);
- tx.executeSql('SELECT * FROM Item', null, successCB, errorCB);
- tx.executeSql('DROP TABLE Item');
- }
-
- var errorCB = jasmine.createSpy().andCallFake(function (error) {
- console.log("error callBack , error code:" + error.code);
-
- });
- var successCB = jasmine.createSpy().andCallFake(function (tx, results) {
- expect(tx).toBeDefined();
- expect(results).toBeDefined();
- expect(results.rows.item(0).id).toBe(1);
- expect(results.rows.item(1).id).toBe(2);
- expect(results.rows.item(2).id).toBe(3);
- });
- runs(function () {
- var db = openDatabase("Database", "1.0", "HTML5 Database API example", 200000);
- db.transaction(populateDB, errorCB);
- });
-
- waitsFor(function () { return successCB.wasCalled; }, "Insert callback never called", Tests.TEST_TIMEOUT);
-
- runs(function () {
- expect(successCB).toHaveBeenCalled();
- expect(errorCB).not.toHaveBeenCalled();
- });
- });
-
- it('should return the correct count', function () {
-
- function populateDB(tx) {
- tx.executeSql('CREATE TABLE Item (name TEXT, price REAL, id INT PRIMARY KEY)');
- tx.executeSql('INSERT INTO Item (name, price, id) VALUES (?, ?, ?)', ['Apple', 1.2, 1]);
- tx.executeSql('INSERT INTO Item (name, price, id) VALUES (?, ?, ?)', ['Orange', 2.5, 2]);
- tx.executeSql('INSERT INTO Item (name, price, id) VALUES (?, ?, ?)', ['Banana', 3, 3]);
- tx.executeSql('SELECT COUNT(*) AS count FROM Item', null, successCB, errorCB);
- tx.executeSql('DROP TABLE Item');
- }
- var errorCB = jasmine.createSpy().andCallFake(function (error) {
- console.log("error callBack , error code:" + error.code);
-
- });
- var successCB = jasmine.createSpy().andCallFake(function (tx, results) {
- expect(tx).toBeDefined();
- expect(results).toBeDefined();
- expect(results.rows.item(0).count).toEqual(3);
- });
- runs(function () {
- var db = openDatabase("Database", "1.0", "HTML5 Database API example", 200000);
- db.transaction(populateDB, errorCB);
- });
-
- waitsFor(function () { return successCB.wasCalled; }, "Insert callback never called", Tests.TEST_TIMEOUT);
-
- runs(function () {
- expect(successCB).toHaveBeenCalled();
- expect(errorCB).not.toHaveBeenCalled();
- });
-
- });
-
- it('should return an item by id', function () {
- function populateDB(tx) {
- tx.executeSql('CREATE TABLE Item (name TEXT, price REAL, id INT PRIMARY KEY)');
- tx.executeSql('INSERT INTO Item (name, price, id) VALUES (?, ?, ?)', ['Apple', 1.2, 1]);
- tx.executeSql('INSERT INTO Item (name, price, id) VALUES (?, ?, ?)', ['Orange', 2.5, 2]);
- tx.executeSql('INSERT INTO Item (name, price, id) VALUES (?, ?, ?)', ['Banana', 3, 3]);
- tx.executeSql('SELECT * FROM Item WHERE id = ?', [2], successCB, errorCB);
- tx.executeSql('DROP TABLE Item');
- }
- var errorCB = jasmine.createSpy().andCallFake(function (error) {
- console.log("error callBack , error code:" + error.code);
-
- });
- var successCB = jasmine.createSpy().andCallFake(function (tx, results) {
- expect(tx).toBeDefined();
- expect(results).toBeDefined();
- expect(results.rows.length).toEqual(1);
- expect(results.rows.item(0).name).toEqual('Orange');
- expect(results.rows.item(0).price).toEqual(2.5);
- expect(results.rows.item(0).id).toEqual(2);
- });
- runs(function () {
- var db = openDatabase("Database", "1.0", "HTML5 Database API example", 200000);
- db.transaction(populateDB, errorCB);
- });
-
- waitsFor(function () { return successCB.wasCalled; }, "Insert callback never called", Tests.TEST_TIMEOUT);
-
- runs(function () {
- expect(successCB).toHaveBeenCalled();
- expect(errorCB).not.toHaveBeenCalled();
- });
- });
-
-
- it('should return items with names ending on "e"', function () {
- function populateDB(tx) {
- tx.executeSql('CREATE TABLE Item (name TEXT, price REAL, id INT PRIMARY KEY)');
- tx.executeSql('INSERT INTO Item (name, price, id) VALUES (?, ?, ?)', ['Apple', 1.2, 1]);
- tx.executeSql('INSERT INTO Item (name, price, id) VALUES (?, ?, ?)', ['Orange', 2.5, 2]);
- tx.executeSql('INSERT INTO Item (name, price, id) VALUES (?, ?, ?)', ['Banana', 3, 3]);
- tx.executeSql('SELECT * FROM Item WHERE name LIKE ? ORDER BY id ASC', ['%e'], successCB, errorCB);
- tx.executeSql('DROP TABLE Item');
- }
- var errorCB = jasmine.createSpy().andCallFake(function (error) {
- console.log("error callBack , error code:" + error.code);
-
- });
- var successCB = jasmine.createSpy().andCallFake(function (tx, results) {
- expect(tx).toBeDefined();
- expect(results).toBeDefined();
- expect(results.rows.length).toEqual(2);
- expect(results.rows.item(0).name).toEqual('Apple');
- expect(results.rows.item(1).name).toEqual('Orange');
- expect(results.rows.item(0).id).toEqual(1);
- });
- runs(function () {
- var db = openDatabase("Database", "1.0", "HTML5 Database API example", 200000);
- db.transaction(populateDB, errorCB);
- });
-
- waitsFor(function () { return successCB.wasCalled; }, "Insert callback never called", Tests.TEST_TIMEOUT);
-
- runs(function () {
- expect(successCB).toHaveBeenCalled();
- expect(errorCB).not.toHaveBeenCalled();
- });
-
- });
-
- it('should allow binding null arguments', function () {
- var name = 'Mango';
- function populateDB(tx) {
- tx.executeSql('CREATE TABLE Item (name TEXT, price REAL, id INT PRIMARY KEY)');
- tx.executeSql('INSERT INTO Item (name, price, id) VALUES (?, ?, ?)', [name, null, null]);
- tx.executeSql('SELECT * FROM Item WHERE name = ?', [name], successCB, errorCB);
- tx.executeSql('DROP TABLE Item');
- }
- var errorCB = jasmine.createSpy().andCallFake(function (error) {
- console.log("error callBack , error code:" + error.code);
-
- });
- var successCB = jasmine.createSpy().andCallFake(function (tx, results) {
- expect(tx).toBeDefined();
- expect(results).toBeDefined();
- expect(results.rows.length).toEqual(1);
- expect(results.rows.item(0).name).toEqual(name);
- expect(results.rows.item(0).price).toEqual(null);
- expect(results.rows.item(0).id).toEqual(null);
- });
- runs(function () {
- var db = openDatabase("Database", "1.0", "HTML5 Database API example", 200000);
- db.transaction(populateDB, errorCB);
- });
-
- waitsFor(function () { return successCB.wasCalled; }, "Insert callback never called", Tests.TEST_TIMEOUT);
-
- runs(function () {
- expect(successCB).toHaveBeenCalled();
- expect(errorCB).not.toHaveBeenCalled();
- });
-
- });
-
- it("should error about invalid syntax", function () {
- function populateDB(tx) {
- tx.executeSql('CREATE TABLE11 Item (name TEXT, price REAL, id INT PRIMARY KEY)' , null , successCB , errorCB);
- }
- var successCB = jasmine.createSpy().andCallFake(function (tx, results) {
- expect(tx).toBeDefined();
- expect(results).toBeDefined();
-
- });
-
- var errorCB = jasmine.createSpy().andCallFake(function (error) {
- expect(error).toBeDefined();
- expect(error.code).toBe(5);
- });
-
- runs(function () {
- var db = openDatabase("Database", "1.0", "HTML5 Database API example", 200000);
- db.transaction(populateDB, errorCB);
- });
- waitsFor(function () { return errorCB.wasCalled; }, "error callback never called", Tests.TEST_TIMEOUT);
-
- runs(function () {
- expect(errorCB).toHaveBeenCalled();
- expect(successCB).not.toHaveBeenCalled();
- });
- });
-
-
- it("should error about invalid params", function () {
- function populateDB(tx) {
- tx.executeSql('CREATE TABLE Item (name TEXT, price REAL, id INT PRIMARY KEY)');
- tx.executeSql('INSERT INTO Item (name, price, id) VALUES (?, ?, ?)', ['Apple', 1.2, 1]);
- tx.executeSql('INSERT INTO Item (name, price, id) VALUES (?, ?, ?)', ['Orange', 2.5, 1] , successCB , errorCB);
- tx.executeSql('DROP TABLE Item');
- }
- var successCB = jasmine.createSpy().andCallFake(function (tx, results) {
- expect(tx).toBeDefined();
- expect(results).toBeDefined();
-
- });
-
- var errorCB = jasmine.createSpy().andCallFake(function (error) {
- expect(error).toBeDefined();
- expect(error.code).toBe(5);
- });
- runs(function () {
- var db = openDatabase("Database", "1.0", "HTML5 Database API example", 200000);
- db.transaction(populateDB , errorCB);
- });
-
- waitsFor(function () { return errorCB.wasCalled; }, "error callback never called", Tests.TEST_TIMEOUT);
-
- runs(function () {
- expect(errorCB).toHaveBeenCalled();
- expect(successCB).not.toHaveBeenCalled();
- });
- });
- it('should return null when creating an invalid name', function () {
- var db = openDatabase("invalid::name", "1.0", "HTML5 Database API example", 200000);
- expect(db).toBe(null);
-
- });
- });
-});
http://git-wip-us.apache.org/repos/asf/incubator-cordova-windows/blob/03bf0cde/src/cordova-win8/test/uploadTestServer.js
----------------------------------------------------------------------
diff --git a/src/cordova-win8/test/uploadTestServer.js b/src/cordova-win8/test/uploadTestServer.js
deleted file mode 100644
index 41c0776..0000000
--- a/src/cordova-win8/test/uploadTestServer.js
+++ /dev/null
@@ -1,143 +0,0 @@
-var connect = require('connect');
-var url = require('url');
-var fs = require('fs');
-
-var app = connect()
- .use(connect.logger('dev'))
- //.use(connect.static('C:\Application1\Application1'))
- .use(connect.bodyParser())
- .use(function(req, res){
-
- //TODO something what can listen to the behavior of the click of the button "export"
- var pathname = url.parse(req.url).pathname;
-
- if( pathname === "/upload" ){
-
- fs.readFile(req.files["source"].path, function (err, data) {
- console.log(data);
- fs.writeFile('\\\\vmware-host\\Shared Folders\\Documents\\per\\message.js', data, function (err) {
- if (err) throw err;
-
- console.log('It\'s saved!');
- res.end("ok");
-
-
- });
-
- });
-
- //console.log('POST to cloud9');
- //var item = [{name:'file',value:req.files['file'].path,isFile:true,fileEncoding:'binary'}];
- //doHttpPost('localhost',8080,'/GUI',item);
-
- }
-
-
- })
- .listen(5000);
-
-
-function doHttpPost(_host, _port, _path, items) {
- var http = require('http'),
- fs = require('fs'),
- path = require('path'),
- boundary = Math.random(),
- postData = [];
-
- formDataAndPost(items);
-
- function formDataAndPost(items){
- var item = items.shift();
- if (!item) {
- if (postData.length > 0) {
- postData.push(new Buffer("--" + boundary + "--", 'ascii'));
- post(_host, _port, _path, postData, boundary);
- }
- return;
- }
-
- if (item.isFile) {
- var fileName = path.basename(item.value),
- encoding = item.fileEncoding?item.fileEncoding:'binary',
- fileContents = '',
- fileReader;
-
- postData.push(new Buffer(EncodeFilePart(boundary, 'application/octet-stream', item.name, fileName), 'ascii'));
- fileReader = fs.createReadStream(item.value, {'encoding': encoding});
- fileReader.on('data', function(data) {
- fileContents += data;
- });
- fileReader.on('end', function() {
- postData.push(new Buffer(fileContents, encoding));
- postData.push(new Buffer("\r\n", 'ascii'));
- formDataAndPost(items);
- });
- }
- else {
- postData.push(new Buffer(EncodeFieldPart(boundary, item.name, item.value), 'ascii'));
- formDataAndPost(items);
- }
- };
-
- function post(p_host, p_port, p_path, p_data, p_boundary) {
- var dataLength = 0,
- postOptions, postRequest;
-
- // Calculate data length
- for(var i = 0; i < p_data.length; i++) {
- dataLength += p_data[i].length;
- }
-
- postOptions = {
- 'host': p_host,
- 'port': p_port,
- 'path': p_path,
- 'method': 'POST',
- 'headers' : {
- 'Content-Type' : 'multipart/form-data; boundary=' + p_boundary,
- 'Content-Length' : dataLength
- }
- };
-
- postRequest = http.request(postOptions, function(response){
- console.log('STATUS: ' + response.statusCode);
- console.log('HEADERS: ' + JSON.stringify(response.headers));
- response.setEncoding('utf8');
- response.on('data', function(chunk) {
- // Respond to http response
- console.log(chunk);
- });
- response.on('end', function() {
- // Respond to http response
- console.log('Response end');
- });
- });
- postRequest.on('error', function (e) {
- // Deal with http request error
- console.log('\u001b[31m');
- console.log('*****ERROR***** http request to ' + p_host + ':' + p_port + p_path);
- console.log('*****ERROR***** message: ' + e.message);
- console.log('\u001b[0m');
- });
-
- for (var i = 0; i < p_data.length; i++) {
- postRequest.write(p_data[i]);
- }
- postRequest.end();
- }
-
- function EncodeFieldPart(boundary,name,value) {
- var return_part = "--" + boundary + "\r\n";
- return_part += "Content-Disposition: form-data; name=\"" + name + "\"\r\n\r\n";
- return_part += value + "\r\n";
- return return_part;
- }
-
- function EncodeFilePart(boundary,type,name,filename) {
- var return_part = "--" + boundary + "\r\n";
- return_part += "Content-Disposition: form-data; name=\"" + name + "\"; filename=\"" + filename + "\"\r\n";
- return_part += "Content-Type: " + type + "\r\n\r\n";
- return return_part;
- }
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-cordova-windows/blob/03bf0cde/src/cordova-win8/test/views/HtmlReporter.js
----------------------------------------------------------------------
diff --git a/src/cordova-win8/test/views/HtmlReporter.js b/src/cordova-win8/test/views/HtmlReporter.js
deleted file mode 100644
index 7d9d924..0000000
--- a/src/cordova-win8/test/views/HtmlReporter.js
+++ /dev/null
@@ -1,101 +0,0 @@
-jasmine.HtmlReporter = function(_doc) {
- var self = this;
- var doc = _doc || window.document;
-
- var reporterView;
-
- var dom = {};
-
- // Jasmine Reporter Public Interface
- self.logRunningSpecs = false;
-
- self.reportRunnerStarting = function(runner) {
- var specs = runner.specs() || [];
-
- if (specs.length == 0) {
- return;
- }
-
- createReporterDom(runner.env.versionString());
- doc.body.appendChild(dom.reporter);
-
- reporterView = new jasmine.HtmlReporter.ReporterView(dom);
- reporterView.addSpecs(specs, self.specFilter);
- };
-
- self.reportRunnerResults = function(runner) {
- reporterView && reporterView.complete();
- };
-
- self.reportSuiteResults = function(suite) {
- reporterView.suiteComplete(suite);
- };
-
- self.reportSpecStarting = function(spec) {
- if (self.logRunningSpecs) {
- self.log('>> Jasmine Running ' + spec.suite.description + ' ' + spec.description + '...');
- }
- };
-
- self.reportSpecResults = function(spec) {
- reporterView.specComplete(spec);
- };
-
- self.log = function() {
- var console = jasmine.getGlobal().console;
- if (console && console.log) {
- if (console.log.apply) {
- console.log.apply(console, arguments);
- } else {
- console.log(arguments); // ie fix: console.log.apply doesn't exist on ie
- }
- }
- };
-
- self.specFilter = function(spec) {
- if (!focusedSpecName()) {
- return true;
- }
-
- return spec.getFullName().indexOf(focusedSpecName()) === 0;
- };
-
- return self;
-
- function focusedSpecName() {
- var specName;
-
- (function memoizeFocusedSpec() {
- if (specName) {
- return;
- }
-
- var paramMap = [];
- var params = doc.location.search.substring(1).split('&');
-
- for (var i = 0; i < params.length; i++) {
- var p = params[i].split('=');
- paramMap[decodeURIComponent(p[0])] = decodeURIComponent(p[1]);
- }
-
- specName = paramMap.spec;
- })();
-
- return specName;
- }
-
- function createReporterDom(version) {
- dom.reporter = self.createDom('div', { id: 'HTMLReporter', className: 'jasmine_reporter' },
- dom.banner = self.createDom('div', { className: 'banner' },
- self.createDom('span', { className: 'title' }, "Jasmine "),
- self.createDom('span', { className: 'version' }, version)),
-
- dom.symbolSummary = self.createDom('ul', {className: 'symbolSummary'}),
- dom.alert = self.createDom('div', {className: 'alert'}),
- dom.results = self.createDom('div', {className: 'results'},
- dom.summary = self.createDom('div', { className: 'summary' }),
- dom.details = self.createDom('div', { id: 'details' }))
- );
- }
-};
-jasmine.HtmlReporterHelpers.addHelpers(jasmine.HtmlReporter);
http://git-wip-us.apache.org/repos/asf/incubator-cordova-windows/blob/03bf0cde/src/cordova-win8/test/views/HtmlReporterHelpers.js
----------------------------------------------------------------------
diff --git a/src/cordova-win8/test/views/HtmlReporterHelpers.js b/src/cordova-win8/test/views/HtmlReporterHelpers.js
deleted file mode 100644
index 745e1e0..0000000
--- a/src/cordova-win8/test/views/HtmlReporterHelpers.js
+++ /dev/null
@@ -1,60 +0,0 @@
-jasmine.HtmlReporterHelpers = {};
-
-jasmine.HtmlReporterHelpers.createDom = function(type, attrs, childrenVarArgs) {
- var el = document.createElement(type);
-
- for (var i = 2; i < arguments.length; i++) {
- var child = arguments[i];
-
- if (typeof child === 'string') {
- el.appendChild(document.createTextNode(child));
- } else {
- if (child) {
- el.appendChild(child);
- }
- }
- }
-
- for (var attr in attrs) {
- if (attr == "className") {
- el[attr] = attrs[attr];
- } else {
- el.setAttribute(attr, attrs[attr]);
- }
- }
-
- return el;
-};
-
-jasmine.HtmlReporterHelpers.getSpecStatus = function(child) {
- var results = child.results();
- var status = results.passed() ? 'passed' : 'failed';
- if (results.skipped) {
- status = 'skipped';
- }
-
- return status;
-};
-
-jasmine.HtmlReporterHelpers.appendToSummary = function(child, childElement) {
- var parentDiv = this.dom.summary;
- var parentSuite = (typeof child.parentSuite == 'undefined') ? 'suite' : 'parentSuite';
- var parent = child[parentSuite];
-
- if (parent) {
- if (typeof this.views.suites[parent.id] == 'undefined') {
- this.views.suites[parent.id] = new jasmine.HtmlReporter.SuiteView(parent, this.dom, this.views);
- }
- parentDiv = this.views.suites[parent.id].element;
- }
-
- parentDiv.appendChild(childElement);
-};
-
-
-jasmine.HtmlReporterHelpers.addHelpers = function(ctor) {
- for(var fn in jasmine.HtmlReporterHelpers) {
- ctor.prototype[fn] = jasmine.HtmlReporterHelpers[fn];
- }
-};
-
http://git-wip-us.apache.org/repos/asf/incubator-cordova-windows/blob/03bf0cde/src/cordova-win8/test/views/ReporterView.js
----------------------------------------------------------------------
diff --git a/src/cordova-win8/test/views/ReporterView.js b/src/cordova-win8/test/views/ReporterView.js
deleted file mode 100644
index 6a6d005..0000000
--- a/src/cordova-win8/test/views/ReporterView.js
+++ /dev/null
@@ -1,164 +0,0 @@
-jasmine.HtmlReporter.ReporterView = function(dom) {
- this.startedAt = new Date();
- this.runningSpecCount = 0;
- this.completeSpecCount = 0;
- this.passedCount = 0;
- this.failedCount = 0;
- this.skippedCount = 0;
-
- this.createResultsMenu = function() {
- this.resultsMenu = this.createDom('span', {className: 'resultsMenu bar'},
- this.summaryMenuItem = this.createDom('a', {className: 'summaryMenuItem', href: "#"}, '0 specs'),
- ' | ',
- this.detailsMenuItem = this.createDom('a', {className: 'detailsMenuItem', href: "#"}, '0 failing'));
-
- this.summaryMenuItem.onclick = function() {
- dom.reporter.className = dom.reporter.className.replace(/ showDetails/g, '');
- };
-
- this.detailsMenuItem.onclick = function() {
- showDetails();
- };
- };
-
- this.addSpecs = function(specs, specFilter) {
- this.totalSpecCount = specs.length;
-
- this.views = {
- specs: {},
- suites: {}
- };
-
- for (var i = 0; i < specs.length; i++) {
- var spec = specs[i];
- this.views.specs[spec.id] = new jasmine.HtmlReporter.SpecView(spec, dom, this.views);
- if (specFilter(spec)) {
- this.runningSpecCount++;
- }
- }
- };
-
- this.specComplete = function(spec) {
- this.completeSpecCount++;
-
- if (isUndefined(this.views.specs[spec.id])) {
- this.views.specs[spec.id] = new jasmine.HtmlReporter.SpecView(spec, dom);
- }
-
- var specView = this.views.specs[spec.id];
-
- switch (specView.status()) {
- case 'passed':
- this.passedCount++;
- break;
-
- case 'failed':
- this.failedCount++;
- break;
-
- case 'skipped':
- this.skippedCount++;
- break;
- }
-
- specView.refresh();
- this.refresh();
- };
-
- this.suiteComplete = function(suite) {
- var suiteView = this.views.suites[suite.id];
- if (isUndefined(suiteView)) {
- return;
- }
- suiteView.refresh();
- };
-
- this.refresh = function() {
-
- if (isUndefined(this.resultsMenu)) {
- this.createResultsMenu();
- }
-
- // currently running UI
- if (isUndefined(this.runningAlert)) {
- this.runningAlert = this.createDom('a', {href: "?", className: "runningAlert bar"});
- dom.alert.appendChild(this.runningAlert);
- }
- this.runningAlert.innerHTML = "Running " + this.completeSpecCount + " of " + specPluralizedFor(this.totalSpecCount);
-
- // skipped specs UI
- if (isUndefined(this.skippedAlert)) {
- this.skippedAlert = this.createDom('a', {href: "?", className: "skippedAlert bar"});
- }
-
- this.skippedAlert.innerHTML = "Skipping " + this.skippedCount + " of " + specPluralizedFor(this.totalSpecCount) + " - run all";
-
- if (this.skippedCount === 1 && isDefined(dom.alert)) {
- dom.alert.appendChild(this.skippedAlert);
- }
-
- // passing specs UI
- if (isUndefined(this.passedAlert)) {
- this.passedAlert = this.createDom('span', {href: "?", className: "passingAlert bar"});
- }
- this.passedAlert.innerHTML = "Passing " + specPluralizedFor(this.passedCount);
-
- // failing specs UI
- if (isUndefined(this.failedAlert)) {
- this.failedAlert = this.createDom('span', {href: "?", className: "failingAlert bar"});
- }
- this.failedAlert.innerHTML = "Failing " + specPluralizedFor(this.failedCount);
-
- if (this.failedCount === 1 && isDefined(dom.alert)) {
- dom.alert.appendChild(this.failedAlert);
- dom.alert.appendChild(this.resultsMenu);
- }
-
- // summary info
- this.summaryMenuItem.innerHTML = "" + specPluralizedFor(this.runningSpecCount);
- this.detailsMenuItem.innerHTML = "" + this.failedCount + " failing";
- };
-
- this.complete = function() {
- dom.alert.removeChild(this.runningAlert);
-
- this.skippedAlert.innerHTML = "Ran " + this.runningSpecCount + " of " + specPluralizedFor(this.totalSpecCount) + " - run all";
-
- if (this.failedCount === 0) {
- dom.alert.appendChild(this.createDom('span', {className: 'passingAlert bar'}, "Passing " + specPluralizedFor(this.passedCount)));
- } else {
- showDetails();
- }
-
- dom.banner.appendChild(this.createDom('span', {className: 'duration'}, "finished in " + ((new Date().getTime() - this.startedAt.getTime()) / 1000) + "s"));
- };
-
- return this;
-
- function showDetails() {
- if (dom.reporter.className.search(/showDetails/) === -1) {
- dom.reporter.className += " showDetails";
- }
- }
-
- function isUndefined(obj) {
- return typeof obj === 'undefined';
- }
-
- function isDefined(obj) {
- return !isUndefined(obj);
- }
-
- function specPluralizedFor(count) {
- var str = count + " spec";
- if (count > 1) {
- str += "s"
- }
- return str;
- }
-
-};
-
-jasmine.HtmlReporterHelpers.addHelpers(jasmine.HtmlReporter.ReporterView);
-
-
http://git-wip-us.apache.org/repos/asf/incubator-cordova-windows/blob/03bf0cde/src/cordova-win8/test/views/SpecView.js
----------------------------------------------------------------------
diff --git a/src/cordova-win8/test/views/SpecView.js b/src/cordova-win8/test/views/SpecView.js
deleted file mode 100644
index 8769bb8..0000000
--- a/src/cordova-win8/test/views/SpecView.js
+++ /dev/null
@@ -1,79 +0,0 @@
-jasmine.HtmlReporter.SpecView = function(spec, dom, views) {
- this.spec = spec;
- this.dom = dom;
- this.views = views;
-
- this.symbol = this.createDom('li', { className: 'pending' });
- this.dom.symbolSummary.appendChild(this.symbol);
-
- this.summary = this.createDom('div', { className: 'specSummary' },
- this.createDom('a', {
- className: 'description',
- href: '?spec=' + encodeURIComponent(this.spec.getFullName()),
- title: this.spec.getFullName()
- }, this.spec.description)
- );
-
- this.detail = this.createDom('div', { className: 'specDetail' },
- this.createDom('a', {
- className: 'description',
- href: '?spec=' + encodeURIComponent(this.spec.getFullName()),
- title: this.spec.getFullName()
- }, this.spec.getFullName())
- );
-};
-
-jasmine.HtmlReporter.SpecView.prototype.status = function() {
- return this.getSpecStatus(this.spec);
-};
-
-jasmine.HtmlReporter.SpecView.prototype.refresh = function() {
- this.symbol.className = this.status();
-
- switch (this.status()) {
- case 'skipped':
- break;
-
- case 'passed':
- this.appendSummaryToSuiteDiv();
- break;
-
- case 'failed':
- this.appendSummaryToSuiteDiv();
- this.appendFailureDetail();
- break;
- }
-};
-
-jasmine.HtmlReporter.SpecView.prototype.appendSummaryToSuiteDiv = function() {
- this.summary.className += ' ' + this.status();
- this.appendToSummary(this.spec, this.summary);
-};
-
-jasmine.HtmlReporter.SpecView.prototype.appendFailureDetail = function() {
- this.detail.className += ' ' + this.status();
-
- var resultItems = this.spec.results().getItems();
- var messagesDiv = this.createDom('div', { className: 'messages' });
-
- for (var i = 0; i < resultItems.length; i++) {
- var result = resultItems[i];
-
- if (result.type == 'log') {
- messagesDiv.appendChild(this.createDom('div', {className: 'resultMessage log'}, result.toString()));
- } else if (result.type == 'expect' && result.passed && !result.passed()) {
- messagesDiv.appendChild(this.createDom('div', {className: 'resultMessage fail'}, result.message));
-
- if (result.trace.stack) {
- messagesDiv.appendChild(this.createDom('div', {className: 'stackTrace'}, result.trace.stack));
- }
- }
- }
-
- if (messagesDiv.childNodes.length > 0) {
- this.detail.appendChild(messagesDiv);
- this.dom.details.appendChild(this.detail);
- }
-};
-
-jasmine.HtmlReporterHelpers.addHelpers(jasmine.HtmlReporter.SpecView);
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-cordova-windows/blob/03bf0cde/src/cordova-win8/test/views/SuiteView.js
----------------------------------------------------------------------
diff --git a/src/cordova-win8/test/views/SuiteView.js b/src/cordova-win8/test/views/SuiteView.js
deleted file mode 100644
index 19a1efa..0000000
--- a/src/cordova-win8/test/views/SuiteView.js
+++ /dev/null
@@ -1,22 +0,0 @@
-jasmine.HtmlReporter.SuiteView = function(suite, dom, views) {
- this.suite = suite;
- this.dom = dom;
- this.views = views;
-
- this.element = this.createDom('div', { className: 'suite' },
- this.createDom('a', { className: 'description', href: '?spec=' + encodeURIComponent(this.suite.getFullName()) }, this.suite.description)
- );
-
- this.appendToSummary(this.suite, this.element);
-};
-
-jasmine.HtmlReporter.SuiteView.prototype.status = function() {
- return this.getSpecStatus(this.suite);
-};
-
-jasmine.HtmlReporter.SuiteView.prototype.refresh = function() {
- this.element.className += " " + this.status();
-};
-
-jasmine.HtmlReporterHelpers.addHelpers(jasmine.HtmlReporter.SuiteView);
-
http://git-wip-us.apache.org/repos/asf/incubator-cordova-windows/blob/03bf0cde/src/cordova-win8/test/views/TrivialReporter.js
----------------------------------------------------------------------
diff --git a/src/cordova-win8/test/views/TrivialReporter.js b/src/cordova-win8/test/views/TrivialReporter.js
deleted file mode 100644
index 167ac50..0000000
--- a/src/cordova-win8/test/views/TrivialReporter.js
+++ /dev/null
@@ -1,192 +0,0 @@
-/* @deprecated Use jasmine.HtmlReporter instead
- */
-jasmine.TrivialReporter = function(doc) {
- this.document = doc || document;
- this.suiteDivs = {};
- this.logRunningSpecs = false;
-};
-
-jasmine.TrivialReporter.prototype.createDom = function(type, attrs, childrenVarArgs) {
- var el = document.createElement(type);
-
- for (var i = 2; i < arguments.length; i++) {
- var child = arguments[i];
-
- if (typeof child === 'string') {
- el.appendChild(document.createTextNode(child));
- } else {
- if (child) { el.appendChild(child); }
- }
- }
-
- for (var attr in attrs) {
- if (attr == "className") {
- el[attr] = attrs[attr];
- } else {
- el.setAttribute(attr, attrs[attr]);
- }
- }
-
- return el;
-};
-
-jasmine.TrivialReporter.prototype.reportRunnerStarting = function(runner) {
- var showPassed, showSkipped;
-
- this.outerDiv = this.createDom('div', { id: 'TrivialReporter', className: 'jasmine_reporter' },
- this.createDom('div', { className: 'banner' },
- this.createDom('div', { className: 'logo' },
- this.createDom('span', { className: 'title' }, "Jasmine"),
- this.createDom('span', { className: 'version' }, runner.env.versionString())),
- this.createDom('div', { className: 'options' },
- "Show ",
- showPassed = this.createDom('input', { id: "__jasmine_TrivialReporter_showPassed__", type: 'checkbox' }),
- this.createDom('label', { "for": "__jasmine_TrivialReporter_showPassed__" }, " passed "),
- showSkipped = this.createDom('input', { id: "__jasmine_TrivialReporter_showSkipped__", type: 'checkbox' }),
- this.createDom('label', { "for": "__jasmine_TrivialReporter_showSkipped__" }, " skipped")
- )
- ),
-
- this.runnerDiv = this.createDom('div', { className: 'runner running' },
- this.createDom('a', { className: 'run_spec', href: '?' }, "run all"),
- this.runnerMessageSpan = this.createDom('span', {}, "Running..."),
- this.finishedAtSpan = this.createDom('span', { className: 'finished-at' }, ""))
- );
-
- this.document.body.appendChild(this.outerDiv);
-
- var suites = runner.suites();
- for (var i = 0; i < suites.length; i++) {
- var suite = suites[i];
- var suiteDiv = this.createDom('div', { className: 'suite' },
- this.createDom('a', { className: 'run_spec', href: '?spec=' + encodeURIComponent(suite.getFullName()) }, "run"),
- this.createDom('a', { className: 'description', href: '?spec=' + encodeURIComponent(suite.getFullName()) }, suite.description));
- this.suiteDivs[suite.id] = suiteDiv;
- var parentDiv = this.outerDiv;
- if (suite.parentSuite) {
- parentDiv = this.suiteDivs[suite.parentSuite.id];
- }
- parentDiv.appendChild(suiteDiv);
- }
-
- this.startedAt = new Date();
-
- var self = this;
- showPassed.onclick = function(evt) {
- if (showPassed.checked) {
- self.outerDiv.className += ' show-passed';
- } else {
- self.outerDiv.className = self.outerDiv.className.replace(/ show-passed/, '');
- }
- };
-
- showSkipped.onclick = function(evt) {
- if (showSkipped.checked) {
- self.outerDiv.className += ' show-skipped';
- } else {
- self.outerDiv.className = self.outerDiv.className.replace(/ show-skipped/, '');
- }
- };
-};
-
-jasmine.TrivialReporter.prototype.reportRunnerResults = function(runner) {
- var results = runner.results();
- var className = (results.failedCount > 0) ? "runner failed" : "runner passed";
- this.runnerDiv.setAttribute("class", className);
- //do it twice for IE
- this.runnerDiv.setAttribute("className", className);
- var specs = runner.specs();
- var specCount = 0;
- for (var i = 0; i < specs.length; i++) {
- if (this.specFilter(specs[i])) {
- specCount++;
- }
- }
- var message = "" + specCount + " spec" + (specCount == 1 ? "" : "s" ) + ", " + results.failedCount + " failure" + ((results.failedCount == 1) ? "" : "s");
- message += " in " + ((new Date().getTime() - this.startedAt.getTime()) / 1000) + "s";
- this.runnerMessageSpan.replaceChild(this.createDom('a', { className: 'description', href: '?'}, message), this.runnerMessageSpan.firstChild);
-
- this.finishedAtSpan.appendChild(document.createTextNode("Finished at " + new Date().toString()));
-};
-
-jasmine.TrivialReporter.prototype.reportSuiteResults = function(suite) {
- var results = suite.results();
- var status = results.passed() ? 'passed' : 'failed';
- if (results.totalCount === 0) { // todo: change this to check results.skipped
- status = 'skipped';
- }
- this.suiteDivs[suite.id].className += " " + status;
-};
-
-jasmine.TrivialReporter.prototype.reportSpecStarting = function(spec) {
- if (this.logRunningSpecs) {
- this.log('>> Jasmine Running ' + spec.suite.description + ' ' + spec.description + '...');
- }
-};
-
-jasmine.TrivialReporter.prototype.reportSpecResults = function(spec) {
- var results = spec.results();
- var status = results.passed() ? 'passed' : 'failed';
- if (results.skipped) {
- status = 'skipped';
- }
- var specDiv = this.createDom('div', { className: 'spec ' + status },
- this.createDom('a', { className: 'run_spec', href: '?spec=' + encodeURIComponent(spec.getFullName()) }, "run"),
- this.createDom('a', {
- className: 'description',
- href: '?spec=' + encodeURIComponent(spec.getFullName()),
- title: spec.getFullName()
- }, spec.description));
-
-
- var resultItems = results.getItems();
- var messagesDiv = this.createDom('div', { className: 'messages' });
- for (var i = 0; i < resultItems.length; i++) {
- var result = resultItems[i];
-
- if (result.type == 'log') {
- messagesDiv.appendChild(this.createDom('div', {className: 'resultMessage log'}, result.toString()));
- } else if (result.type == 'expect' && result.passed && !result.passed()) {
- messagesDiv.appendChild(this.createDom('div', {className: 'resultMessage fail'}, result.message));
-
- if (result.trace.stack) {
- messagesDiv.appendChild(this.createDom('div', {className: 'stackTrace'}, result.trace.stack));
- }
- }
- }
-
- if (messagesDiv.childNodes.length > 0) {
- specDiv.appendChild(messagesDiv);
- }
-
- this.suiteDivs[spec.suite.id].appendChild(specDiv);
-};
-
-jasmine.TrivialReporter.prototype.log = function() {
- var console = jasmine.getGlobal().console;
- if (console && console.log) {
- if (console.log.apply) {
- console.log.apply(console, arguments);
- } else {
- console.log(arguments); // ie fix: console.log.apply doesn't exist on ie
- }
- }
-};
-
-jasmine.TrivialReporter.prototype.getLocation = function() {
- return this.document.location;
-};
-
-jasmine.TrivialReporter.prototype.specFilter = function(spec) {
- var paramMap = {};
- var params = this.getLocation().search.substring(1).split('&');
- for (var i = 0; i < params.length; i++) {
- var p = params[i].split('=');
- paramMap[decodeURIComponent(p[0])] = decodeURIComponent(p[1]);
- }
-
- if (!paramMap.spec) {
- return true;
- }
- return spec.getFullName().indexOf(paramMap.spec) === 0;
-};
http://git-wip-us.apache.org/repos/asf/incubator-cordova-windows/blob/03bf0cde/src/src.sln
----------------------------------------------------------------------
diff --git a/src/src.sln b/src/src.sln
deleted file mode 100644
index d7bdae8..0000000
--- a/src/src.sln
+++ /dev/null
@@ -1,86 +0,0 @@
-
-Microsoft Visual Studio Solution File, Format Version 12.00
-# Visual Studio 2012
-Project("{262852C6-CD72-467D-83FE-5EEB1973A190}") = "cordova-win8", "cordova-win8\cordova-win8.jsproj", "{AC81DC10-B726-47B1-8521-EBFDDA2CA496}"
-EndProject
-Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "SQLite3", "cordova-win8\lib\SQLite\SQLite3\SQLite3.vcxproj", "{4CF1AE34-D183-409B-90C3-D62167CFF25D}"
-EndProject
-Global
- GlobalSection(SolutionConfigurationPlatforms) = preSolution
- Debug|ARM = Debug|ARM
- Debug|Any CPU = Debug|Any CPU
- Debug|Mixed Platforms = Debug|Mixed Platforms
- Debug|Win32 = Debug|Win32
- Debug|x64 = Debug|x64
- Debug|x86 = Debug|x86
- Release|ARM = Release|ARM
- Release|Any CPU = Release|Any CPU
- Release|Mixed Platforms = Release|Mixed Platforms
- Release|Win32 = Release|Win32
- Release|x64 = Release|x64
- Release|x86 = Release|x86
- EndGlobalSection
- GlobalSection(ProjectConfigurationPlatforms) = postSolution
- {4CF1AE34-D183-409B-90C3-D62167CFF25D}.Debug|ARM.ActiveCfg = Debug|ARM
- {4CF1AE34-D183-409B-90C3-D62167CFF25D}.Debug|ARM.Build.0 = Debug|ARM
- {4CF1AE34-D183-409B-90C3-D62167CFF25D}.Debug|Any CPU.ActiveCfg = Debug|Win32
- {4CF1AE34-D183-409B-90C3-D62167CFF25D}.Debug|Mixed Platforms.ActiveCfg = Debug|Win32
- {4CF1AE34-D183-409B-90C3-D62167CFF25D}.Debug|Mixed Platforms.Build.0 = Debug|Win32
- {4CF1AE34-D183-409B-90C3-D62167CFF25D}.Debug|Win32.ActiveCfg = Debug|Win32
- {4CF1AE34-D183-409B-90C3-D62167CFF25D}.Debug|Win32.Build.0 = Debug|Win32
- {4CF1AE34-D183-409B-90C3-D62167CFF25D}.Debug|x64.ActiveCfg = Debug|x64
- {4CF1AE34-D183-409B-90C3-D62167CFF25D}.Debug|x64.Build.0 = Debug|x64
- {4CF1AE34-D183-409B-90C3-D62167CFF25D}.Debug|x86.ActiveCfg = Debug|Win32
- {4CF1AE34-D183-409B-90C3-D62167CFF25D}.Debug|x86.Build.0 = Debug|Win32
- {4CF1AE34-D183-409B-90C3-D62167CFF25D}.Release|ARM.ActiveCfg = Release|ARM
- {4CF1AE34-D183-409B-90C3-D62167CFF25D}.Release|ARM.Build.0 = Release|ARM
- {4CF1AE34-D183-409B-90C3-D62167CFF25D}.Release|Any CPU.ActiveCfg = Release|Win32
- {4CF1AE34-D183-409B-90C3-D62167CFF25D}.Release|Mixed Platforms.ActiveCfg = Release|Win32
- {4CF1AE34-D183-409B-90C3-D62167CFF25D}.Release|Mixed Platforms.Build.0 = Release|Win32
- {4CF1AE34-D183-409B-90C3-D62167CFF25D}.Release|Win32.ActiveCfg = Release|Win32
- {4CF1AE34-D183-409B-90C3-D62167CFF25D}.Release|Win32.Build.0 = Release|Win32
- {4CF1AE34-D183-409B-90C3-D62167CFF25D}.Release|x64.ActiveCfg = Release|x64
- {4CF1AE34-D183-409B-90C3-D62167CFF25D}.Release|x64.Build.0 = Release|x64
- {4CF1AE34-D183-409B-90C3-D62167CFF25D}.Release|x86.ActiveCfg = Release|Win32
- {4CF1AE34-D183-409B-90C3-D62167CFF25D}.Release|x86.Build.0 = Release|Win32
- {AC81DC10-B726-47B1-8521-EBFDDA2CA496}.Debug|ARM.ActiveCfg = Debug|ARM
- {AC81DC10-B726-47B1-8521-EBFDDA2CA496}.Debug|ARM.Build.0 = Debug|ARM
- {AC81DC10-B726-47B1-8521-EBFDDA2CA496}.Debug|ARM.Deploy.0 = Debug|ARM
- {AC81DC10-B726-47B1-8521-EBFDDA2CA496}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
- {AC81DC10-B726-47B1-8521-EBFDDA2CA496}.Debug|Any CPU.Build.0 = Debug|Any CPU
- {AC81DC10-B726-47B1-8521-EBFDDA2CA496}.Debug|Any CPU.Deploy.0 = Debug|Any CPU
- {AC81DC10-B726-47B1-8521-EBFDDA2CA496}.Debug|Mixed Platforms.ActiveCfg = Debug|x86
- {AC81DC10-B726-47B1-8521-EBFDDA2CA496}.Debug|Mixed Platforms.Build.0 = Debug|x86
- {AC81DC10-B726-47B1-8521-EBFDDA2CA496}.Debug|Mixed Platforms.Deploy.0 = Debug|x86
- {AC81DC10-B726-47B1-8521-EBFDDA2CA496}.Debug|Win32.ActiveCfg = Debug|x86
- {AC81DC10-B726-47B1-8521-EBFDDA2CA496}.Debug|Win32.Build.0 = Debug|x86
- {AC81DC10-B726-47B1-8521-EBFDDA2CA496}.Debug|Win32.Deploy.0 = Debug|x86
- {AC81DC10-B726-47B1-8521-EBFDDA2CA496}.Debug|x64.ActiveCfg = Debug|x64
- {AC81DC10-B726-47B1-8521-EBFDDA2CA496}.Debug|x64.Build.0 = Debug|x64
- {AC81DC10-B726-47B1-8521-EBFDDA2CA496}.Debug|x64.Deploy.0 = Debug|x64
- {AC81DC10-B726-47B1-8521-EBFDDA2CA496}.Debug|x86.ActiveCfg = Debug|x86
- {AC81DC10-B726-47B1-8521-EBFDDA2CA496}.Debug|x86.Build.0 = Debug|x86
- {AC81DC10-B726-47B1-8521-EBFDDA2CA496}.Debug|x86.Deploy.0 = Debug|x86
- {AC81DC10-B726-47B1-8521-EBFDDA2CA496}.Release|ARM.ActiveCfg = Release|ARM
- {AC81DC10-B726-47B1-8521-EBFDDA2CA496}.Release|ARM.Build.0 = Release|ARM
- {AC81DC10-B726-47B1-8521-EBFDDA2CA496}.Release|ARM.Deploy.0 = Release|ARM
- {AC81DC10-B726-47B1-8521-EBFDDA2CA496}.Release|Any CPU.ActiveCfg = Release|Any CPU
- {AC81DC10-B726-47B1-8521-EBFDDA2CA496}.Release|Any CPU.Build.0 = Release|Any CPU
- {AC81DC10-B726-47B1-8521-EBFDDA2CA496}.Release|Any CPU.Deploy.0 = Release|Any CPU
- {AC81DC10-B726-47B1-8521-EBFDDA2CA496}.Release|Mixed Platforms.ActiveCfg = Release|x86
- {AC81DC10-B726-47B1-8521-EBFDDA2CA496}.Release|Mixed Platforms.Build.0 = Release|x86
- {AC81DC10-B726-47B1-8521-EBFDDA2CA496}.Release|Mixed Platforms.Deploy.0 = Release|x86
- {AC81DC10-B726-47B1-8521-EBFDDA2CA496}.Release|Win32.ActiveCfg = Release|x86
- {AC81DC10-B726-47B1-8521-EBFDDA2CA496}.Release|Win32.Build.0 = Release|x86
- {AC81DC10-B726-47B1-8521-EBFDDA2CA496}.Release|Win32.Deploy.0 = Release|x86
- {AC81DC10-B726-47B1-8521-EBFDDA2CA496}.Release|x64.ActiveCfg = Release|x64
- {AC81DC10-B726-47B1-8521-EBFDDA2CA496}.Release|x64.Build.0 = Release|x64
- {AC81DC10-B726-47B1-8521-EBFDDA2CA496}.Release|x64.Deploy.0 = Release|x64
- {AC81DC10-B726-47B1-8521-EBFDDA2CA496}.Release|x86.ActiveCfg = Release|x86
- {AC81DC10-B726-47B1-8521-EBFDDA2CA496}.Release|x86.Build.0 = Release|x86
- {AC81DC10-B726-47B1-8521-EBFDDA2CA496}.Release|x86.Deploy.0 = Release|x86
- EndGlobalSection
- GlobalSection(SolutionProperties) = preSolution
- HideSolutionNode = FALSE
- EndGlobalSection
-EndGlobal
http://git-wip-us.apache.org/repos/asf/incubator-cordova-windows/blob/03bf0cde/tool/CordovaBuilder/CordovaBuilder.sln
----------------------------------------------------------------------
diff --git a/tool/CordovaBuilder/CordovaBuilder.sln b/tool/CordovaBuilder/CordovaBuilder.sln
deleted file mode 100644
index 10fee0b..0000000
--- a/tool/CordovaBuilder/CordovaBuilder.sln
+++ /dev/null
@@ -1,20 +0,0 @@
-
-Microsoft Visual Studio Solution File, Format Version 12.00
-# Visual Studio 2012
-Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "CordovaBuilder", "CordovaBuilder\CordovaBuilder.csproj", "{7D6262C4-A2B4-4FE6-87A7-650866FEE54B}"
-EndProject
-Global
- GlobalSection(SolutionConfigurationPlatforms) = preSolution
- Debug|Any CPU = Debug|Any CPU
- Release|Any CPU = Release|Any CPU
- EndGlobalSection
- GlobalSection(ProjectConfigurationPlatforms) = postSolution
- {7D6262C4-A2B4-4FE6-87A7-650866FEE54B}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
- {7D6262C4-A2B4-4FE6-87A7-650866FEE54B}.Debug|Any CPU.Build.0 = Debug|Any CPU
- {7D6262C4-A2B4-4FE6-87A7-650866FEE54B}.Release|Any CPU.ActiveCfg = Release|Any CPU
- {7D6262C4-A2B4-4FE6-87A7-650866FEE54B}.Release|Any CPU.Build.0 = Release|Any CPU
- EndGlobalSection
- GlobalSection(SolutionProperties) = preSolution
- HideSolutionNode = FALSE
- EndGlobalSection
-EndGlobal
http://git-wip-us.apache.org/repos/asf/incubator-cordova-windows/blob/03bf0cde/tool/CordovaBuilder/CordovaBuilder/CordovaBuilder.cs
----------------------------------------------------------------------
diff --git a/tool/CordovaBuilder/CordovaBuilder/CordovaBuilder.cs b/tool/CordovaBuilder/CordovaBuilder/CordovaBuilder.cs
deleted file mode 100755
index 2eaf4b4..0000000
--- a/tool/CordovaBuilder/CordovaBuilder/CordovaBuilder.cs
+++ /dev/null
@@ -1,307 +0,0 @@
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text;
-using System.Collections.ObjectModel;
-using System.Diagnostics;
-using System.IO;
-
-using Ionic.Zip;
-using System.Text.RegularExpressions;
-
-namespace tooling
-{
-
- class CordovaBuilder
- {
-
- static void Usage()
- {
- Log("Usage: CordovaBuilder [ BuildOutputPath -c:Type ]");
- Log(" BuildOutputPath : path to save the built application");
- Log(" -c : which type of project you want to create, 0 for Metro App developers, 1 for Cordova API developers, default is 0");
- Log("examples:");
- Log(" CordovaBuilder bin\\Debug");
- Log(" CordovaBuilder bin\\Release -c:1");
-
- }
-
- static void Log(string msg)
- {
- Console.WriteLine(msg);
- }
-
- static void ReadWait()
- {
- Console.WriteLine("\nPress ENTER to continue...");
- Console.Read();
- }
-
- static private void DeleteFolder(string folder)
- {
- if (Directory.Exists(folder))
- {
- foreach (string file in Directory.GetFileSystemEntries(folder))
- {
- if (File.Exists(file))
- {
- File.Delete(file);
- }
- else
- {
- DeleteFolder(file);
- }
- }
- Directory.Delete(folder);
- }
- }
-
- static private void ModifyFile(string name, int userChosenType, string root, int length, string source, string result)
- {
- if (userChosenType == 0)
- {
- byte[] byteData = new byte[length];
- char[] charData = new char[length];
- FileStream readFile;
-
- try
- {
- readFile = new FileStream(root + name, FileMode.Open);
- readFile.Read(byteData, 0, length);
- Decoder dec = Encoding.UTF8.GetDecoder();
- dec.GetChars(byteData, 0, byteData.Length, charData, 0);
-
- string preMergeString = new string(charData);
-
- Regex reg = new Regex(source);
- string ss = reg.Replace(preMergeString, result);
- readFile.Close();
-
- byte[] finalData = new UTF8Encoding().GetBytes(ss);
- FileStream writeFile = new FileStream(root + name, FileMode.Open);
- writeFile.Write(finalData, 0, finalData.Length);
- writeFile.Flush();
- writeFile.Close();
- }
- catch (IOException e)
- {
- Console.WriteLine("An IO exception has been thrown!");
- Console.WriteLine(e.ToString());
- Console.ReadLine();
- }
- }
- }
-
- static private string addToEnvironment()
- {
- // add to System Path environment.
- string path = Environment.GetEnvironmentVariable("Path");
-
- string[] tempArr = path.Split(';');
- string[] results = new string[tempArr.Length + 1];
- string appPath = System.Environment.CurrentDirectory + "\\";
-
- bool appPathExist = false;
-
- for (int i = 0; i < tempArr.Length; i++)
- {
- if (tempArr[i].Equals(appPath))
- {
- appPathExist = true;
- }
- if (!tempArr[i].Contains("CordovaBuilder")) {
- results[i] = tempArr[i];
- }
- }
-
- string[] appPaths = appPath.Split('\\');
- if (appPaths.Length > 5)
- {
- if (!appPathExist && appPaths[appPaths.Length - 4].Equals("CordovaBuilder"))
- {
- results[results.Length - 1] = appPath;
-
- List<string> final = new List<string>();
- for (int i = 0; i < results.Length; i++)
- {
- if (!"".Equals(results[i]) && results[i] != null)
- {
- final.Add(results[i]);
- }
-
- }
- string result = String.Join(";", final);
-
- Environment.SetEnvironmentVariable("Path", result, EnvironmentVariableTarget.Machine);
- }
- }
- return path;
- }
-
- static private void createZip(int userChosenType, string[] currentResults, string outPutPath)
- {
- string basePath = "";
- string baseName = "";
-
- if (userChosenType == 0)
- {
- basePath = String.Join("\\", currentResults) + "\\framework\\Cordova-Metro";
- baseName = "\\Cordova-Metro.zip";
- }
- else if (userChosenType == 1)
- {
- basePath = String.Join("\\", currentResults) + "\\src";
- baseName = "\\CordovaStarter.zip";
- }
-
- try
- {
- using (ZipFile zip = new ZipFile())
- {
- zip.StatusMessageTextWriter = System.Console.Out;
-
- zip.AddDirectory(basePath); // recurses subdirectories
-
- zip.Save(outPutPath + baseName);
- }
- }
- catch (System.Exception ex1)
- {
- System.Console.Error.WriteLine("exception: " + ex1);
- }
-
- }
-
- static private string[] mergeJsFiles(string path, int userChosenType)
- {
- string currentPath = Environment.GetEnvironmentVariable("Path");
-
- string[] currentPaths = path.Split(';');
- string[] currentTmparr = currentPaths[currentPaths.Length - 1].Split('\\');
-
- for (int i = 0; i < currentPaths.Length; i++)
- {
- if (currentPaths[i].EndsWith("tool\\CordovaBuilder\\CordovaBuilder\\bin\\Debug\\") || currentPaths[i].EndsWith("tool\\CordovaBuilder\\CordovaBuilder\\bin\\Release\\"))
- {
- currentTmparr = currentPaths[i].Split('\\');
- }
- }
-
- string[] currentResults = new string[currentTmparr.Length - 6];
-
- for (int i = 0; i < currentResults.Length; i++)
- {
- currentResults[i] = currentTmparr[i];
- }
- string currentResult = String.Join("\\", currentResults) + "\\src\\cordova-win8\\js";
- string[] fileNames = Directory.GetFiles(currentResult, "*.js");
- string root = String.Join("\\", currentResults) + "\\framework\\Cordova-Metro";
-
- if (userChosenType == 0)
- {
- FileStream fileStream = new FileStream(root + "\\js\\cordova.js", FileMode.Create);
- BinaryWriter binaryWriter = new BinaryWriter(fileStream);
-
- FileStream stream;
- for (int i = 0; i < fileNames.Length; i++)
- {
- stream = new FileStream(fileNames[i], FileMode.Open);
- BinaryReader reader = new BinaryReader(stream);
- int length = (int)stream.Length;
- byte[] threeBytes = reader.ReadBytes(3);
- //int ch = reader.PeekChar();
- if (threeBytes[0] == 0xef && threeBytes[1] == 0xbb && threeBytes[2] == 0xbf)
- {
- length -= 3;
- }
- else
- {
- binaryWriter.Write(threeBytes);
- }
-
- binaryWriter.Write(reader.ReadBytes(length));
- //binaryWriter.Write("\n");
- reader.Close();
- stream.Close();
- }
- binaryWriter.Close();
- fileStream.Close();
- }
- return currentResults;
- }
-
- static private void cleanProject(int userChosenType, string[] currentResults, string root)
- {
- if (userChosenType == 0)
- {
- /*string deleteFile = root + "\\js\\default.js";
- if (File.Exists(deleteFile))
- {
- File.Delete(deleteFile);
- }*/
- }
- else if (userChosenType == 1)
- {
- DeleteFolder(String.Join("\\", currentResults) + "\\src\\cordova-win8\\bin");
- DeleteFolder(String.Join("\\", currentResults) + "\\src\\cordova-win8\\bld");
- }
-
- }
-
-
- static void Main(string[] args)
- {
- string path = addToEnvironment();
-
- int userChosenType = 0;
- string outPutPath = "";
-
- if (args.Length < 1)
- {
- Usage();
- ReadWait();
- return;
- }
-
- if (args.Length == 2)
- {
- if (args[1].StartsWith("-c:"))
- {
- userChosenType = int.Parse(args[1].Substring(3));
- if (userChosenType != 1 && userChosenType != 0)
- {
- Usage();
- ReadWait();
- return;
- }
- }
- }
-
- if (Directory.Exists(args[0]))
- {
- DirectoryInfo info = new DirectoryInfo(args[0]);
- outPutPath = info.FullName;
- }
- else
- {
- Log(string.Format("Error: could not find folder of path {0}", args[0]));
- ReadWait();
- return;
- }
-
- // Merge the JS files.
- string[] currentResults = mergeJsFiles(path, userChosenType);
-
- string root = String.Join("\\", currentResults) + "\\framework\\Cordova-Metro";
-
- // Modify the default.html.
- ModifyFile("\\default.html", userChosenType, root, 1000, "js/default.js", "js/cordova.js");
-
- // Clean the project.
- cleanProject(userChosenType, currentResults, root);
-
- // Create zip.
- createZip(userChosenType, currentResults, outPutPath);
- }
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-cordova-windows/blob/03bf0cde/tool/CordovaBuilder/CordovaBuilder/CordovaBuilder.csproj
----------------------------------------------------------------------
diff --git a/tool/CordovaBuilder/CordovaBuilder/CordovaBuilder.csproj b/tool/CordovaBuilder/CordovaBuilder/CordovaBuilder.csproj
deleted file mode 100644
index f3393e7..0000000
--- a/tool/CordovaBuilder/CordovaBuilder/CordovaBuilder.csproj
+++ /dev/null
@@ -1,56 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
- <Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
- <PropertyGroup>
- <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
- <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
- <ProjectGuid>{7D6262C4-A2B4-4FE6-87A7-650866FEE54B}</ProjectGuid>
- <OutputType>Exe</OutputType>
- <AppDesignerFolder>Properties</AppDesignerFolder>
- <RootNamespace>CordovaBuilder</RootNamespace>
- <AssemblyName>CordovaBuilder</AssemblyName>
- <TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
- <FileAlignment>512</FileAlignment>
- </PropertyGroup>
- <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
- <PlatformTarget>AnyCPU</PlatformTarget>
- <DebugSymbols>true</DebugSymbols>
- <DebugType>full</DebugType>
- <Optimize>false</Optimize>
- <OutputPath>bin\Debug\</OutputPath>
- <DefineConstants>DEBUG;TRACE</DefineConstants>
- <ErrorReport>prompt</ErrorReport>
- <WarningLevel>4</WarningLevel>
- </PropertyGroup>
- <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
- <PlatformTarget>AnyCPU</PlatformTarget>
- <DebugType>pdbonly</DebugType>
- <Optimize>true</Optimize>
- <OutputPath>bin\Release\</OutputPath>
- <DefineConstants>TRACE</DefineConstants>
- <ErrorReport>prompt</ErrorReport>
- <WarningLevel>4</WarningLevel>
- </PropertyGroup>
- <ItemGroup>
- <Compile Include="CordovaBuilder.cs" />
- <Compile Include="Properties\AssemblyInfo.cs" />
- </ItemGroup>
- <ItemGroup>
- <Content Include="lib\Ionic.Zip.dll" />
- </ItemGroup>
- <ItemGroup>
- <Reference Include="Ionic.Zip, Version=1.9.1.8, Culture=neutral, PublicKeyToken=edbe51ad942a3f5c, processorArchitecture=MSIL">
- <SpecificVersion>False</SpecificVersion>
- <HintPath>lib\Ionic.Zip.dll</HintPath>
- </Reference>
- <Reference Include="System" />
- </ItemGroup>
- <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
- <!-- To modify your build process, add your task inside one of the targets below and uncomment it.
- Other similar extension points exist, see Microsoft.Common.targets.
- <Target Name="BeforeBuild">
- </Target>
- <Target Name="AfterBuild">
- </Target>
- -->
-</Project>
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-cordova-windows/blob/03bf0cde/tool/CordovaBuilder/CordovaBuilder/Properties/AssemblyInfo.cs
----------------------------------------------------------------------
diff --git a/tool/CordovaBuilder/CordovaBuilder/Properties/AssemblyInfo.cs b/tool/CordovaBuilder/CordovaBuilder/Properties/AssemblyInfo.cs
deleted file mode 100644
index 31cbbf4..0000000
--- a/tool/CordovaBuilder/CordovaBuilder/Properties/AssemblyInfo.cs
+++ /dev/null
@@ -1,33 +0,0 @@
-using System.Reflection;
-using System.Runtime.CompilerServices;
-using System.Runtime.InteropServices;
-
-// General Information about an assembly is controlled through the following
-// set of attributes. Change these attribute values to modify the information
-// associated with an assembly.
-[assembly: AssemblyTitle("CordovaBuilder")]
-[assembly: AssemblyDescription("")]
-[assembly: AssemblyConfiguration("")]
-[assembly: AssemblyCompany("")]
-[assembly: AssemblyProduct("CordovaBuilder")]
-[assembly: AssemblyCopyright("Copyright © 2012")]
-[assembly: AssemblyTrademark("")]
-[assembly: AssemblyCulture("")]
-
-// Setting ComVisible to false makes the types in this assembly not visible
-// to COM components. If you need to access a type in this assembly from
-// COM, set the ComVisible attribute to true on that type.
-[assembly: ComVisible(false)]
-
-// The following GUID is for the ID of the typelib if this project is exposed to COM
-[assembly: Guid("aa0f18b9-5f12-41cd-8012-4f6587c0b23b")]
-
-// Version information for an assembly consists of the following four values:
-//
-// Major Version
-// Minor Version
-// Build Number
-// Revision
-//
-[assembly: AssemblyVersion("1.0.0.0")]
-[assembly: AssemblyFileVersion("1.0.0.0")]
http://git-wip-us.apache.org/repos/asf/incubator-cordova-windows/blob/03bf0cde/tool/CordovaBuilder/CordovaBuilder/lib/Ionic.Zip.dll
----------------------------------------------------------------------
diff --git a/tool/CordovaBuilder/CordovaBuilder/lib/Ionic.Zip.dll b/tool/CordovaBuilder/CordovaBuilder/lib/Ionic.Zip.dll
deleted file mode 100644
index 95fa928..0000000
Binary files a/tool/CordovaBuilder/CordovaBuilder/lib/Ionic.Zip.dll and /dev/null differ