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 2013/06/07 00:27:10 UTC
[13/19] removed tests, use mobile spec if you want to test
http://git-wip-us.apache.org/repos/asf/cordova-windows/blob/be415141/windows8/test/autotest/tests/notification.tests.js
----------------------------------------------------------------------
diff --git a/windows8/test/autotest/tests/notification.tests.js b/windows8/test/autotest/tests/notification.tests.js
deleted file mode 100644
index 6b9f242..0000000
--- a/windows8/test/autotest/tests/notification.tests.js
+++ /dev/null
@@ -1,51 +0,0 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
-*/
-
-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 an alert function", function() {
- expect(typeof navigator.notification.alert).toBeDefined();
- expect(typeof navigator.notification.alert).toBe("function");
- });
-
- it("should contain a confirm function", function() {
- expect(typeof navigator.notification.confirm).toBeDefined();
- expect(typeof navigator.notification.confirm).toBe("function");
- });
-
- it("should contain a prompt function", function() {
- expect(typeof navigator.notification.prompt).toBeDefined();
- expect(typeof navigator.notification.prompt).toBe("function");
- });
-});
http://git-wip-us.apache.org/repos/asf/cordova-windows/blob/be415141/windows8/test/autotest/tests/platform.tests.js
----------------------------------------------------------------------
diff --git a/windows8/test/autotest/tests/platform.tests.js b/windows8/test/autotest/tests/platform.tests.js
deleted file mode 100644
index 4a1c1a4..0000000
--- a/windows8/test/autotest/tests/platform.tests.js
+++ /dev/null
@@ -1,31 +0,0 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
-*/
-
-describe('Platform (cordova)', function () {
- it("platform.spec.1 should exist", function() {
- expect(cordova).toBeDefined();
- });
-
- it("platform.spec.2 exec method should exist", function() {
- expect(cordova.exec).toBeDefined();
- expect(typeof cordova.exec).toBe('function');
- });
-});
http://git-wip-us.apache.org/repos/asf/cordova-windows/blob/be415141/windows8/test/autotest/tests/storage.tests.js
----------------------------------------------------------------------
diff --git a/windows8/test/autotest/tests/storage.tests.js b/windows8/test/autotest/tests/storage.tests.js
deleted file mode 100644
index 0294063..0000000
--- a/windows8/test/autotest/tests/storage.tests.js
+++ /dev/null
@@ -1,195 +0,0 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
-*/
-
-describe("Session Storage", function () {
- it("storage.spec.1 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("storage.spec.2 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("storage.spec.3 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("storage.spec.4 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("storage.spec.5 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("storage.spec.6 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("storage.spec.7 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("storage.spec.8 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("storage.spec.9 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("storage.spec.10 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("storage.spec.11 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("storage.spec.4 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("storage.spec.5 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("storage.spec.14 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("storage.spec.7 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("storage.spec.8 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("storage.spec.9 should exist", function() {
- expect(window.openDatabase);
- });
-
- it("storage.spec.18 Should be able to create and drop tables", function() {
- var win = jasmine.createSpy('win');
- var fail1 = createDoNotCallSpy('fail1');
- var fail2 = createDoNotCallSpy('fail2');
- var db = openDatabase("Database", "1.0", "HTML5 Database API example", 5*1024*1024);
- db.transaction(function(t) {
- t.executeSql('CREATE TABLE IF NOT EXISTS foo(id int, name varchar(255));');
- t.executeSql('CREATE TABLE IF NOT EXISTS foo2(id int, name varchar(255));');
- }, fail1, step2);
- function step2() {
- db.transaction(function(t) {
- t.executeSql('DROP TABLE foo;');
- t.executeSql('DROP TABLE foo2');
- }, fail2, win);
- }
- waitsForAny(win, fail1, fail2);
- });
- });
-});
http://git-wip-us.apache.org/repos/asf/cordova-windows/blob/be415141/windows8/test/battery/index.html
----------------------------------------------------------------------
diff --git a/windows8/test/battery/index.html b/windows8/test/battery/index.html
deleted file mode 100644
index 70b0db7..0000000
--- a/windows8/test/battery/index.html
+++ /dev/null
@@ -1,118 +0,0 @@
-<!DOCTYPE html>
-<!--
-
- Licensed to the Apache Software Foundation (ASF) under one
- or more contributor license agreements. See the NOTICE file
- distributed with this work for additional information
- regarding copyright ownership. The ASF licenses this file
- to you under the Apache License, Version 2.0 (the
- "License"); you may not use this file except in compliance
- with the License. You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing,
- software distributed under the License is distributed on an
- "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- KIND, either express or implied. See the License for the
- specific language governing permissions and limitations
- under the License.
-
--->
-
-
-<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-incl.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: Apache Cordova 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/cordova-windows/blob/be415141/windows8/test/benchmarks/arraybuffer.html
----------------------------------------------------------------------
diff --git a/windows8/test/benchmarks/arraybuffer.html b/windows8/test/benchmarks/arraybuffer.html
deleted file mode 100644
index 4dd98b6..0000000
--- a/windows8/test/benchmarks/arraybuffer.html
+++ /dev/null
@@ -1,132 +0,0 @@
-<!DOCTYPE html>
-<!--
-
- Licensed to the Apache Software Foundation (ASF) under one
- or more contributor license agreements. See the NOTICE file
- distributed with this work for additional information
- regarding copyright ownership. The ASF licenses this file
- to you under the Apache License, Version 2.0 (the
- "License"); you may not use this file except in compliance
- with the License. You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing,
- software distributed under the License is distributed on an
- "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- KIND, either express or implied. See the License for the
- specific language governing permissions and limitations
- under the License.
-
--->
-
-
-<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-incl.js"></script>
-
-<script>
- var exec = cordova.require('cordova/exec'),
- deviceReady = false;
-
- function appLog(message) {
- if (window.console) {
- console.log(message);
- }
- if (typeof message != 'string') {
- message = JSON.stringify(message);
- }
- document.getElementById('app-logs').innerText += message + '\n';
- }
-
- function benchExec() {
- var echo = cordova.require('cordova/plugin/echo'),
- startTime = +new Date,
- callCount = 0,
- durationMs = parseInt(document.getElementById('test-duration').value, 10) * 1000,
- payloadSize = (+document.getElementById('payload-size').value),
- payload = new ArrayBuffer(payloadSize);
-
- var payloadView = new Uint8Array(payload);
- for (var i=0; i<payloadView.length; i++) {
- payloadView[i] = i;
- }
-
- function compareArrayBuffers(arr1, arr2) {
- arr1 = new Uint8Array(arr1);
- arr2 = new Uint8Array(arr2);
- if (arr1.length != arr2.length)
- return false;
- for (var i = 0; i < arr1.length; ++i) {
- if (arr1[i] != arr2[i]) {
- return false;
- }
- }
- return true;
- }
-
- function win(result) {
- callCount++;
- if (!compareArrayBuffers(result, payload)) {
- appLog('Wrong echo data!');
- return;
- }
- var elapsedMs = new Date - startTime;
- if (elapsedMs >= durationMs) {
- var callsPerSecond = callCount * 1000 / elapsedMs;
- appLog('Calls per second: ' + callsPerSecond);
- return;
- }
- echoMessage();
- }
- function fail() {
- appLog('Call failed!');
- }
- function echoMessage() {
- setTimeout(function() {
- echo(win, fail, payload);
- });
- }
-
- appLog('Started exec benchmark with payload length: ' + payloadView.length);
- echoMessage();
- setTimeout(function() {
- if (!callCount) {
- alert('Echo plugin did not respond');
- }
- }, 500);
- }
-
- document.addEventListener("deviceready", function() {
- deviceReady = true;
- appLog("Device = " + device.platform + " " + device.version);
- }, false);
-
- window.onload = function() {
- window.setTimeout(function() {
- if (!deviceReady) {
- alert("Error: Cordova did not initialize. Demo will not run correctly.");
- }
- }, 1000);
- };
-
-</script>
-
- </head>
- <body id="stage" class="theme">
- <h1>ArrayBuffer Benchmark</h1>
- <fieldset>
- <legend>Settings</legend>
- <label>Test Duration: <select id="test-duration"><option>1 Second</option><option>5 Seconds</option></select><br></label>
- <label>Payload size (in bytes) <input id="payload-size" value="1024" style="width:100px"></label><br>
- <button onclick="benchExec()">Benchmark exec</button><br>
- </fieldset>
- <h2> </h2><a href="javascript:" class="backBtn" onclick="backHome();">Back</a><br>
- <div>Results:</div>
- <pre id="app-logs" style="white-space:pre-wrap;line-height:initial"></pre>
- </body>
-</html>
http://git-wip-us.apache.org/repos/asf/cordova-windows/blob/be415141/windows8/test/benchmarks/autobench.html
----------------------------------------------------------------------
diff --git a/windows8/test/benchmarks/autobench.html b/windows8/test/benchmarks/autobench.html
deleted file mode 100644
index 9104f05..0000000
--- a/windows8/test/benchmarks/autobench.html
+++ /dev/null
@@ -1,192 +0,0 @@
-<!DOCTYPE html>
-<!--
-
- Licensed to the Apache Software Foundation (ASF) under one
- or more contributor license agreements. See the NOTICE file
- distributed with this work for additional information
- regarding copyright ownership. The ASF licenses this file
- to you under the Apache License, Version 2.0 (the
- "License"); you may not use this file except in compliance
- with the License. You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing,
- software distributed under the License is distributed on an
- "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- KIND, either express or implied. See the License for the
- specific language governing permissions and limitations
- under the License.
-
--->
-<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-incl.js"></script>
- <script type="text/javascript" charset="utf-8" src="uubench.js"></script>
- <script type="text/javascript" charset="utf-8" src="licensecontents.js"></script>
-<script>
- var exec = cordova.require('cordova/exec');
- var temp, pers, LICENSE_CONTENTS;
- function $(id) { return document.getElementById(id); }
-
- function copy_license(filesystem, callback) {
- filesystem.root.getFile("LICENSE", {create: true, exclusive: false}, function(entry) {
- entry.createWriter(function(writer) {
- writer.onwriteend = function(evt) {
- callback();
- };
- writer.write(LICENSE_CONTENTS);
- }, function(err) {
- alert('Error creating LICENSE FileWriter');
- });
- }, function(err) {
- alert('Error copying LICENSE to a file system');
- });
- }
-
- var suite = new uubench.Suite({
- start:function() {
- $('loading').innerHTML = "BENCHMARKING IN PROGRESS...";
- },
- result: function(name, stats) {
- var secs = stats.elapsed/1000;
- var itspersec = stats.iterations / secs;
- $('table-results').innerHTML += '<tr><td>' + name + '</td><td>' + itspersec + ' per second.</td></tr>';
- console.log(name + ' bench complete.');
- results[name] = stats;
- },
- min: 2000, // each benchmark should run for at least 2000ms
- done:function() {
- $('loading').innerHTML = "Benchmarks complete.";
- }
- });
- var results = {};
-
- document.addEventListener("deviceready", function() {
- deviceReady = true;
- var xhr = new XMLHttpRequest();
- xhr.open("GET", "../LICENSE", true);
- xhr.onreadystatechange = function() {
- if (xhr.readyState == 4) {
- if (xhr.responseText.length > 0) {
- LICENSE_CONTENTS = xhr.responseText;
- } else {
- alert('Some prereq XHR stuff to get license content failed mang.');
- }
- window.requestFileSystem(LocalFileSystem.PERSISTENT, 0, function(p_fs) {
- pers = p_fs;
- copy_license(pers, function() {
- window.requestFileSystem(LocalFileSystem.TEMPORARY, 0, function(t_fs) {
- temp = t_fs;
- copy_license(temp, function() {
- setTimeout(bench, 250);
- });
- }, function(t_e) {
- alert('Failed to get TEMPORARY File System');
- });
- });
- }, function(p_e) {
- alert('Failed to get PERSISTENT File System');
- });
- }
- };
- xhr.send(null);
- });
-
- window.onload = function() {
- window.setTimeout(function() {
- if (!deviceReady) {
- alert("Error: Cordova did not initialize. Demo will not run correctly.");
- }
- }, 1000);
- };
-function bench() {
- suite.bench("Echo exec callbacks", function(next) {
- exec(function() {
- // win
- next();
- }, function() {
- // fail
- next();
- }, "Echo", "echo", ["test"]);
- });
- suite.bench("Echo exec invocations", function(next) {
- exec(function() {
- // win
- }, function() {
- // fail
- }, "Echo", "echo", ["test"]);
- next();
- });
- suite.bench("XHR to within-package 11kb asset.", function(next) {
- var xhr = new XMLHttpRequest();
- xhr.open("GET", "../LICENSE", true);
- xhr.onreadystatechange = function() {
- if (xhr.readyState == 4) {
- if (xhr.status == 200) {
- next();
- } else {
- alert('There was a problem during XHR file read!');
- }
- }
- };
- xhr.send(null);
- });
- if (temp) {
- suite.bench("Get contents of 11kb asset located on TEMPORARY File System using FileReader's readAsText method.", function(next) {
- temp.root.getFile("LICENSE", null, function(entry) {
- entry.file(function(file) {
- var reader = new FileReader();
- reader.onloadend = function(evt) {
- next();
- };
- reader.readAsText(file);
- }, function(err) {
- alert('Error getting File object from LICENSE file in TEMP FS.');
- });
- }, function(err) {
- alert('Error getting LICENSE file from root of TEMP FS.');
- });
- });
- }
- if (pers) {
- suite.bench("Get contents of 11kb asset located on PERSISTENT File System using FileReader's readAsText method.", function(next) {
- pers.root.getFile("LICENSE", null, function(entry) {
- entry.file(function(file) {
- var reader = new FileReader();
- reader.onloadend = function(evt) {
- next();
- };
- reader.readAsText(file);
- }, function(err) {
- alert('Error getting File object from LICENSE file in PERSISTENT FS.');
- });
- }, function(err) {
- alert('Error getting LICENSE file from root of PERSISTENT FS.');
- });
- });
- }
- suite.run();
-}
-</script>
-
- </head>
- <body>
- <h1>Auto-Benchmarks</h1>
- <h2 id="loading"></h2>
- <table>
- <thead style="font-weight:bold;text-align:center;">
- <tr>
- <td>Name</td>
- <td>Results</td>
- </tr>
- </thead>
- <tbody id="table-results">
- </tbody>
- </table>
- </body>
-</html>
http://git-wip-us.apache.org/repos/asf/cordova-windows/blob/be415141/windows8/test/benchmarks/index.html
----------------------------------------------------------------------
diff --git a/windows8/test/benchmarks/index.html b/windows8/test/benchmarks/index.html
deleted file mode 100644
index d7dd2bd..0000000
--- a/windows8/test/benchmarks/index.html
+++ /dev/null
@@ -1,165 +0,0 @@
-<!DOCTYPE html>
-<!--
-
- Licensed to the Apache Software Foundation (ASF) under one
- or more contributor license agreements. See the NOTICE file
- distributed with this work for additional information
- regarding copyright ownership. The ASF licenses this file
- to you under the Apache License, Version 2.0 (the
- "License"); you may not use this file except in compliance
- with the License. You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing,
- software distributed under the License is distributed on an
- "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- KIND, either express or implied. See the License for the
- specific language governing permissions and limitations
- under the License.
-
--->
-
-
-<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-incl.js"></script>
-
-<script>
- var exec = cordova.require('cordova/exec'),
- appLogElem = null,
- deviceReady = false;
-
- function appLog(message) {
- if (!appLogElem) {
- appLogElem = document.getElementById('app-logs');
- }
- appLogElem.innerText += message + '\n';
- if (window.console) {
- console.log(message);
- }
- }
-
- function clearLogs() {
- appLogElem.innerHTML = '';
- }
-
- function benchExec() {
- var echo = cordova.require('cordova/plugin/echo'),
- startTime = +new Date,
- callCount = 0,
- durationMs = parseInt(document.getElementById('test-duration').value, 10) * 1000,
- asyncEcho = document.getElementById('async-echo').checked,
- useSetTimeout = document.getElementById('use-setTimeout').checked,
- jsToNativeMode = document.getElementById('js-native-modes').value,
- nativeToJsMode = document.getElementById('native-js-modes').value,
- payloadSize = +document.getElementById('payload-size').value,
- payload = new Array(payloadSize * 10 + 1).join('012\n\n 6789');
-
- function win(result) {
- callCount++;
- if (result != payload) {
- appLog('Wrong echo data!');
- }
- var elapsedMs = new Date - startTime;
- if (elapsedMs < durationMs) {
- if (useSetTimeout) {
- setTimeout(echoMessage, 0);
- } else {
- echoMessage();
- }
- } else {
- var callsPerSecond = callCount * 1000 / elapsedMs;
- appLog('Calls per second: ' + callsPerSecond);
- }
- }
- function fail() {
- appLog('Call failed!');
- }
- function echoMessage() {
- echo(win, fail, payload, asyncEcho);
- }
-
- var logMsg = 'Started exec benchmark with setTimeout: ' + useSetTimeout + ' asyncEcho: ' + asyncEcho + ' payload length: ' + payload.length;
- if (jsToNativeMode) {
- exec.setJsToNativeBridgeMode(+jsToNativeMode);
- logMsg += ' jsToNativeMode: ' + jsToNativeMode;
- }
- if (nativeToJsMode) {
- exec.setNativeToJsBridgeMode(+nativeToJsMode);
- logMsg += ' nativeToJsMode: ' + nativeToJsMode;
- }
- appLog(logMsg);
- echoMessage();
- setTimeout(function() {
- if (!callCount) {
- alert('Echo plugin did not respond');
- }
- }, 500);
- }
-
- function configure() {
- function configureModes(elemId, modes) {
- var selectElem = document.getElementById(elemId);
- for (var modeName in modes) {
- var optionElem = document.createElement('option');
- optionElem.value = modes[modeName];
- optionElem.innerText = modeName;
- selectElem.appendChild(optionElem);
- }
- selectElem.parentNode.style.display = 'block';
- }
- if (exec.jsToNativeModes) {
- configureModes('js-native-modes', exec.jsToNativeModes);
- }
- if (exec.nativeToJsModes) {
- configureModes('native-js-modes', exec.nativeToJsModes);
- }
- }
-
-
- document.addEventListener("deviceready", function() {
- deviceReady = true;
- appLog("Device="+device.platform+" "+device.version);
- configure();
- }, false);
-
- window.onload = function() {
- window.setTimeout(function() {
- if (!deviceReady) {
- alert("Error: Cordova did not initialize. Demo will not run correctly.");
- }
- }, 1000);
- };
-
-</script>
-
- </head>
- <body id="stage" class="theme">
- <a href="autobench.html" class="btn large">AutoBench</a>
- <a href="arraybuffer.html" class="btn large">ArrayBuffer Benchmark</a>
- <h1>exec() Benchmark</h1>
- Before running on Android, set the following constants in NativeToJsMessagingBridge:
- <ul>
- <li>ENABLE_LOCATION_CHANGE_EXEC_MODE = true
- <li>DISABLE_EXEC_CHAINING = true
- </ul>
- <fieldset>
- <legend>Settings</legend>
- <label>Test Duration: <select id="test-duration"><option>1 Second</option><option>5 Seconds</option></select><br></label>
- <label style="display:none">JS->Native Bridge Mode: <select id="js-native-modes"></select><br></label>
- <label style="display:none">Native->JS Bridge Mode: <select id="native-js-modes"></select><br></label>
- <label><input type="checkbox" id="use-setTimeout"> Force async JS->Native</label><br>
- <label><input type="checkbox" id="async-echo"> Force async Native->JS</label><br>
- <label>Payload size (in 100s of bytes) <input id="payload-size" value="5" style="width:100px"></label><br>
- <button onclick="benchExec()">Benchmark exec</button><br>
- </fieldset>
- <h2> </h2><a href="javascript:" class="backBtn" onclick="backHome();">Back</a><br>
- <div>Results: <a href="javascript:clearLogs();">Clear</a></div>
- <pre id="app-logs" style="white-space:pre-wrap;line-height:initial"></pre>
- </body>
-</html>
http://git-wip-us.apache.org/repos/asf/cordova-windows/blob/be415141/windows8/test/benchmarks/uubench.js
----------------------------------------------------------------------
diff --git a/windows8/test/benchmarks/uubench.js b/windows8/test/benchmarks/uubench.js
deleted file mode 100644
index 17c0c4d..0000000
--- a/windows8/test/benchmarks/uubench.js
+++ /dev/null
@@ -1,115 +0,0 @@
-//
-// uubench - Async Benchmarking v0.0.1
-// http://github.com/akdubya/uubench
-//
-// Copyright (c) 2010, Aleksander Williams
-// Released under the MIT License.
-//
-
-(function(uubench){
-
-function Bench(id, test, options, callback) {
- this.id = id;
- this.options = options;
- this.test = test;
- this.loop = test.length > 1;
- this.callback = callback;
-}
-
-Bench.prototype.run = function(iter) {
- var self = this, fn = self.test,
- checkfn = self.options.type === "adaptive" ? adaptive : fixed,
- i = iter, pend = i,
- min = self.options.min, start;
-
- if (self.loop) {
- pend = 1;
- start = new Date();
- fn(checkfn, i);
- } else {
- start = new Date();
- while (i--) {
- fn(checkfn);
- }
- }
-
- function fixed() {
- if (--pend === 0) {
- var elapsed = new Date() - start;
- self.callback({iterations: iter, elapsed: elapsed});
- }
- }
-
- function adaptive() {
- if (--pend === 0) {
- var elapsed = new Date() - start;
- if (elapsed < min) {
- self.run(iter*2);
- } else {
- self.callback({iterations: iter, elapsed: elapsed});
- }
- }
- }
-}
-
-uubench.Bench = Bench;
-
-uubench.defaults = {
- type: "adaptive", // adaptive or fixed
- iterations: 10, // starting iterations
- min: 100, // minimum run time (ms) - adaptive only
- delay: 100 // delay between tests (ms)
-}
-
-function Suite(opts) {
- for (var key in uubench.defaults) {
- if (opts[key] === undefined) {
- opts[key] = uubench.defaults[key];
- }
- }
- this.options = opts;
- this.tests = [];
-}
-
-Suite.prototype.bench = function(name, fn) {
- var self = this;
- self.tests.push(new Bench(name, fn, this.options, function(stats) {
- self.emit("result", name, stats);
- self.pending--;
- self.check();
- }));
-}
-
-Suite.prototype.run = function() {
- if (this.pending) return;
- var self = this, len = self.tests.length;
- self.emit("start", self.tests);
- self.start = new Date().getTime();
- self.pending = len;
- for (var i=0; i<len; i++) {
- self.runOne(i);
- }
-}
-
-Suite.prototype.runOne = function(idx) {
- var self = this;
- setTimeout(function() {
- self.tests[idx].run(self.options.iterations);
- }, self.options.delay);
-}
-
-Suite.prototype.check = function() {
- if (this.pending) return;
- this.emit("done", new Date().getTime() - this.start);
-}
-
-Suite.prototype.emit = function(type) {
- var event = this.options[type];
- if (event) {
- event.apply(this, Array.prototype.slice.call(arguments, 1));
- }
-}
-
-uubench.Suite = Suite;
-
-})(typeof exports !== 'undefined' ? exports : window.uubench = {});
http://git-wip-us.apache.org/repos/asf/cordova-windows/blob/be415141/windows8/test/camera/index.html
----------------------------------------------------------------------
diff --git a/windows8/test/camera/index.html b/windows8/test/camera/index.html
deleted file mode 100644
index b9031b5..0000000
--- a/windows8/test/camera/index.html
+++ /dev/null
@@ -1,392 +0,0 @@
-<!DOCTYPE html>
-<!--
-
- Licensed to the Apache Software Foundation (ASF) under one
- or more contributor license agreements. See the NOTICE file
- distributed with this work for additional information
- regarding copyright ownership. The ASF licenses this file
- to you under the Apache License, Version 2.0 (the
- "License"); you may not use this file except in compliance
- with the License. You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing,
- software distributed under the License is distributed on an
- "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- KIND, either express or implied. See the License for the
- specific language governing permissions and limitations
- under the License.
-
--->
-
-
-<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-incl.js"></script>
-
-
-<script type="text/javascript" charset="utf-8">
-
- var deviceReady = false;
- var platformId = cordova.require('cordova/platform').id;
- var CameraPopoverOptions = cordova.require('cordova/plugin/CameraPopoverOptions');
- var pictureUrl = null;
- var fileObj = null;
- var fileEntry = null;
- var pageStartTime = +new Date();
-
- //default camera options
- var camQualityDefault = ['quality value', 50];
- var camDestinationTypeDefault = ['FILE_URI', 1];
- var camPictureSourceTypeDefault = ['CAMERA', 1];
- var camAllowEditDefault = ['allowEdit', false];
- var camEncodingTypeDefault = ['JPEG', 0];
- var camMediaTypeDefault = ['mediaType', 0];
- var camCorrectOrientationDefault = ['correctOrientation', false];
- var camSaveToPhotoAlbumDefault = ['saveToPhotoAlbum', true];
-
-
- //-------------------------------------------------------------------------
- // Camera
- //-------------------------------------------------------------------------
-
- function log(value) {
- console.log(value);
- document.getElementById('camera_status').textContent += (new Date() - pageStartTime) / 1000 + ': ' + value + '\n';
- }
-
- function clearStatus() {
- document.getElementById('camera_status').innerHTML = '';
- document.getElementById('camera_image').src = 'about:blank';
- var canvas = document.getElementById('canvas');
- canvas.width = canvas.height = 1;
- pictureUrl = null;
- fileObj = null;
- fileEntry = null;
- }
-
- function setPicture(url, callback) {
- try {
- window.atob(url);
- // if we got here it is a base64 string (DATA_URL)
- url = "data:image/jpeg;base64," + url;
- } catch (e) {
- // not DATA_URL
- log('URL: ' + url.slice(0, 100));
- }
-
- pictureUrl = url;
- var img = document.getElementById('camera_image');
- var startTime = new Date();
- img.src = url;
- img.onloadend = function() {
- log('Image tag load time: ' + (new Date() - startTime));
- callback && callback();
- };
- }
-
- function onGetPictureError(e) {
- log('Error getting picture: ' + e.code);
- }
-
- function getPictureWin(data) {
- setPicture(data);
- // TODO: Fix resolveLocalFileSystemURI to work with native-uri.
- if (pictureUrl.indexOf('file:') == 0) {
- resolveLocalFileSystemURI(data, function(e) {
- fileEntry = e;
- logCallback('resolveLocalFileSystemURI()', true)(e);
- }, logCallback('resolveLocalFileSystemURI()', false));
- } else if (pictureUrl.indexOf('data:image/jpeg;base64' == 0)) {
- // do nothing
- } else {
- var path = pictureUrl.replace(/^file:\/\/(localhost)?/, '').replace(/%20/g, ' ');
- fileEntry = new FileEntry('image_name.png', path);
- }
- }
-
- function getPicture() {
- clearStatus();
- var options = extractOptions();
- log('Getting picture with options: ' + JSON.stringify(options));
- var popoverHandle = navigator.camera.getPicture(getPictureWin, onGetPictureError, options);
-
- // Reposition the popover if the orientation changes.
- window.onorientationchange = function() {
- var newPopoverOptions = new CameraPopoverOptions(0, 0, 100, 100, 0);
- popoverHandle.setPosition(newPopoverOptions);
- }
- }
-
- function uploadImage() {
- var ft = new FileTransfer(),
- uploadcomplete=0,
- progress = 0,
- options = new FileUploadOptions();
- options.fileKey="photo";
- options.fileName='test.jpg';
- options.mimeType="image/jpeg";
- ft.onprogress = function(progressEvent) {
- log('progress: ' + progressEvent.loaded + ' of ' + progressEvent.total);
- };
- var server = "http://cordova-filetransfer.jitsu.com";
-
- ft.upload(pictureUrl, server + '/upload', win, fail, options);
- function win(information_back){
- log('upload complete');
- }
- function fail(message) {
- log('upload failed: ' + JSON.stringify(message));
- }
- }
-
- function logCallback(apiName, success) {
- return function() {
- log('Call to ' + apiName + (success ? ' success: ' : ' failed: ') + JSON.stringify([].slice.call(arguments)));
- };
- }
-
- /**
- * Select image from library using a NATIVE_URI destination type
- * This calls FileEntry.getMetadata, FileEntry.setMetadata, FileEntry.getParent, FileEntry.file, and FileReader.readAsDataURL.
- */
- function readFile() {
- function onFileReadAsDataURL(evt) {
- var img = document.getElementById('camera_image');
- img.style.visibility = "visible";
- img.style.display = "block";
- img.src = evt.target.result;
- log("FileReader.readAsDataURL success");
- };
-
- function onFileReceived(file) {
- log('Got file: ' + JSON.stringify(file));
- fileObj = file;
-
- var reader = new FileReader();
- reader.onload = function() {
- log('FileReader.readAsDataURL() - length = ' + reader.result.length);
- };
- reader.onerror = logCallback('FileReader.readAsDataURL', false);
- reader.readAsDataURL(file);
- };
- // Test out onFileReceived when the file object was set via a native <input> elements.
- if (fileObj) {
- onFileReceived(fileObj);
- } else {
- fileEntry.file(onFileReceived, logCallback('FileEntry.file', false));
- }
- }
- function getFileInfo() {
- // Test FileEntry API here.
- fileEntry.getMetadata(logCallback('FileEntry.getMetadata', true), logCallback('FileEntry.getMetadata', false));
- fileEntry.setMetadata(logCallback('FileEntry.setMetadata', true), logCallback('FileEntry.setMetadata', false), { "com.apple.MobileBackup": 1 });
- fileEntry.getParent(logCallback('FileEntry.getParent', true), logCallback('FileEntry.getParent', false));
- fileEntry.getParent(logCallback('FileEntry.getParent', true), logCallback('FileEntry.getParent', false));
- };
-
- /**
- * Copy image from library using a NATIVE_URI destination type
- * This calls FileEntry.copyTo and FileEntry.moveTo.
- */
- function copyImage() {
- var onFileSystemReceived = function(fileSystem) {
- var destDirEntry = fileSystem.root;
-
- // Test FileEntry API here.
- fileEntry.copyTo(destDirEntry, 'copied_file.png', logCallback('FileEntry.copyTo', true), logCallback('FileEntry.copyTo', false));
- fileEntry.moveTo(destDirEntry, 'moved_file.png', logCallback('FileEntry.moveTo', true), logCallback('FileEntry.moveTo', false));
- };
-
- window.requestFileSystem(LocalFileSystem.TEMPORARY, 0, onFileSystemReceived, null);
- };
-
- /**
- * Write image to library using a NATIVE_URI destination type
- * This calls FileEntry.createWriter, FileWriter.write, and FileWriter.truncate.
- */
- function writeImage() {
- var onFileWriterReceived = function(fileWriter) {
- fileWriter.onwrite = logCallback('FileWriter.write', true);
- fileWriter.onerror = logCallback('FileWriter.write', false);
- fileWriter.write("some text!");
- };
-
- var onFileTruncateWriterReceived = function(fileWriter) {
- fileWriter.onwrite = logCallback('FileWriter.truncate', true);
- fileWriter.onerror = logCallback('FileWriter.truncate', false);
- fileWriter.truncate(10);
- };
-
- fileEntry.createWriter(onFileWriterReceived, logCallback('FileEntry.createWriter', false));
- fileEntry.createWriter(onFileTruncateWriterReceived, null);
- };
-
- function displayImageUsingCanvas() {
- var canvas = document.getElementById('canvas');
- var img = document.getElementById('camera_image');
- var w = img.width;
- var h = img.height;
- h = 100 / w * h;
- w = 100;
- canvas.width = w;
- canvas.height= h;
- var context = canvas.getContext('2d');
- context.drawImage(img, 0, 0, w, h);
- };
-
- /**
- * Remove image from library using a NATIVE_URI destination type
- * This calls FileEntry.remove.
- */
- function removeImage() {
- fileEntry.remove(logCallback('FileEntry.remove', true), logCallback('FileEntry.remove', false));
- };
-
- function testInputTag(inputEl) {
- clearStatus();
- // iOS 6 likes to dead-lock in the onchange context if you
- // do any alerts or try to remote-debug.
- window.setTimeout(function() {
- testNativeFile2(inputEl);
- }, 0);
- };
-
- function testNativeFile2(inputEl) {
- if (!inputEl.value) {
- alert('No file selected.');
- return;
- }
- fileObj = inputEl.files[0];
- if (!fileObj) {
- alert('Got value but no file.');
- return;
- }
- var URLApi = window.URL || window.webkitURL;
- if (URLApi) {
- var blobURL = URLApi.createObjectURL(fileObj);
- if (blobURL) {
- setPicture(blobURL, function() {
- URLApi.revokeObjectURL(blobURL);
- });
- } else {
- log('URL.createObjectURL returned null');
- }
- } else {
- log('URL.createObjectURL() not supported.');
- }
- }
-
- function extractOptions() {
- var els = document.querySelectorAll('#image-options select');
- var ret = {};
- for (var i = 0, el; el = els[i]; ++i) {
- var value = el.value;
- if (value === '') continue;
- if (el.isBool) {
- ret[el.keyName] = !!value;
- } else {
- ret[el.keyName] = +value;
- }
- }
- return ret;
- }
-
- function createOptionsEl(name, values, selectionDefault) {
- var container = document.createElement('div');
- container.style.display = 'inline-block';
- container.appendChild(document.createTextNode(name + ': '));
- var select = document.createElement('select');
- select.keyName = name;
- container.appendChild(select);
-
- // if we didn't get a default value, insert the blank <default> entry
- if (selectionDefault == undefined) {
- var opt = document.createElement('option');
- opt.value = '';
- opt.text = '<default>';
- select.appendChild(opt);
- }
-
- select.isBool = typeof values == 'boolean';
- if (select.isBool) {
- values = {'true': 1, 'false': 0};
- }
-
- for (var k in values) {
- var opt = document.createElement('option');
- opt.value = values[k];
- opt.textContent = k;
- if (selectionDefault) {
- if (selectionDefault[0] == k) {
- opt.selected = true;
- }
- }
- select.appendChild(opt);
- }
- var optionsDiv = document.getElementById('image-options');
- optionsDiv.appendChild(container);
- }
-
- /**
- * Function called when page has finished loading.
- */
- function init() {
- document.addEventListener("deviceready", function() {
- deviceReady = true;
- console.log("Device="+device.platform+" "+device.version);
- createOptionsEl('sourceType', Camera.PictureSourceType, camPictureSourceTypeDefault);
- createOptionsEl('destinationType', Camera.DestinationType, camDestinationTypeDefault);
- createOptionsEl('encodingType', Camera.EncodingType, camEncodingTypeDefault);
- createOptionsEl('mediaType', Camera.MediaType, camMediaTypeDefault);
- createOptionsEl('quality', {'0': 0, '50': 50, '80': 80, '100': 100}, camQualityDefault);
- createOptionsEl('targetWidth', {'50': 50, '200': 200, '800': 800, '2048': 2048});
- createOptionsEl('targetHeight', {'50': 50, '200': 200, '800': 800, '2048': 2048});
- createOptionsEl('allowEdit', true, camAllowEditDefault);
- createOptionsEl('correctOrientation', true, camCorrectOrientationDefault);
- createOptionsEl('saveToPhotoAlbum', true, camSaveToPhotoAlbumDefault);
- createOptionsEl('cameraDirection', Camera.Direction);
-
- }, false);
- window.setTimeout(function() {
- if (!deviceReady) {
- alert("Error: Apache Cordova did not initialize. Demo will not run correctly.");
- }
- },1000);
- };
-
-</script>
-
- </head>
- <body onload="init();" id="stage" class="theme">
-
- <h1>Camera</h1>
- <div id="info" style="white-space: pre-wrap">
- <b>Status:</b> <div id="camera_status"></div>
- img: <img width="100" id="camera_image">
- canvas: <canvas id="canvas" width="1" height="1"></canvas>
- </div>
- <h2>Cordova Camera API</h2>
- <div id="image-options"></div>
- <div class="btn large" onclick="getPicture();">camera.getPicture()</div>
- <h2>Native File Inputs</h2>
- <div>input type=file <input type="file" onchange="testInputTag(this)"></div>
- <div>capture=camera <input type="file" accept="image/*;capture=camera" onchange="testInputTag(this)"></div>
- <div>capture=camcorder <input type="file" accept="video/*;capture=camcorder" onchange="testInputTag(this)"></div>
- <div>capture=microphone <input type="file" accept="audio/*;capture=microphone" onchange="testInputTag(this)"></div>
- <h2>Actions</h2>
- <div class="btn large" onclick="getFileInfo();">Get File Metadata</div>
- <div class="btn large" onclick="readFile();">Read with FileReader</div>
- <div class="btn large" onclick="copyImage();">Copy Image</div>
- <div class="btn large" onclick="writeImage();">Write Image</div>
- <div class="btn large" onclick="uploadImage();">Upload Image</div>
- <div class="btn large" onclick="displayImageUsingCanvas();">Draw Using Canvas</div>
- <div class="btn large" onclick="removeImage();">Remove Image</div>
- <h2> </h2><div class="backBtn" onclick="backHome();">Back</div>
- </body>
-</html>
http://git-wip-us.apache.org/repos/asf/cordova-windows/blob/be415141/windows8/test/compass/index.html
----------------------------------------------------------------------
diff --git a/windows8/test/compass/index.html b/windows8/test/compass/index.html
deleted file mode 100644
index 4d6af2c..0000000
--- a/windows8/test/compass/index.html
+++ /dev/null
@@ -1,150 +0,0 @@
-<!DOCTYPE html>
-<!--
-
- Licensed to the Apache Software Foundation (ASF) under one
- or more contributor license agreements. See the NOTICE file
- distributed with this work for additional information
- regarding copyright ownership. The ASF licenses this file
- to you under the Apache License, Version 2.0 (the
- "License"); you may not use this file except in compliance
- with the License. You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing,
- software distributed under the License is distributed on an
- "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- KIND, either express or implied. See the License for the
- specific language governing permissions and limitations
- under the License.
-
--->
-
-
-<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-incl.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: Apache Cordova 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/cordova-windows/blob/be415141/windows8/test/contacts/index.html
----------------------------------------------------------------------
diff --git a/windows8/test/contacts/index.html b/windows8/test/contacts/index.html
deleted file mode 100644
index b6a3a92..0000000
--- a/windows8/test/contacts/index.html
+++ /dev/null
@@ -1,134 +0,0 @@
-<!DOCTYPE html>
-<!--
-
- Licensed to the Apache Software Foundation (ASF) under one
- or more contributor license agreements. See the NOTICE file
- distributed with this work for additional information
- regarding copyright ownership. The ASF licenses this file
- to you under the Apache License, Version 2.0 (the
- "License"); you may not use this file except in compliance
- with the License. You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing,
- software distributed under the License is distributed on an
- "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- KIND, either express or implied. See the License for the
- specific language governing permissions and limitations
- under the License.
-
--->
-
-
-<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-incl.js"></script>
-
-
-<script type="text/javascript" charset="utf-8">
-
- var deviceReady = false;
-
- //-------------------------------------------------------------------------
- // Contacts
- //-------------------------------------------------------------------------
- function getContacts() {
- obj = new ContactFindOptions();
- // show all contacts, so don't filter
- 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: Apache Cordova 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/cordova-windows/blob/be415141/windows8/test/cordova-incl.js
----------------------------------------------------------------------
diff --git a/windows8/test/cordova-incl.js b/windows8/test/cordova-incl.js
deleted file mode 100644
index 9c2c545..0000000
--- a/windows8/test/cordova-incl.js
+++ /dev/null
@@ -1,85 +0,0 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
-*/
-
-var PLAT;
-(function getPlatform() {
- var platforms = {
- android: /Android/,
- ios: /(iPad)|(iPhone)|(iPod)/,
- blackberry10: /(BB10)/,
- blackberry: /(PlayBook)|(BlackBerry)/,
- windows8: /MSAppHost/,
- windowsphone: /Windows Phone/
- };
- for (var key in platforms) {
- if (platforms[key].exec(navigator.userAgent)) {
- PLAT = key;
- break;
- }
- }
-})();
-
-var scripts = document.getElementsByTagName('script');
-var currentPath = scripts[scripts.length - 1].src;
-var platformCordovaPath = currentPath.replace("cordova-incl.js", "cordova." + PLAT + ".js");
-var normalCordovaPath = currentPath.replace("cordova-incl.js", "cordova.js");
-var cordovaPath = normalCordovaPath;
-
-if (PLAT) {
- // XHR to local file is an error on some platforms, windowsphone for one
- try {
- var xhr = new XMLHttpRequest();
- xhr.open("GET", platformCordovaPath, false);
- xhr.onreadystatechange = function() {
-
- if (this.readyState == this.DONE && this.responseText.length > 0) {
- if(parseInt(this.status) >= 400){
- cordovaPath = normalCordovaPath;
- }else{
- cordovaPath = platformCordovaPath;
- }
- }
- };
- xhr.send(null);
- }
- catch(e){
- cordovaPath = normalCordovaPath;
- } // access denied!
-}
-
-if (!window._doNotWriteCordovaScript) {
- if (PLAT != "windows8") {
- document.write('<script type="text/javascript" charset="utf-8" src="' + cordovaPath + '"></script>');
- } else {
- var s = document.createElement('script');
- s.src = cordovaPath;
- document.head.appendChild(s);
- }
-}
-
-function backHome() {
- if (window.device && device.platform && device.platform.toLowerCase() == 'android') {
- navigator.app.backHistory();
- }
- else {
- window.history.go(-1);
- }
-}