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 2014/08/07 02:53:19 UTC
[01/32] spec commit: CB-6957 Removed battery-status tests
Repository: cordova-mobile-spec
Updated Branches:
refs/heads/master be7d415a0 -> 3444067f1
CB-6957 Removed battery-status tests
Project: http://git-wip-us.apache.org/repos/asf/cordova-mobile-spec/repo
Commit: http://git-wip-us.apache.org/repos/asf/cordova-mobile-spec/commit/df403a21
Tree: http://git-wip-us.apache.org/repos/asf/cordova-mobile-spec/tree/df403a21
Diff: http://git-wip-us.apache.org/repos/asf/cordova-mobile-spec/diff/df403a21
Branch: refs/heads/master
Commit: df403a2144acd31f46cdfb6693f20b53707b51b0
Parents: 647bdb1
Author: Martin Gonzalez <ma...@gmail.com>
Authored: Fri Aug 1 02:14:38 2014 -0500
Committer: Martin Gonzalez <ma...@gmail.com>
Committed: Fri Aug 1 02:14:38 2014 -0500
----------------------------------------------------------------------
www/autotest/index.html | 1 -
www/autotest/pages/all.html | 1 -
www/autotest/pages/battery.html | 51 ---------
www/autotest/tests/battery.tests.js | 187 -------------------------------
www/capture/index.html | 52 ---------
www/capture/index.js | 137 ----------------------
www/index.html | 1 -
7 files changed, 430 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cordova-mobile-spec/blob/df403a21/www/autotest/index.html
----------------------------------------------------------------------
diff --git a/www/autotest/index.html b/www/autotest/index.html
index fe1dd91..4394608 100644
--- a/www/autotest/index.html
+++ b/www/autotest/index.html
@@ -37,7 +37,6 @@
<a href="pages/all.html" class="btn large" style="width:100%;">Run All Tests</a>
<a href="pages/accelerometer.html" class="btn large" style="width:100%;">Run Accelerometer Tests</a>
- <a href="pages/battery.html" class="btn large" style="width:100%;">Run Battery Tests</a>
<a href="pages/camera.html" class="btn large" style="width:100%;">Run Camera Tests</a>
<a href="pages/capture.html" class="btn large" style="width:100%;">Run Capture Tests</a>
<a href="pages/compass.html" class="btn large" style="width:100%;">Run Compass Tests</a>
http://git-wip-us.apache.org/repos/asf/cordova-mobile-spec/blob/df403a21/www/autotest/pages/all.html
----------------------------------------------------------------------
diff --git a/www/autotest/pages/all.html b/www/autotest/pages/all.html
index 9ee9180..eef47cc 100644
--- a/www/autotest/pages/all.html
+++ b/www/autotest/pages/all.html
@@ -46,7 +46,6 @@
<!-- Tests -->
<script type="text/javascript" src="../tests/accelerometer.tests.js"></script>
<script type="text/javascript" src="../tests/battery.tests.js"></script>
- <script type="text/javascript" src="../tests/bridge.tests.js"></script>
<script type="text/javascript" src="../tests/capture.tests.js"></script>
<script type="text/javascript" src="../tests/compass.tests.js"></script>
<script type="text/javascript" src="../tests/contacts.tests.js"></script>
http://git-wip-us.apache.org/repos/asf/cordova-mobile-spec/blob/df403a21/www/autotest/pages/battery.html
----------------------------------------------------------------------
diff --git a/www/autotest/pages/battery.html b/www/autotest/pages/battery.html
deleted file mode 100644
index 2063417..0000000
--- a/www/autotest/pages/battery.html
+++ /dev/null
@@ -1,51 +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>
- <title>Cordova: Battery API Specs</title>
-
- <meta name="viewport" content="width=device-width, height=device-height, user-scalable=yes, initial-scale=1.0;" />
-
- <link href="../jasmine.css" rel="stylesheet"/>
- <script type="text/javascript" src="../jasmine.js"></script>
- <script type="text/javascript" src="../html/HtmlReporterHelpers.js"></script>
- <script type="text/javascript" src="../html/HtmlReporter.js"></script>
- <script type="text/javascript" src="../html/ReporterView.js"></script>
- <script type="text/javascript" src="../html/SpecView.js"></script>
- <script type="text/javascript" src="../html/SuiteView.js"></script>
- <script type="text/javascript" src="../html/TrivialReporter.js"></script>
- <script type="text/javascript" src="../../cordova-incl.js"></script>
-
- <!-- Load Test Runner -->
- <script type="text/javascript" src="../test-runner.js"></script>
-
- <!-- Tests -->
- <script type="text/javascript" src="../tests/battery.tests.js"></script>
- <script type="text/javascript" charset="utf-8" src="./run-tests.js"></script>
-</head>
-
-<body>
- <a class="backBtn">Back</a>
-</body>
-</html>
http://git-wip-us.apache.org/repos/asf/cordova-mobile-spec/blob/df403a21/www/autotest/tests/battery.tests.js
----------------------------------------------------------------------
diff --git a/www/autotest/tests/battery.tests.js b/www/autotest/tests/battery.tests.js
deleted file mode 100644
index 47a86d4..0000000
--- a/www/autotest/tests/battery.tests.js
+++ /dev/null
@@ -1,187 +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('Battery (navigator.battery)', function () {
-
- // used to keep the count of event listeners > 0, in order to avoid battery level being updated with the real value when adding the first listener during test cases
- var dummyOnEvent = jasmine.createSpy();
- beforeEach(function () {
- window.addEventListener("batterycritical", dummyOnEvent, false);
- });
-
- afterEach(function () {
- window.removeEventListener("batterystatus", dummyOnEvent, false);
- });
-
-
- it("battery.spec.1 should exist", function() {
- expect(navigator.battery).toBeDefined();
- });
-
- it("battery.spec.2 should fire batterystatus events", function () {
-
- // batterystatus
- var onEvent;
-
- runs(function () {
- onEvent = jasmine.createSpy().andCallFake(function () {
- window.removeEventListener("batterystatus", onEvent, false);
- });
- window.addEventListener("batterystatus", onEvent, false);
- navigator.battery._status({ level: 30, isPlugged: false });
- });
- waitsFor(function () { return onEvent.wasCalled; }, "batterystatus onEvent was not called", 100);
- runs(function () {
- expect(onEvent).toHaveBeenCalled();
- });
-
- });
-
- it("battery.spec.3 should fire batterylow events", function () {
-
- var onEvent;
-
- // batterylow 30 -> 20
- runs(function () {
- onEvent = jasmine.createSpy().andCallFake(function () {
- //console.log("batterylow fake callback called");
- window.removeEventListener("batterylow", onEvent, false);
- });
- window.addEventListener("batterylow", onEvent, false);
- navigator.battery._status({ level: 20, isPlugged: false });
- });
- waitsFor(function () { return onEvent.wasCalled; }, "batterylow onEvent was not called when level goes from 30->20", 100);
- runs(function () {
- expect(onEvent).toHaveBeenCalled();
- });
-
- // batterylow 30 -> 19
- runs(function () {
- onEvent = jasmine.createSpy().andCallFake(function () {
- //console.log("batterylow fake callback called");
- window.removeEventListener("batterylow", onEvent, false);
- });
- navigator.battery._status({ level: 30, isPlugged: false });
- window.addEventListener("batterylow", onEvent, false);
- navigator.battery._status({ level: 19, isPlugged: false });
- });
- waitsFor(function () { return onEvent.wasCalled; }, "batterylow onEvent was not called when level goes from 30->19", 100);
- runs(function () {
- expect(onEvent).toHaveBeenCalled();
- });
-
- });
-
- it("battery.spec.4 should fire batterycritical events", function () {
-
- var onEvent;
-
- // batterycritical 19->5
- runs(function () {
- onEvent = jasmine.createSpy().andCallFake(function () {
- window.removeEventListener("batterycritical", onEvent, false);
- });
- window.addEventListener("batterycritical", onEvent, false);
- navigator.battery._status({ level: 5, isPlugged: false });
- });
- waitsFor(function () { return onEvent.wasCalled; }, "batterycritical onEvent was not called when level goes from 19->5", 100);
- runs(function () {
- expect(onEvent).toHaveBeenCalled();
- });
-
- // batterycritical 19->4
- runs(function () {
- onEvent = jasmine.createSpy().andCallFake(function () {
- window.removeEventListener("batterycritical", onEvent, false);
- });
- navigator.battery._status({ level: 19, isPlugged: false });
- window.addEventListener("batterycritical", onEvent, false);
- navigator.battery._status({ level: 4, isPlugged: false });
- });
- waitsFor(function () { return onEvent.wasCalled; }, "batterycritical onEvent was not called when level goes from 19->4", 100);
- runs(function () {
- expect(onEvent).toHaveBeenCalled();
- });
- });
-
- it("battery.spec.5 should NOT fire events when charging or level is increasing", function () {
- var onEvent;
- // setup: batterycritical should fire when level decreases (100->4) ( CB-4519 )
- runs(function () {
- onEvent = jasmine.createSpy("onbatterycritical");
- navigator.battery._status({ level: 100, isPlugged: false });
- window.addEventListener("batterycritical", onEvent, false);
- navigator.battery._status({ level: 4, isPlugged: false });
- });
- waits(100);
- runs(function () {
- expect(onEvent).toHaveBeenCalled();
- });
-
- // batterycritical should not fire when level increases (4->5)( CB-4519 )
- runs(function () {
- onEvent = jasmine.createSpy("onbatterycritical");
- navigator.battery._status({ level: 4, isPlugged: false });
- window.addEventListener("batterycritical", onEvent, false);
- navigator.battery._status({ level: 5, isPlugged: false });
- });
- waits(100);
- runs(function () {
- expect(onEvent).not.toHaveBeenCalled();
- });
- // batterylow should not fire when level increases (5->20) ( CB-4519 )
- runs(function () {
- onEvent = jasmine.createSpy("onbatterylow");
- window.addEventListener("batterylow", onEvent, false);
- navigator.battery._status({ level: 20, isPlugged: false });
- });
- waits(100);
- runs(function () {
- expect(onEvent).not.toHaveBeenCalled();
- });
-
- // batterylow should NOT fire if we are charging ( CB-4520 )
- runs(function () {
- onEvent = jasmine.createSpy("onbatterylow");
- navigator.battery._status({ level: 21, isPlugged: true });
- window.addEventListener("batterylow", onEvent, false);
- navigator.battery._status({ level: 20, isPlugged: true });
- });
- waits(100);
- runs(function () {
- expect(onEvent).not.toHaveBeenCalled();
- });
-
- // batterycritical should NOT fire if we are charging ( CB-4520 )
- runs(function () {
- onEvent = jasmine.createSpy("onbatterycritical");
- navigator.battery._status({ level: 6, isPlugged: true });
- window.addEventListener("batterycritical", onEvent, false);
- navigator.battery._status({ level: 5, isPlugged: true });
-
- });
- waits(100);
- runs(function () {
- expect(onEvent).not.toHaveBeenCalled();
- });
- });
-
-});
http://git-wip-us.apache.org/repos/asf/cordova-mobile-spec/blob/df403a21/www/capture/index.html
----------------------------------------------------------------------
diff --git a/www/capture/index.html b/www/capture/index.html
deleted file mode 100644
index 9543341..0000000
--- a/www/capture/index.html
+++ /dev/null
@@ -1,52 +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="./index.js"></script>
- </head>
- <body id="stage" class="theme">
-
- <h1>Capture</h1>
- <div id="info" style="white-space: pre-wrap">
- <b>Status:</b> <div id="camera_status"></div>
- img: <img width="100" id="camera_image">
- video: <div id="video_container"></div>
- </div>
-
- <h2>Cordova Capture API</h2>
- <div id="image-options"></div>
-
- <h2>Actions</h2>
- <div class="btn large getAudio">Capture 10 secs of audio and play</div>
- <div class="btn large getImage">Capture 1 image</div>
- <div class="btn large getVideo">Capture 10 secs of video</div>
- <div class="btn large resolveVideo">Capture 5 secs of video and resolve</div>
- <h2> </h2><div class="backBtn">Back</div>
- </body>
-</html>
http://git-wip-us.apache.org/repos/asf/cordova-mobile-spec/blob/df403a21/www/capture/index.js
----------------------------------------------------------------------
diff --git a/www/capture/index.js b/www/capture/index.js
deleted file mode 100644
index 0f98549..0000000
--- a/www/capture/index.js
+++ /dev/null
@@ -1,137 +0,0 @@
-var deviceReady = false;
-var platformId = cordova.require('cordova/platform').id;
-var pageStartTime = +new Date();
-
-//-------------------------------------------------------------------------
-// Camera
-//-------------------------------------------------------------------------
-
-function log(value) {
- console.log(value);
- document.getElementById('camera_status').textContent += (new Date() - pageStartTime) / 1000 + ': ' + value + '\n';
-}
-
-function captureAudioWin(mediaFiles){
- var path = mediaFiles[0].fullPath;
- log('Audio captured: ' + path);
- var m = new Media(path);
- m.play();
-}
-
-function captureAudioFail(e){
- log('Error getting audio: ' + e.code);
-}
-
-function getAudio(){
- clearStatus();
- var options = { limit: 1, duration: 10};
- navigator.device.capture.captureAudio(captureAudioWin, captureAudioFail, options);
-}
-
-function captureImageWin(mediaFiles){
- var path = mediaFiles[0].fullPath;
- log('Image captured: ' + path);
- document.getElementById('camera_image').src = path;
-}
-
-function captureImageFail(e){
- log('Error getting image: ' + e.code);
-}
-
-function getImage(){
- clearStatus();
- var options = { limit: 1 };
- navigator.device.capture.captureImage(captureImageWin, captureImageFail, options);
-}
-
-function captureVideoWin(mediaFiles){
- var path = mediaFiles[0].fullPath;
- log('Video captured: ' + path);
-
- // need to inject the video element into the html
- // doesn't seem to work if you have a pre-existing video element and
- // add in a source tag
- var vid = document.createElement('video');
- vid.id="theVideo";
- vid.width = "320";
- vid.height= "240";
- vid.controls = "true";
- var source_vid = document.createElement('source');
- source_vid.id = "theSource";
- source_vid.src = path;
- vid.appendChild(source_vid);
- document.getElementById('video_container').appendChild(vid);
-}
-
-function captureVideoFail(e){
- log('Error getting video: ' + e.code);
-}
-
-function getVideo(){
- clearStatus();
- var options = { limit: 1, duration: 10 };
- navigator.device.capture.captureVideo(captureVideoWin, captureVideoFail, options);
-}
-
-function resolveMediaFileURL(mediaFile, callback) {
- resolveLocalFileSystemURL(mediaFile.localURL, function(entry) {
- log("Resolved by URL: " + mediaFile.localURL);
- if (callback) callback();
- }, function(err) {
- log("Failed to resolve by URL: " + mediaFile.localURL);
- log("Error: " + JSON.stringify(err));
- if (callback) callback();
- });
-}
-
-function resolveMediaFile(mediaFile, callback) {
- resolveLocalFileSystemURL(mediaFile.fullPath, function(entry) {
- log("Resolved by path: " + mediaFile.fullPath);
- if (callback) callback();
- }, function(err) {
- log("Failed to resolve by path: " + mediaFile.fullPath);
- log("Error: " + JSON.stringify(err));
- if (callback) callback();
- });
-}
-
-function resolveVideo() {
- clearStatus();
- var options = { limit: 1, duration: 5 };
- navigator.device.capture.captureVideo(function(mediaFiles) {
- captureVideoWin(mediaFiles);
- resolveMediaFile(mediaFiles[0], function() {
- resolveMediaFileURL(mediaFiles[0]);
- });
- }, captureVideoFail, options);
-}
-
-function clearStatus() {
- document.getElementById('camera_status').innerHTML = '';
- document.getElementById('camera_image').src = 'about:blank';
-}
-
-/**
- * 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);
-};
-
-
-window.onload = function() {
- addListenerToClass('getAudio', getAudio);
- addListenerToClass('getImage', getImage);
- addListenerToClass('getVideo', getVideo);
- addListenerToClass('resolveVideo', resolveVideo);
- addListenerToClass('backBtn', backHome);
- init();
-}
http://git-wip-us.apache.org/repos/asf/cordova-mobile-spec/blob/df403a21/www/index.html
----------------------------------------------------------------------
diff --git a/www/index.html b/www/index.html
index 39bc875..c8b9b97 100644
--- a/www/index.html
+++ b/www/index.html
@@ -45,7 +45,6 @@ User-Agent: <span id="user-agent"> </span></div>
<a href="autotest/index.html" class="btn large">Automatic Test</a>
<a href="accelerometer/index.html" class="btn large">Accelerometer</a>
<a href="audio/index.html" class="btn large">Audio Play/Record</a>
- <a href="battery/index.html" class="btn large">Battery</a>
<a href="camera/index.html" class="btn large">Camera</a>
<a href="capture/index.html" class="btn large">Capture</a>
<a href="compass/index.html" class="btn large">Compass</a>
[02/32] CB-7094 Removed old file tests
Posted by pu...@apache.org.
http://git-wip-us.apache.org/repos/asf/cordova-mobile-spec/blob/3920e204/www/file/index.html
----------------------------------------------------------------------
diff --git a/www/file/index.html b/www/file/index.html
deleted file mode 100644
index 11f7997..0000000
--- a/www/file/index.html
+++ /dev/null
@@ -1,73 +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="./index.js"></script>
-
- </head>
- <body id="stage" class="theme">
-
- <h1>File and File Transfer</h1>
- <h2>File</h2>
- <div class="btn large" id="downloadImgCDV">Download and display img (cdvfile)</div>
- <div class="btn large" id="downloadImgNative">Download and display img (native)</div>
- <div class="btn large" id="downloadVideoCDV">Download and play video (cdvfile)</div>
- <div class="btn large" id="downloadVideoNative">Download and play video (native)</div>
- <div class="btn large" id="testNotModified">Handle 304 status code</div>
-
- <div class="ios platform">
- <h2>iOS Special URL handling</h2>
- <div class="btn large" id="testPrivateURL">Test /private/ URL (iOS)</div>
-
- <h2>iOS Extra File Systems</h2>
- <div class="btn large resolveFs" data-fsname="library">Resolve library FS</div>
- <div class="btn large resolveFs" data-fsname="library-nosync">Resolve library-nosync FS</div>
- <div class="btn large resolveFs" data-fsname="documents">Resolve documents FS</div>
- <div class="btn large resolveFs" data-fsname="documents-nosync">Resolve documents-nosync FS</div>
- <div class="btn large resolveFs" data-fsname="cache">Resolve cache FS</div>
- <div class="btn large resolveFs" data-fsname="bundle">Resolve bundle FS</div>
- <div class="btn large resolveFs" data-fsname="root">Resolve root FS</div>
- </div>
-
- <div class="android platform">
- <h2>Android Extra File Systems</h2>
- <div class="btn large resolveFs" data-fsname="files">Resolve files FS</div>
- <div class="btn large resolveFs" data-fsname="files-external">Resolve files-external FS</div>
- <div class="btn large resolveFs" data-fsname="documents">Resolve documents FS</div>
- <div class="btn large resolveFs" data-fsname="sdcard">Resolve sdcard FS</div>
- <div class="btn large resolveFs" data-fsname="cache">Resolve cache FS</div>
- <div class="btn large resolveFs" data-fsname="cache-external">Resolve cache-external FS</div>
- <div class="btn large resolveFs" data-fsname="root">Resolve root FS</div>
- </div>
-
- <div id="log"></div>
- <div id="output"></div>
- <h2> </h2><div class="backBtn">Back</div>
- </body>
-</html>
http://git-wip-us.apache.org/repos/asf/cordova-mobile-spec/blob/3920e204/www/file/index.js
----------------------------------------------------------------------
diff --git a/www/file/index.js b/www/file/index.js
deleted file mode 100644
index 4bdf045..0000000
--- a/www/file/index.js
+++ /dev/null
@@ -1,171 +0,0 @@
-var deviceReady = false;
-
-var imageURL = "http://apache.org/images/feather-small.gif";
-var videoURL = "http://techslides.com/demos/sample-videos/small.mp4";
-
-/**
- * Function called when page has finished loading.
- */
-function init() {
- document.addEventListener("deviceready", function() {
- deviceReady = true;
- console.log("Device="+device.platform+" "+device.version);
- bindEvents();
- document.body.classList.add(device.platform.toLowerCase() + "-platform");
- }, false);
- window.setTimeout(function() {
- if (!deviceReady) {
- alert("Error: Apache Cordova did not initialize. Demo will not run correctly.");
- }
- },1000);
-}
-
-function bindEvents() {
- document.getElementById('downloadImgCDV').addEventListener('click', downloadImgCDV, false);
- document.getElementById('downloadImgNative').addEventListener('click', downloadImgNative, false);
- document.getElementById('downloadVideoCDV').addEventListener('click', downloadVideoCDV, false);
- document.getElementById('downloadVideoNative').addEventListener('click', downloadVideoNative, false);
- document.getElementById('testPrivateURL').addEventListener('click', testPrivateURL, false);
- document.getElementById('testNotModified').addEventListener('click', testNotModified, false);
- var fsButtons = document.querySelectorAll('.resolveFs');
- for (var i=0; i < fsButtons.length; ++i) {
- fsButtons[i].addEventListener('click', resolveFs, false);
- }
-}
-
-function clearLog() {
- var log = document.getElementById("log");
- log.innerHTML = "";
-}
-
-function logMessage(message, color) {
- var log = document.getElementById("log");
- var logLine = document.createElement('div');
- if (color) {
- logLine.style.color = color;
- }
- logLine.innerHTML = message;
- log.appendChild(logLine);
-}
-
-function logError(serviceName) {
- return function(err) {
- logMessage("ERROR: " + serviceName + " " + JSON.stringify(err), "red");
- };
-}
-
-function downloadImgCDV(ev) {
- ev.preventDefault();
- ev.stopPropagation();
- downloadImg(imageURL, function(entry) { return entry.toURL(); }, new Image());
-}
-
-function downloadImgNative(ev) {
- ev.preventDefault();
- ev.stopPropagation();
- downloadImg(imageURL, function(entry) { return entry.toNativeURL(); }, new Image);
-}
-
-function downloadVideoCDV(ev) {
- ev.preventDefault();
- ev.stopPropagation();
- var videoElement = document.createElement('video');
- videoElement.controls = "controls";
- downloadImg(videoURL, function(entry) { return entry.toURL(); }, videoElement);
-}
-
-function downloadVideoNative(ev) {
- ev.preventDefault();
- ev.stopPropagation();
- var videoElement = document.createElement('video');
- videoElement.controls = "controls";
- downloadImg(videoURL, function(entry) { return entry.toNativeURL(); }, videoElement);
-}
-
-function testNotModified(ev) {
- ev.preventDefault();
- ev.stopPropagation();
- var ft = new FileTransfer();
- var lastModified = new Date();
- var headers = { "If-Modified-Since": lastModified.toUTCString()};
- logMessage("Starting cached download with headers: " + JSON.stringify(headers));
- ft.download(imageURL, "", logError("ft.download"),function (error) {
- if (error.code === 5) {
- logMessage("Success, the file was not modified.", "green");
- } else {
- logError("ft.download")("The error code was " + error.code + ": " + error.exception);
- }
-
- }, false, {headers: headers});
-}
-
-function downloadImg(source, urlFn, element) {
- var filename = source.substring(source.lastIndexOf("/")+1);
- function download(fileSystem) {
- var ft = new FileTransfer();
- logMessage("Starting download");
- ft.download(source, fileSystem.root.toURL() + filename, function(entry) {
- logMessage("Download complete")
- element.src = urlFn(entry)
- logMessage("Src URL is " + element.src, "green");
- logMessage("Inserting element");
- document.getElementById("output").appendChild(element);
- }, logError("ft.download"));
- }
- clearLog();
- logMessage("Requesting filesystem");
- requestFileSystem(TEMPORARY, 0, function(fileSystem) {
- logMessage("Checking for existing file");
- fileSystem.root.getFile(filename, {create: false}, function(entry) {
- logMessage("Removing existing file");
- entry.remove(function() {
- download(fileSystem);
- }, logError("entry.remove"));
- }, function() {
- download(fileSystem);
- });
- }, logError("requestFileSystem"));
-}
-
-function testPrivateURL(ev) {
- ev.preventDefault();
- ev.stopPropagation();
- requestFileSystem(TEMPORARY, 0, function(fileSystem) {
- logMessage("Temporary root is at " + fileSystem.root.toNativeURL());
- fileSystem.root.getFile("testfile", {create: true}, function(entry) {
- logMessage("Temporary file is at " + entry.toNativeURL());
- if (entry.toNativeURL().substring(0,12) == "file:///var/") {
- logMessage("File starts with /var/, trying /private/var");
- var newURL = "file://localhost/private/var/" + entry.toNativeURL().substring(12) + "?and=another_thing";
- //var newURL = entry.toNativeURL();
- logMessage(newURL, 'blue');
- resolveLocalFileSystemURL(newURL, function(newEntry) {
- logMessage("Successfully resolved.", 'green');
- logMessage(newEntry.toURL(), 'blue');
- logMessage(newEntry.toNativeURL(), 'blue');
- }, logError("resolveLocalFileSystemURL"));
- }
- }, logError("getFile"));
- }, logError("requestFileSystem"));
-}
-
-function resolveFs(ev) {
- var fsURL = "cdvfile://localhost/" + ev.target.getAttribute('data-fsname') + "/";
- logMessage("Resolving URL: " + fsURL);
- resolveLocalFileSystemURL(fsURL, function(entry) {
- logMessage("Success", 'green');
- logMessage(entry.toURL(), 'blue');
- logMessage(entry.toInternalURL(), 'blue');
- logMessage("Resolving URL: " + entry.toURL());
- resolveLocalFileSystemURL(entry.toURL(), function(entry2) {
- logMessage("Success", 'green');
- logMessage(entry2.toURL(), 'blue');
- logMessage(entry2.toInternalURL(), 'blue');
- }, logError("resolveLocalFileSystemURL"));
- }, logError("resolveLocalFileSystemURL"));
-}
-
-window.onload = function() {
- addListenerToClass('backBtn', backHome);
- init();
-}
[12/32] spec commit: CB-6960 removed compass tests
Posted by pu...@apache.org.
CB-6960 removed compass tests
Project: http://git-wip-us.apache.org/repos/asf/cordova-mobile-spec/repo
Commit: http://git-wip-us.apache.org/repos/asf/cordova-mobile-spec/commit/2d8de527
Tree: http://git-wip-us.apache.org/repos/asf/cordova-mobile-spec/tree/2d8de527
Diff: http://git-wip-us.apache.org/repos/asf/cordova-mobile-spec/diff/2d8de527
Branch: refs/heads/master
Commit: 2d8de527c97536f4b09d544c414b90c9e7ecd929
Parents: 647bdb1
Author: Staci Cooper <sm...@us.ibm.com>
Authored: Mon Aug 4 11:42:27 2014 -0400
Committer: Staci Cooper <sm...@us.ibm.com>
Committed: Mon Aug 4 11:42:27 2014 -0400
----------------------------------------------------------------------
www/autotest/pages/compass.html | 55 -------------
www/autotest/tests/compass.tests.js | 136 -------------------------------
www/compass/index.html | 48 -----------
www/compass/index.js | 104 -----------------------
4 files changed, 343 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cordova-mobile-spec/blob/2d8de527/www/autotest/pages/compass.html
----------------------------------------------------------------------
diff --git a/www/autotest/pages/compass.html b/www/autotest/pages/compass.html
deleted file mode 100644
index 80de16f..0000000
--- a/www/autotest/pages/compass.html
+++ /dev/null
@@ -1,55 +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>
- <title>Cordova: Compass API Specs</title>
-
- <meta name="viewport" content="width=device-width, height=device-height, user-scalable=yes, initial-scale=1.0;" />
- <!-- Load jasmine -->
- <link href="../jasmine.css" rel="stylesheet"/>
- <script type="text/javascript" src="../jasmine.js"></script>
- <script type="text/javascript" src="../html/HtmlReporterHelpers.js"></script>
- <script type="text/javascript" src="../html/HtmlReporter.js"></script>
- <script type="text/javascript" src="../html/ReporterView.js"></script>
- <script type="text/javascript" src="../html/SpecView.js"></script>
- <script type="text/javascript" src="../html/SuiteView.js"></script>
- <script type="text/javascript" src="../html/TrivialReporter.js"></script>
-
- <!-- Source -->
- <script type="text/javascript" src="../../cordova-incl.js"></script>
-
- <!-- Load Test Runner -->
- <script type="text/javascript" src="../test-runner.js"></script>
-
- <!-- Tests -->
- <script type="text/javascript" src="../tests/compass.tests.js"></script>
- <script type="text/javascript" charset="utf-8" src="./run-tests.js"></script>
-</head>
-
-<body>
- <a href="javascript:" class="backBtn">Back</a>
-</body>
-</html>
-
http://git-wip-us.apache.org/repos/asf/cordova-mobile-spec/blob/2d8de527/www/autotest/tests/compass.tests.js
----------------------------------------------------------------------
diff --git a/www/autotest/tests/compass.tests.js b/www/autotest/tests/compass.tests.js
deleted file mode 100644
index 332daea..0000000
--- a/www/autotest/tests/compass.tests.js
+++ /dev/null
@@ -1,136 +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('Compass (navigator.compass)', function () {
- var hardwarefailure = false;
- beforeEach(function() {
- this.addMatchers({
- // check to see if the device has a compass, if it doesn't fail gracefully
- hasHardware: function() {
- var toreturn = true;
-
- try{
- this.actual;
- toreturn = true;
- } catch (error){
- if (error.code == CompassError.COMPASS_NOT_SUPPORTED){
- hardwarefailure = true;
- toreturn = false;
- }
- }
- this.message = function () {
- return "The device does not have compass support. The remaining compass tests will be ignored.";
- }
-
- return toreturn;
- }
- });
- });
-
- afterEach(function () {
- // We want to gracefully fail if there is a hardware failure
- if(this.results_.failedCount > 0 && hardwarefailure == true) {
- //there was a hardware failure, cancelling all tests
- jasmine.Queue.prototype.next_ = function () { this.onComplete();}
- }
- });
-
- it("compass.hardwarecheck is compass supported", function() {
- var f = function(){navigator.compass.getCurrentHeading(function onSuccess(){}, function onError(error) {})};
- expect(f).hasHardware();
- });
-
- it("compass.spec.1 should exist", function() {
- expect(navigator.compass).toBeDefined();
- });
-
- it("compass.spec.2 should contain a getCurrentHeading function", function() {
- expect(navigator.compass.getCurrentHeading).toBeDefined();
- expect(typeof navigator.compass.getCurrentHeading == 'function').toBe(true);
- });
-
- it("compass.spec.3 getCurrentHeading success callback should be called with a Heading object", function() {
- var win = jasmine.createSpy().andCallFake(function(a) {
- expect(a instanceof CompassHeading).toBe(true);
- expect(a.magneticHeading).toBeDefined();
- expect(typeof a.magneticHeading == 'number').toBe(true);
- expect(a.trueHeading).not.toBe(undefined);
- expect(typeof a.trueHeading == 'number' || a.trueHeading === null).toBe(true);
- expect(a.headingAccuracy).not.toBe(undefined);
- expect(typeof a.headingAccuracy == 'number' || a.headingAccuracy === null).toBe(true);
- expect(typeof a.timestamp == 'number').toBe(true);
- }),
- fail = jasmine.createSpy();
-
- runs(function () {
- navigator.compass.getCurrentHeading(win, fail);
- });
-
- waitsFor(function () { return win.wasCalled; }, "success callback never called", Tests.TEST_TIMEOUT);
-
- runs(function () {
- expect(fail).not.toHaveBeenCalled();
- expect(win).toHaveBeenCalled();
- });
- });
-
- it("compass.spec.4 should contain a watchHeading function", function() {
- expect(navigator.compass.watchHeading).toBeDefined();
- expect(typeof navigator.compass.watchHeading == 'function').toBe(true);
- });
-
- it("compass.spec.5 should contain a clearWatch function", function() {
- expect(navigator.compass.clearWatch).toBeDefined();
- expect(typeof navigator.compass.clearWatch == 'function').toBe(true);
- });
-
- describe('Compass Constants (window.CompassError)', function () {
- it("compass.spec.1 should exist", function() {
- expect(window.CompassError).toBeDefined();
- expect(window.CompassError.COMPASS_INTERNAL_ERR).toBe(0);
- expect(window.CompassError.COMPASS_NOT_SUPPORTED).toBe(20);
- });
- });
-
- describe('Compass Heading model (CompassHeading)', function () {
- it("compass.spec.1 should exist", function() {
- expect(CompassHeading).toBeDefined();
- });
-
- it("compass.spec.8 should be able to create a new CompassHeading instance with no parameters", function() {
- var h = new CompassHeading();
- expect(h).toBeDefined();
- expect(h.magneticHeading).toBeUndefined();
- expect(h.trueHeading).toBeUndefined();
- expect(h.headingAccuracy).toBeUndefined();
- expect(typeof h.timestamp == 'number').toBe(true);
- });
-
- it("compass.spec.9 should be able to create a new CompassHeading instance with parameters", function() {
- var h = new CompassHeading(1,2,3,4);
- expect(h.magneticHeading).toBe(1);
- expect(h.trueHeading).toBe(2);
- expect(h.headingAccuracy).toBe(3);
- expect(h.timestamp.valueOf()).toBe(4);
- expect(typeof h.timestamp == 'number').toBe(true);
- });
- });
-});
http://git-wip-us.apache.org/repos/asf/cordova-mobile-spec/blob/2d8de527/www/compass/index.html
----------------------------------------------------------------------
diff --git a/www/compass/index.html b/www/compass/index.html
deleted file mode 100644
index 1734caa..0000000
--- a/www/compass/index.html
+++ /dev/null
@@ -1,48 +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="./index.js"></script>
- </head>
- <body 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 getCompass">Get Compass</div>
- <div class="btn large watchCompass">Start Watching Compass</div>
- <div class="btn large stopCompass">Stop Watching Compass</div>
- <h2> </h2><div class="backBtn">Back</div>
- </body>
-</html>
http://git-wip-us.apache.org/repos/asf/cordova-mobile-spec/blob/2d8de527/www/compass/index.js
----------------------------------------------------------------------
diff --git a/www/compass/index.js b/www/compass/index.js
deleted file mode 100644
index 0735ab2..0000000
--- a/www/compass/index.js
+++ /dev/null
@@ -1,104 +0,0 @@
-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);
-}
-
-window.onload = function() {
- addListenerToClass('getCompass', getCompass);
- addListenerToClass('watchCompass', watchCompass);
- addListenerToClass('stopCompass', stopCompass);
- addListenerToClass('backBtn', backHome);
- init();
-}
[20/32] spec commit: Merge branch 'CB-7094' of
https://github.com/martincgg/cordova-mobile-spec into CB-7086
Posted by pu...@apache.org.
Merge branch 'CB-7094' of https://github.com/martincgg/cordova-mobile-spec into CB-7086
Project: http://git-wip-us.apache.org/repos/asf/cordova-mobile-spec/repo
Commit: http://git-wip-us.apache.org/repos/asf/cordova-mobile-spec/commit/1a1b487b
Tree: http://git-wip-us.apache.org/repos/asf/cordova-mobile-spec/tree/1a1b487b
Diff: http://git-wip-us.apache.org/repos/asf/cordova-mobile-spec/diff/1a1b487b
Branch: refs/heads/master
Commit: 1a1b487bf6fcd9c7972dc0d476d998cee4b176f5
Parents: be7d415 9a3f679
Author: Jesse MacFadyen <pu...@gmail.com>
Authored: Wed Aug 6 17:43:04 2014 -0700
Committer: Jesse MacFadyen <pu...@gmail.com>
Committed: Wed Aug 6 17:43:04 2014 -0700
----------------------------------------------------------------------
www/autotest/pages/file.html | 53 -
www/autotest/pages/file.js | 39 -
www/autotest/tests/file.tests.js | 4451 ---------------------------------
www/file/index.html | 73 -
www/file/index.js | 171 --
5 files changed, 4787 deletions(-)
----------------------------------------------------------------------
[07/32] spec commit: Restored page with links to avoid conflic merges
Posted by pu...@apache.org.
Restored page with links to avoid conflic merges
Project: http://git-wip-us.apache.org/repos/asf/cordova-mobile-spec/repo
Commit: http://git-wip-us.apache.org/repos/asf/cordova-mobile-spec/commit/c5b6ea62
Tree: http://git-wip-us.apache.org/repos/asf/cordova-mobile-spec/tree/c5b6ea62
Diff: http://git-wip-us.apache.org/repos/asf/cordova-mobile-spec/diff/c5b6ea62
Branch: refs/heads/master
Commit: c5b6ea622fab5b492a9a350f28d4ad7a71dff358
Parents: df403a2
Author: Martin Gonzalez <ma...@gmail.com>
Authored: Fri Aug 1 12:18:15 2014 -0500
Committer: Martin Gonzalez <ma...@gmail.com>
Committed: Fri Aug 1 12:18:15 2014 -0500
----------------------------------------------------------------------
www/autotest/index.html | 1 +
www/autotest/pages/all.html | 1 +
www/index.html | 1 +
3 files changed, 3 insertions(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cordova-mobile-spec/blob/c5b6ea62/www/autotest/index.html
----------------------------------------------------------------------
diff --git a/www/autotest/index.html b/www/autotest/index.html
index 4394608..fe1dd91 100644
--- a/www/autotest/index.html
+++ b/www/autotest/index.html
@@ -37,6 +37,7 @@
<a href="pages/all.html" class="btn large" style="width:100%;">Run All Tests</a>
<a href="pages/accelerometer.html" class="btn large" style="width:100%;">Run Accelerometer Tests</a>
+ <a href="pages/battery.html" class="btn large" style="width:100%;">Run Battery Tests</a>
<a href="pages/camera.html" class="btn large" style="width:100%;">Run Camera Tests</a>
<a href="pages/capture.html" class="btn large" style="width:100%;">Run Capture Tests</a>
<a href="pages/compass.html" class="btn large" style="width:100%;">Run Compass Tests</a>
http://git-wip-us.apache.org/repos/asf/cordova-mobile-spec/blob/c5b6ea62/www/autotest/pages/all.html
----------------------------------------------------------------------
diff --git a/www/autotest/pages/all.html b/www/autotest/pages/all.html
index eef47cc..9ee9180 100644
--- a/www/autotest/pages/all.html
+++ b/www/autotest/pages/all.html
@@ -46,6 +46,7 @@
<!-- Tests -->
<script type="text/javascript" src="../tests/accelerometer.tests.js"></script>
<script type="text/javascript" src="../tests/battery.tests.js"></script>
+ <script type="text/javascript" src="../tests/bridge.tests.js"></script>
<script type="text/javascript" src="../tests/capture.tests.js"></script>
<script type="text/javascript" src="../tests/compass.tests.js"></script>
<script type="text/javascript" src="../tests/contacts.tests.js"></script>
http://git-wip-us.apache.org/repos/asf/cordova-mobile-spec/blob/c5b6ea62/www/index.html
----------------------------------------------------------------------
diff --git a/www/index.html b/www/index.html
index c8b9b97..39bc875 100644
--- a/www/index.html
+++ b/www/index.html
@@ -45,6 +45,7 @@ User-Agent: <span id="user-agent"> </span></div>
<a href="autotest/index.html" class="btn large">Automatic Test</a>
<a href="accelerometer/index.html" class="btn large">Accelerometer</a>
<a href="audio/index.html" class="btn large">Audio Play/Record</a>
+ <a href="battery/index.html" class="btn large">Battery</a>
<a href="camera/index.html" class="btn large">Camera</a>
<a href="capture/index.html" class="btn large">Capture</a>
<a href="compass/index.html" class="btn large">Compass</a>
[18/32] spec commit: CB-7195 removed statusbar tests
Posted by pu...@apache.org.
CB-7195 removed statusbar tests
Project: http://git-wip-us.apache.org/repos/asf/cordova-mobile-spec/repo
Commit: http://git-wip-us.apache.org/repos/asf/cordova-mobile-spec/commit/8de437ff
Tree: http://git-wip-us.apache.org/repos/asf/cordova-mobile-spec/tree/8de437ff
Diff: http://git-wip-us.apache.org/repos/asf/cordova-mobile-spec/diff/8de437ff
Branch: refs/heads/master
Commit: 8de437ffd2704ce8ba33366c81c1c365cacec301
Parents: 647bdb1
Author: Staci Cooper <sm...@us.ibm.com>
Authored: Mon Aug 4 12:03:17 2014 -0400
Committer: Staci Cooper <sm...@us.ibm.com>
Committed: Mon Aug 4 12:03:17 2014 -0400
----------------------------------------------------------------------
www/statusbar/index.html | 49 ----------------------------------
www/statusbar/index.js | 62 -------------------------------------------
2 files changed, 111 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cordova-mobile-spec/blob/8de437ff/www/statusbar/index.html
----------------------------------------------------------------------
diff --git a/www/statusbar/index.html b/www/statusbar/index.html
deleted file mode 100644
index c5251f7..0000000
--- a/www/statusbar/index.html
+++ /dev/null
@@ -1,49 +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="./index.js"></script>
- </head>
- <body id="stage" class="theme">
-
- <h1>Status Bar</h1>
- <div id="info">
- </div>
-
- <h2>Action</h2>
- Also: tapping bar on iOS should emit a log.
- <div class="btn large action-show">show</div>
- <div class="btn large action-hide">hide</div>
- <div class="btn large action-color1">style=red</div>
- <div class="btn large action-color2">style=translucent black</div>
- <div class="btn large action-color3">style=default</div>
- <div class="btn large action-overlays">Toggle Overlays</div>
- <h2> </h2><div class="backBtn">Back</div>
- </body>
-</html>
http://git-wip-us.apache.org/repos/asf/cordova-mobile-spec/blob/8de437ff/www/statusbar/index.js
----------------------------------------------------------------------
diff --git a/www/statusbar/index.js b/www/statusbar/index.js
deleted file mode 100644
index 201cf26..0000000
--- a/www/statusbar/index.js
+++ /dev/null
@@ -1,62 +0,0 @@
-
-function log(msg) {
- console.log(msg);
- var el = document.getElementById("info");
- el.textContent += msg + '\n';
-}
-
-function doShow() {
- StatusBar.show();
- log('StatusBar.isVisible=' + StatusBar.isVisible);
-}
-
-function doHide() {
- StatusBar.hide();
- log('StatusBar.isVisible=' + StatusBar.isVisible);
-}
-
-function doColor1() {
- log('set color=red');
- StatusBar.backgroundColorByName('red');
-}
-
-function doColor2() {
- log('set style=translucent black');
- StatusBar.styleBlackTranslucent();
-}
-
-function doColor3() {
- log('set style=default');
- StatusBar.styleDefault();
-}
-
-var showOverlay = true;
-function doOverlay() {
- showOverlay = !showOverlay;
- StatusBar.overlaysWebView(showOverlay);
- log('Set overlay=' + showOverlay);
-}
-
-/**
- * Function called when page has finished loading.
- */
-function init() {
- document.addEventListener("deviceready", function() {
- log("Device="+device.platform+" "+device.version);
- log('StatusBar.isVisible=' + StatusBar.isVisible);
- }, false);
-}
-
-window.onload = function() {
- addListenerToClass('action-show', doShow);
- addListenerToClass('action-hide', doHide);
- addListenerToClass('action-color1', doColor1);
- addListenerToClass('action-color2', doColor2);
- addListenerToClass('action-color3', doColor3);
- addListenerToClass('action-overlays', doOverlay);
- addListenerToClass('backBtn', backHome);
- init();
- window.addEventListener('statusTap', function() {
- log('tap!');
- }, false);
-}
[15/32] spec commit: CB-6965 removed dialogs tests
Posted by pu...@apache.org.
CB-6965 removed dialogs tests
Project: http://git-wip-us.apache.org/repos/asf/cordova-mobile-spec/repo
Commit: http://git-wip-us.apache.org/repos/asf/cordova-mobile-spec/commit/c3203712
Tree: http://git-wip-us.apache.org/repos/asf/cordova-mobile-spec/tree/c3203712
Diff: http://git-wip-us.apache.org/repos/asf/cordova-mobile-spec/diff/c3203712
Branch: refs/heads/master
Commit: c3203712a1a2a7a974377f8012c31e632b75bc33
Parents: 647bdb1
Author: Staci Cooper <sm...@us.ibm.com>
Authored: Mon Aug 4 11:49:53 2014 -0400
Committer: Staci Cooper <sm...@us.ibm.com>
Committed: Mon Aug 4 11:49:53 2014 -0400
----------------------------------------------------------------------
www/autotest/pages/notification.html | 55 --------------
www/autotest/tests/notification.tests.js | 46 ------------
www/notification/index.html | 51 -------------
www/notification/index.js | 100 --------------------------
4 files changed, 252 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cordova-mobile-spec/blob/c3203712/www/autotest/pages/notification.html
----------------------------------------------------------------------
diff --git a/www/autotest/pages/notification.html b/www/autotest/pages/notification.html
deleted file mode 100644
index 50777bf..0000000
--- a/www/autotest/pages/notification.html
+++ /dev/null
@@ -1,55 +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>
- <title>Cordova: Notification API Specs</title>
-
- <meta name="viewport" content="width=device-width, height=device-height, user-scalable=yes, initial-scale=1.0;" />
- <!-- Load jasmine -->
- <link href="../jasmine.css" rel="stylesheet"/>
- <script type="text/javascript" src="../jasmine.js"></script>
- <script type="text/javascript" src="../html/HtmlReporterHelpers.js"></script>
- <script type="text/javascript" src="../html/HtmlReporter.js"></script>
- <script type="text/javascript" src="../html/ReporterView.js"></script>
- <script type="text/javascript" src="../html/SpecView.js"></script>
- <script type="text/javascript" src="../html/SuiteView.js"></script>
- <script type="text/javascript" src="../html/TrivialReporter.js"></script>
-
- <!-- Source -->
- <script type="text/javascript" src="../../cordova-incl.js"></script>
-
- <!-- Load Test Runner -->
- <script type="text/javascript" src="../test-runner.js"></script>
-
- <!-- Tests -->
- <script type="text/javascript" src="../tests/notification.tests.js"></script>
- <script type="text/javascript" charset="utf-8" src="./run-tests.js"></script>
-</head>
-
-<body>
- <a href="javascript:" class="backBtn">Back</a>
-</body>
-</html>
-
http://git-wip-us.apache.org/repos/asf/cordova-mobile-spec/blob/c3203712/www/autotest/tests/notification.tests.js
----------------------------------------------------------------------
diff --git a/www/autotest/tests/notification.tests.js b/www/autotest/tests/notification.tests.js
deleted file mode 100644
index 016bcfb..0000000
--- a/www/autotest/tests/notification.tests.js
+++ /dev/null
@@ -1,46 +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 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-mobile-spec/blob/c3203712/www/notification/index.html
----------------------------------------------------------------------
diff --git a/www/notification/index.html b/www/notification/index.html
deleted file mode 100644
index ab648df..0000000
--- a/www/notification/index.html
+++ /dev/null
@@ -1,51 +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="./index.js"></script>
- </head>
- <body id="stage" class="theme">
-
- <h1>Notifications and Dialogs</h1>
- <div id="info">
- </div>
-
- <h2>Action</h2>
- <div class="btn large beep">Beep</div>
- <div class="btn large alertDialog">Alert Dialog</div>
- <div class="btn large confirmDialogA">Confirm Dialog - Deprecated</div>
- <div class="btn large confirmDialogB">Confirm Dialog</div>
- <div class="btn large promptDialog">Prompt Dialog</div>
-
- <div class="btn large builtInAlert">Built-in Alert Dialog</div>
- <div class="btn large builtInConfirm">Built-in Confirm Dialog</div>
- <div class="btn large builtInPrompt">Built-in Prompt Dialog</div>
- <h2> </h2><div class="backBtn">Back</div>
- </body>
-</html>
http://git-wip-us.apache.org/repos/asf/cordova-mobile-spec/blob/c3203712/www/notification/index.js
----------------------------------------------------------------------
diff --git a/www/notification/index.js b/www/notification/index.js
deleted file mode 100644
index 12e672f..0000000
--- a/www/notification/index.js
+++ /dev/null
@@ -1,100 +0,0 @@
-var deviceReady = false;
-
-//-------------------------------------------------------------------------
-// Notifications
-//-------------------------------------------------------------------------
-
-var beep = function(){
- navigator.notification.beep(3);
-};
-
-var alertDialog = function(message, title, button) {
- console.log("alertDialog()");
- navigator.notification.alert(message,
- function(){
- console.log("Alert dismissed.");
- },
- title, button);
- console.log("After alert");
-};
-
-var confirmDialogA = function(message, title, buttons) {
- navigator.notification.confirm(message,
- function(r) {
- if(r===0){
- console.log("Dismissed dialog without making a selection.");
- alert("Dismissed dialog without making a selection.");
- }else{
- console.log("You selected " + r);
- alert("You selected " + (buttons.split(","))[r-1]);
- }
- },
- title,
- buttons);
-};
-
-var confirmDialogB = function(message, title, buttons) {
- navigator.notification.confirm(message,
- function(r) {
- if(r===0){
- console.log("Dismissed dialog without making a selection.");
- alert("Dismissed dialog without making a selection.");
- }else{
- console.log("You selected " + r);
- alert("You selected " + buttons[r-1]);
- }
- },
- title,
- buttons);
-};
-
-var promptDialog = function(message, title, buttons) {
- navigator.notification.prompt(message,
- function(r) {
- if(r && r.buttonIndex===0){
- var msg = "Dismissed dialog";
- if( r.input1 ){
- msg+=" with input: " + r.input1
- }
- console.log(msg);
- alert(msg);
- }else{
- console.log("You selected " + r.buttonIndex + " and entered: " + r.input1);
- alert("You selected " + buttons[r.buttonIndex-1] + " and entered: " + r.input1);
- }
- },
- title,
- buttons);
-};
-/**
- * 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);
-}
-
-window.onload = function() {
- addListenerToClass('beep', beep);
- addListenerToClass('alertDialog', alertDialog,
- ['You pressed alert.', 'Alert Dialog', 'Continue']);
- addListenerToClass('confirmDialogA', confirmDialogA,
- ['You pressed confirm.', 'Confirm Dialog', 'Yes,No,Maybe']);
- addListenerToClass('confirmDialogB', confirmDialogB,
- ['You pressed confirm.', 'Confirm Dialog', ['Yes', 'No', 'Maybe, Not Sure']]);
- addListenerToClass('promptDialog', promptDialog,
- ['You pressed prompt.', 'Prompt Dialog', ['Yes', 'No', 'Maybe, Not Sure']]);
- addListenerToClass('builtInAlert', alert, 'You pressed alert.');
- addListenerToClass('builtInConfirm', confirm, 'You selected confirm');
- addListenerToClass('builtInPrompt', prompt, ['This is a prompt.', 'Default value']);
-
- addListenerToClass('backBtn', backHome);
- init();
-}
[17/32] spec commit: CB-6961 removed filetransfer tests
Posted by pu...@apache.org.
CB-6961 removed filetransfer tests
Project: http://git-wip-us.apache.org/repos/asf/cordova-mobile-spec/repo
Commit: http://git-wip-us.apache.org/repos/asf/cordova-mobile-spec/commit/bb1c2fcd
Tree: http://git-wip-us.apache.org/repos/asf/cordova-mobile-spec/tree/bb1c2fcd
Diff: http://git-wip-us.apache.org/repos/asf/cordova-mobile-spec/diff/bb1c2fcd
Branch: refs/heads/master
Commit: bb1c2fcd73d3b854eb3b6854cb9e0f5ebb152400
Parents: 647bdb1
Author: Staci Cooper <sm...@us.ibm.com>
Authored: Mon Aug 4 12:01:11 2014 -0400
Committer: Staci Cooper <sm...@us.ibm.com>
Committed: Mon Aug 4 12:01:11 2014 -0400
----------------------------------------------------------------------
www/autotest/pages/filetransfer.html | 54 --
www/autotest/tests/filetransfer.tests.js | 945 --------------------------
2 files changed, 999 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cordova-mobile-spec/blob/bb1c2fcd/www/autotest/pages/filetransfer.html
----------------------------------------------------------------------
diff --git a/www/autotest/pages/filetransfer.html b/www/autotest/pages/filetransfer.html
deleted file mode 100644
index 09809d8..0000000
--- a/www/autotest/pages/filetransfer.html
+++ /dev/null
@@ -1,54 +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>
- <title>Cordova: File API Specs</title>
-
- <meta name="viewport" content="width=device-width, height=device-height, user-scalable=yes, initial-scale=1.0;" />
- <!-- Load jasmine -->
- <link href="../jasmine.css" rel="stylesheet"/>
- <script type="text/javascript" src="../jasmine.js"></script>
- <script type="text/javascript" src="../html/HtmlReporterHelpers.js"></script>
- <script type="text/javascript" src="../html/HtmlReporter.js"></script>
- <script type="text/javascript" src="../html/ReporterView.js"></script>
- <script type="text/javascript" src="../html/SpecView.js"></script>
- <script type="text/javascript" src="../html/SuiteView.js"></script>
- <script type="text/javascript" src="../html/TrivialReporter.js"></script>
-
- <!-- Source -->
- <script type="text/javascript" src="../../cordova-incl.js"></script>
-
- <!-- Load Test Runner -->
- <script type="text/javascript" src="../test-runner.js"></script>
-
- <!-- Tests -->
- <script type="text/javascript" src="../tests/filetransfer.tests.js"></script>
- <script type="text/javascript" charset="utf-8" src="./file.js"></script>
-</head>
-
-<body>
- <a href="javascript:" class="backBtn">Back</a>
-</body>
-</html>
-
http://git-wip-us.apache.org/repos/asf/cordova-mobile-spec/blob/bb1c2fcd/www/autotest/tests/filetransfer.tests.js
----------------------------------------------------------------------
diff --git a/www/autotest/tests/filetransfer.tests.js b/www/autotest/tests/filetransfer.tests.js
deleted file mode 100644
index cbe15c0..0000000
--- a/www/autotest/tests/filetransfer.tests.js
+++ /dev/null
@@ -1,945 +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('FileTransfer', function() {
- // https://github.com/apache/cordova-labs/tree/cordova-filetransfer
- var server = "http://cordova-filetransfer.jitsu.com";
- var server_with_credentials = "http://cordova_user:cordova_password@cordova-filetransfer.jitsu.com";
-
- // deletes and re-creates the specified content
- var writeFile = function(fileName, fileContent, success, error) {
- deleteFile(fileName, function() {
- root.getFile(fileName, {create: true}, function(fileEntry) {
- fileEntry.createWriter(function (writer) {
-
- writer.onwrite = function(evt) {
- success(fileEntry);
- };
-
- writer.onabort = function(evt) {
- error(evt);
- };
-
- writer.error = function(evt) {
- error(evt);
- };
-
- writer.write(fileContent + "\n");
- }, error);
- }, error);
- });
- };
-
- var readFileEntry = function(entry, success, error) {
- entry.file(function(file) {
- var reader = new FileReader();
- reader.onerror = error;
- reader.onload = function(e) {
- success(reader.result);
- };
- reader.readAsText(file);
- }, error);
- };
-
- var getMalformedUrl = function() {
- if (device.platform.match(/Android/i)) {
- // bad protocol causes a MalformedUrlException on Android
- return "httpssss://example.com";
- } else {
- // iOS doesn't care about protocol, space in hostname causes error
- return "httpssss://exa mple.com";
- }
- };
-
- // deletes file, if it exists, then invokes callback
- var deleteFile = function(fileName, callback) {
- callback = callback || function() {};
- var spy = jasmine.createSpy().andCallFake(callback);
- root.getFile(fileName, null,
- // remove file system entry
- function(entry) {
- entry.remove(spy, spy);
- },
- // doesn't exist
- spy);
- waitsFor(function() { return spy.wasCalled; }, Tests.TEST_TIMEOUT);
- };
-
- it("filetransfer.spec.1 should exist and be constructable", function() {
- var ft = new FileTransfer();
- expect(ft).toBeDefined();
- });
- it("filetransfer.spec.2 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("filetransfer.spec.3 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() {
-
- // NOTE: if download tests are failing, check the white list
- //
- // <access origin="httpssss://example.com"/>
- // <access origin="apache.org" subdomains="true" />
- // <access origin="cordova-filetransfer.jitsu.com"/>
-
- it("filetransfer.spec.4 should be able to download a file using http", function() {
- var fail = createDoNotCallSpy('downloadFail');
- var fileFail = createDoNotCallSpy('downloadFail');
- var remoteFile = server + "/robots.txt"
- var localFileName = remoteFile.substring(remoteFile.lastIndexOf('/')+1);
- var lastProgressEvent = null;
-
- var fileWin = jasmine.createSpy().andCallFake(function(blob) {
- expect(lastProgressEvent.loaded).not.toBeGreaterThan(blob.size);
- });
-
- var downloadWin = function(entry) {
- expect(entry.name).toBe(localFileName);
- expect(lastProgressEvent.loaded).toBeGreaterThan(1);
- if (lastProgressEvent.lengthComputable) {
- expect(lastProgressEvent.total).not.toBeLessThan(lastProgressEvent.loaded);
- } else {
- expect(lastProgressEvent.total).toBe(0);
- }
- entry.file(fileWin, fileFail);
- };
-
- this.after(function() {
- deleteFile(localFileName);
- });
- runs(function() {
- var ft = new FileTransfer();
- ft.onprogress = function(e) {
- lastProgressEvent = e;
- };
- ft.download(remoteFile, root.toURL() + "/" + localFileName, downloadWin, fail);
- });
-
- waitsForAny(fileWin, fail, fileFail);
- });
- it("filetransfer.spec.5 should be able to download a file using http basic auth", function() {
- var fail = createDoNotCallSpy('downloadFail');
- var remoteFile = server_with_credentials + "/download_basic_auth"
- var localFileName = remoteFile.substring(remoteFile.lastIndexOf('/')+1);
- var lastProgressEvent = null;
-
- var downloadWin = jasmine.createSpy().andCallFake(function(entry) {
- expect(entry.name).toBe(localFileName);
- expect(lastProgressEvent.loaded).toBeGreaterThan(1);
- if (lastProgressEvent.lengthComputable) {
- expect(lastProgressEvent.total).not.toBeLessThan(lastProgressEvent.loaded);
- } else {
- expect(lastProgressEvent.total).toBe(0);
- }
- });
-
- this.after(function() {
- deleteFile(localFileName);
- });
- runs(function() {
- var ft = new FileTransfer();
- ft.onprogress = function(e) {
- lastProgressEvent = e;
- };
- ft.download(remoteFile, root.toURL() + "/" + localFileName, downloadWin, fail);
- });
-
- waitsForAny(downloadWin, fail);
- });
- it("filetransfer.spec.6 should get http status on basic auth failure", function() {
- var downloadWin = createDoNotCallSpy('downloadWin');
-
- var remoteFile = server + "/download_basic_auth";
- var localFileName = remoteFile.substring(remoteFile.lastIndexOf('/')+1);
- var downloadFail = jasmine.createSpy().andCallFake(function(error) {
- expect(error.http_status).toBe(401);
- expect(error.http_status).not.toBe(404, "Ensure " + remoteFile + " is in the white list");
- });
-
- this.after(function() {
- deleteFile(localFileName);
- });
- runs(function() {
- var ft = new FileTransfer();
- ft.download(remoteFile, root.toURL() + "/" + localFileName, downloadWin, downloadFail);
- });
-
- waitsForAny(downloadWin, downloadFail);
- });
- it("filetransfer.spec.7 should be able to download a file using file:// (when hosted from file://)", function() {
- var fail = createDoNotCallSpy('downloadFail');
- var remoteFile = window.location.href.replace(/\?.*/, '').replace(/ /g, '%20');
- var localFileName = remoteFile.substring(remoteFile.lastIndexOf('/')+1);
- var lastProgressEvent = null;
-
- if (!/^file/.exec(remoteFile) && cordova.platformId !== 'blackberry10') {
- expect(remoteFile).toMatch(/^file:/);
- return;
- }
-
- var downloadWin = jasmine.createSpy().andCallFake(function(entry) {
- expect(entry.name).toBe(localFileName);
- expect(lastProgressEvent.loaded).toBeGreaterThan(1);
- if (lastProgressEvent.lengthComputable) {
- expect(lastProgressEvent.total).not.toBeLessThan(lastProgressEvent.loaded);
- } else {
- expect(lastProgressEvent.total).toBe(0);
- }
- });
-
- this.after(function() {
- deleteFile(localFileName);
- });
-
- var ft = new FileTransfer();
- ft.onprogress = function(e) {
- lastProgressEvent = e;
- };
- ft.download(remoteFile, root.toURL() + "/" + localFileName, downloadWin, fail);
-
- waitsForAny(downloadWin, fail);
- });
- it("filetransfer.spec.8 should be able to download a file using https", function() {
- var remoteFile = "https://www.apache.org/licenses/";
- var localFileName = 'httpstest.html';
- var downloadFail = createDoNotCallSpy('downloadFail', 'Ensure ' + remoteFile + ' is in the white-list');
- var fileFail = createDoNotCallSpy('fileFail');
- var lastProgressEvent = null;
- var downloadWin = function(entry) {
- readFileEntry(entry, fileWin, fileFail);
- };
- var fileWin = jasmine.createSpy().andCallFake(function(content) {
- expect(content).toMatch(/The Apache Software Foundation/);
- expect(lastProgressEvent.loaded).not.toBeGreaterThan(content.length);
- });
-
- this.after(function() {
- deleteFile(localFileName);
- });
-
- var ft = new FileTransfer();
- ft.onprogress = function(e) {
- lastProgressEvent = e;
- };
- ft.download(remoteFile, root.toURL() + "/" + localFileName, downloadWin, downloadFail);
-
- waitsForAny(fileWin, downloadFail, fileFail);
- });
- it("filetransfer.spec.9 should not leave partial file due to abort", function() {
- var downloadWin = createDoNotCallSpy('downloadWin');
- var remoteFile = 'http://cordova.apache.org/downloads/logos_2.zip';
- var localFileName = remoteFile.substring(remoteFile.lastIndexOf('/')+1);
- var startTime = +new Date();
-
- var downloadFail = jasmine.createSpy().andCallFake(function(e) {
- expect(e.code).toBe(FileTransferError.ABORT_ERR);
- var didNotExistSpy = jasmine.createSpy();
- var existedSpy = createDoNotCallSpy('file existed after abort');
- root.getFile(localFileName, null, existedSpy, didNotExistSpy);
- waitsForAny(didNotExistSpy, existedSpy);
- });
-
- runs(function() {
- var ft = new FileTransfer();
- ft.onprogress = function(e) {
- if (e.loaded > 0) {
- ft.abort();
- }
- };
- ft.download(remoteFile, root.toURL() + "/" + localFileName, downloadWin, downloadFail);
- });
-
- waitsForAny(downloadWin, downloadFail);
- });
- it("filetransfer.spec.10 should be stopped by abort() right away", function() {
- var downloadWin = createDoNotCallSpy('downloadWin');
- var remoteFile = 'http://cordova.apache.org/downloads/BlueZedEx.mp3';
- var localFileName = remoteFile.substring(remoteFile.lastIndexOf('/')+1);
- var startTime = +new Date();
-
- var downloadFail = jasmine.createSpy().andCallFake(function(e) {
- expect(e.code).toBe(FileTransferError.ABORT_ERR);
- expect(new Date() - startTime).toBeLessThan(300);
- });
-
- this.after(function() {
- deleteFile(localFileName);
- });
- runs(function() {
- var ft = new FileTransfer();
- ft.abort(); // should be a no-op.
- ft.download(remoteFile, root.toURL() + "/" + localFileName, downloadWin, downloadFail);
- ft.abort();
- ft.abort(); // should be a no-op.
- });
-
- waitsForAny(downloadWin, downloadFail);
- });
- it("filetransfer.spec.11 should call the error callback on abort()", function() {
- var downloadWin = createDoNotCallSpy('downloadWin');
- var downloadFail = jasmine.createSpy().andCallFake(function(e) { console.log("Abort called") });
- var remoteFile = 'http://cordova.apache.org/downloads/BlueZedEx.mp3';
- var localFileName = remoteFile.substring(remoteFile.lastIndexOf('/')+1);
- var startTime = +new Date();
-
- this.after(function() {
- deleteFile(localFileName);
- });
- runs(function() {
- var ft = new FileTransfer();
- ft.abort(); // should be a no-op.
- ft.download(remoteFile, root.toURL() + "/" + localFileName, downloadWin, downloadFail);
- ft.abort();
- ft.abort(); // should be a no-op.
- });
-
- waitsForAny(downloadFail);
- });
- it("filetransfer.spec.12 should get http status on failure", function() {
- var downloadWin = createDoNotCallSpy('downloadWin');
-
- var remoteFile = server + "/404";
- var localFileName = remoteFile.substring(remoteFile.lastIndexOf('/')+1);
- var downloadFail = jasmine.createSpy().andCallFake(function(error) {
- expect(error.http_status).toBe(404);
- expect(error.http_status).not.toBe(401, "Ensure " + remoteFile + " is in the white list");
- });
-
- this.after(function() {
- deleteFile(localFileName);
- });
- runs(function() {
- var ft = new FileTransfer();
- ft.download(remoteFile, root.toURL() + "/" + localFileName, downloadWin, downloadFail);
- });
-
- waitsForAny(downloadWin, downloadFail);
- });
- it("filetransfer.spec.13 should get response body on failure", function() {
- var downloadWin = createDoNotCallSpy('downloadWin');
-
- var remoteFile = server + "/404";
- var localFileName = remoteFile.substring(remoteFile.lastIndexOf('/')+1);
- var downloadFail = jasmine.createSpy().andCallFake(function(error) {
- expect(error.body).toBeDefined();
- expect(error.body).toMatch('You requested a 404');
- });
-
- this.after(function() {
- deleteFile(localFileName);
- });
- runs(function() {
- var ft = new FileTransfer();
- ft.download(remoteFile, root.toURL() + "/" + localFileName, downloadWin, downloadFail);
- });
-
- waitsForAny(downloadWin, downloadFail);
- });
- it("filetransfer.spec.14 should handle malformed urls", function() {
- var downloadWin = createDoNotCallSpy('downloadWin');
-
- var remoteFile = getMalformedUrl();
- var localFileName = "download_malformed_url.txt";
- var downloadFail = jasmine.createSpy().andCallFake(function(error) {
- // Note: Android needs the bad protocol to be added to the access list
- // <access origin=".*"/> won't match because ^https?:// is prepended to the regex
- // The bad protocol must begin with http to avoid automatic prefix
- expect(error.http_status).not.toBe(401, "Ensure " + remoteFile + " is in the white list");
- expect(error.code).toBe(FileTransferError.INVALID_URL_ERR);
- });
-
- this.after(function() {
- deleteFile(localFileName);
- });
- runs(function() {
- var ft = new FileTransfer();
- ft.download(remoteFile, root.toURL() + "/" + localFileName, downloadWin, downloadFail);
- });
-
- waitsForAny(downloadWin, downloadFail);
- });
- it("filetransfer.spec.15 should handle unknown host", function() {
- var downloadWin = createDoNotCallSpy('downloadWin');
-
- var remoteFile = "http://foobar.apache.org/index.html";
- var localFileName = remoteFile.substring(remoteFile.lastIndexOf('/')+1);
- var downloadFail = jasmine.createSpy().andCallFake(function(error) {
- expect(error.code).toBe(FileTransferError.CONNECTION_ERR);
- });
-
- runs(function() {
- var ft = new FileTransfer();
- ft.download(remoteFile, root.toURL() + "/" + localFileName, downloadWin, downloadFail);
- });
-
- waitsForAny(downloadWin, downloadFail);
- });
- it("filetransfer.spec.16 should handle bad file path", function() {
- var downloadWin = createDoNotCallSpy('downloadWin');
-
- var remoteFile = server;
- var badFilePath = "c:\\54321";
- var downloadFail = jasmine.createSpy();
-
- runs(function() {
- var ft = new FileTransfer();
- ft.download(remoteFile, badFilePath, downloadWin, downloadFail);
- });
-
- waitsForAny(downloadWin, downloadFail);
- });
- it("filetransfer.spec.17 progress should work with gzip encoding", function() {
-
- //lengthComputable false on bb10 when downloading gzip
- if (cordova.platformId === 'blackberry10') {
- return;
- }
-
- var downloadFail = createDoNotCallSpy('downloadFail');
- var remoteFile = "http://www.apache.org/";
- var localFileName = "index.html";
- var lastProgressEvent = null;
-
- var downloadWin = jasmine.createSpy().andCallFake(function(entry) {
- expect(entry.name).toBe(localFileName);
- expect(lastProgressEvent.loaded).toBeGreaterThan(1, 'loaded');
- expect(lastProgressEvent.total).not.toBeLessThan(lastProgressEvent.loaded);
- expect(lastProgressEvent.lengthComputable).toBe(true, 'lengthComputable');
- });
-
- this.after(function() {
- deleteFile(localFileName);
- });
- runs(function() {
- var ft = new FileTransfer();
- ft.onprogress = function(e) {
- lastProgressEvent = e;
- };
- ft.download(remoteFile, root.toURL() + "/" + localFileName, downloadWin, downloadFail);
- });
- waitsForAny(downloadWin, downloadFail);
- });
- });
- describe('upload method', function() {
- it("filetransfer.spec.18 should be able to upload a file", function() {
- var remoteFile = server + "/upload";
- var localFileName = "upload.txt";
- var fileContents = 'This file should upload';
-
- var fileFail = createDoNotCallSpy('fileFail');
- var uploadFail = createDoNotCallSpy('uploadFail', "Ensure " + remoteFile + " is in the white list");
- var lastProgressEvent = null;
-
- var uploadWin = jasmine.createSpy().andCallFake(function(uploadResult) {
- expect(uploadResult.bytesSent).toBeGreaterThan(0);
- expect(uploadResult.responseCode).toBe(200);
- var obj = null;
- try {
- obj = JSON.parse(uploadResult.response);
- expect(obj.fields).toBeDefined();
- expect(obj.fields.value1).toBe("test");
- expect(obj.fields.value2).toBe("param");
- } catch (e) {
- expect(obj).not.toBeNull('returned data from server should be valid json');
- }
- expect(lastProgressEvent).not.toBeNull('expected progress events');
- if (cordova.platformId == 'ios') {
- expect(uploadResult.headers && uploadResult.headers['Content-Type']).toBeDefined('Expected content-type header to be defined.');
- }
- });
-
- var fileWin = function(fileEntry) {
- ft = new FileTransfer();
-
- var options = new FileUploadOptions();
- options.fileKey = "file";
- options.fileName = localFileName;
- options.mimeType = "text/plain";
-
- var params = new Object();
- params.value1 = "test";
- params.value2 = "param";
- options.params = params;
-
- ft.onprogress = function(e) {
- lastProgressEvent = e;
- expect(e.lengthComputable).toBe(true);
- expect(e.total).toBeGreaterThan(0);
- expect(e.loaded).toBeGreaterThan(0);
- expect(lastProgressEvent.total).not.toBeLessThan(lastProgressEvent.loaded);
- };
-
- // removing options cause Android to timeout
- ft.upload(fileEntry.toURL(), remoteFile, uploadWin, uploadFail, options);
- };
-
- this.after(function() {
- deleteFile(localFileName);
- });
- runs(function() {
- writeFile(localFileName, fileContents, fileWin, fileFail);
- });
-
- waitsForAny(uploadWin, uploadFail, fileFail);
- });
- it("filetransfer.spec.19 should be able to upload a file with http basic auth", function() {
- var remoteFile = server_with_credentials + "/upload_basic_auth";
- var localFileName = "upload.txt";
- var fileContents = 'This file should upload';
-
- var fileFail = createDoNotCallSpy('fileFail');
- var uploadFail = createDoNotCallSpy('uploadFail', "Ensure " + remoteFile + " is in the white list");
- var lastProgressEvent = null;
-
- var uploadWin = jasmine.createSpy().andCallFake(function(uploadResult) {
- expect(uploadResult.bytesSent).toBeGreaterThan(0);
- expect(uploadResult.responseCode).toBe(200);
- var obj = null;
- try {
- obj = JSON.parse(uploadResult.response);
- expect(obj.fields).toBeDefined();
- expect(obj.fields.value1).toBe("test");
- expect(obj.fields.value2).toBe("param");
- } catch (e) {
- expect(obj).not.toBeNull('returned data from server should be valid json');
- }
- });
-
- var fileWin = function(fileEntry) {
- ft = new FileTransfer();
-
- var options = new FileUploadOptions();
- options.fileKey = "file";
- options.fileName = localFileName;
- options.mimeType = "text/plain";
-
- var params = new Object();
- params.value1 = "test";
- params.value2 = "param";
- options.params = params;
-
- ft.onprogress = function(e) {
- expect(e.lengthComputable).toBe(true);
- expect(e.total).toBeGreaterThan(0);
- expect(e.loaded).toBeGreaterThan(0);
- lastProgressEvent = e;
- };
-
- // removing options cause Android to timeout
- ft.upload(fileEntry.toURL(), remoteFile, uploadWin, uploadFail, options);
- };
-
- this.after(function() {
- deleteFile(localFileName);
- });
- runs(function() {
- writeFile(localFileName, fileContents, fileWin, fileFail);
- });
-
- waitsForAny(uploadWin, uploadFail, fileFail);
- runs(function() {
- expect(lastProgressEvent).not.toBeNull('expected progress events');
- expect(lastProgressEvent.loaded).toBeGreaterThan(1, 'loaded');
- expect(lastProgressEvent.total).not.toBeLessThan(lastProgressEvent.loaded);
- });
- });
- it("filetransfer.spec.6 should get http status on basic auth failure", function() {
- var fileFail = createDoNotCallSpy('fileFail');
- var uploadWin = createDoNotCallSpy('uploadWin');
-
- var remoteFile = server + "/upload_basic_auth";
- var localFileName = "upload_expect_fail.txt";
- var uploadFail = jasmine.createSpy().andCallFake(function(error) {
- expect(error.http_status).toBe(401);
- expect(error.http_status).not.toBe(404, "Ensure " + remoteFile + " is in the white list");
- });
-
- var fileWin = function(fileEntry) {
- var ft = new FileTransfer();
-
- var options = new FileUploadOptions();
- options.fileKey="file";
- options.fileName=fileEntry.name;
- options.mimeType="text/plain";
-
- ft.upload(fileEntry.toURL(), remoteFile, uploadWin, uploadFail, options);
- };
-
- this.after(function() {
- deleteFile(localFileName);
- });
- runs(function() {
- writeFile(localFileName, "this file should fail to upload", fileWin, fileFail);
- });
-
- waitsForAny(uploadWin, uploadFail, fileFail);
- });
- it("filetransfer.spec.21 should be stopped by abort() right away.", function() {
- var remoteFile = server + "/upload";
- var localFileName = "upload.txt";
-
- var fileFail = createDoNotCallSpy('fileFail');
- var uploadWin = createDoNotCallSpy('uploadWin', 'Should have been aborted');
- var startTime;
-
- var uploadFail = jasmine.createSpy().andCallFake(function(e) {
- expect(e.code).toBe(FileTransferError.ABORT_ERR);
- expect(new Date() - startTime).toBeLessThan(300);
- });
-
- var fileWin = function(fileEntry) {
- ft = new FileTransfer();
-
- var options = new FileUploadOptions();
- options.fileKey = "file";
- options.fileName = localFileName;
- options.mimeType = "text/plain";
-
- startTime = +new Date();
- // removing options cause Android to timeout
- ft.abort(); // should be a no-op.
- ft.upload(fileEntry.toURL(), remoteFile, uploadWin, uploadFail, options);
- ft.abort();
- ft.abort(); // should be a no-op.
- };
-
- this.after(function() {
- deleteFile(localFileName);
- });
- runs(function() {
- writeFile(localFileName, new Array(10000).join('aborttest!'), fileWin, fileFail);
- });
-
- waitsForAny(uploadWin, uploadFail, fileFail);
- });
- it("filetransfer.spec.12 should get http status on failure", function() {
- var fileFail = createDoNotCallSpy('fileFail');
- var uploadWin = createDoNotCallSpy('uploadWin');
-
- var remoteFile = server + "/403";
- var localFileName = "upload_expect_fail.txt";
- var uploadFail = jasmine.createSpy().andCallFake(function(error) {
- expect(error.http_status).toBe(403);
- expect(error.http_status).not.toBe(401, "Ensure " + remoteFile + " is in the white list");
- });
-
- var fileWin = function(fileEntry) {
- var ft = new FileTransfer();
-
- var options = new FileUploadOptions();
- options.fileKey="file";
- options.fileName=fileEntry.name;
- options.mimeType="text/plain";
-
- ft.upload(fileEntry.toURL(), remoteFile, uploadWin, uploadFail, options);
- };
-
- this.after(function() {
- deleteFile(localFileName);
- });
- runs(function() {
- writeFile(localFileName, "this file should fail to upload", fileWin, fileFail);
- });
-
- waitsForAny(uploadWin, uploadFail, fileFail);
- });
- it("filetransfer.spec.14 should handle malformed urls", function() {
- var fileFail = createDoNotCallSpy('fileFail');
- var uploadWin = createDoNotCallSpy('uploadWin');
-
- var remoteFile = getMalformedUrl();
- var localFileName = "malformed_url.txt";
- var uploadFail = jasmine.createSpy().andCallFake(function(error) {
- expect(error.code).toBe(FileTransferError.INVALID_URL_ERR);
- expect(error.http_status).not.toBe(401, "Ensure " + remoteFile + " is in the white list");
- });
- var fileWin = function(fileEntry) {
- var ft = new FileTransfer();
- ft.upload(fileEntry.toURL(), remoteFile, uploadWin, uploadFail, {});
- };
-
- this.after(function() {
- deleteFile(localFileName);
- });
- runs(function() {
- writeFile(localFileName, "Some content", fileWin, fileFail);
- });
-
- waitsForAny(uploadWin, uploadFail, fileFail);
- });
- it("filetransfer.spec.15 should handle unknown host", function() {
- var fileFail = createDoNotCallSpy('fileFail');
- var uploadWin = createDoNotCallSpy('uploadWin');
-
- var remoteFile = "http://foobar.apache.org/robots.txt";
- var localFileName = remoteFile.substring(remoteFile.lastIndexOf('/')+1);
- var uploadFail = jasmine.createSpy().andCallFake(function(error) {
- expect(error.code).toBe(FileTransferError.CONNECTION_ERR);
- expect(error.http_status).not.toBe(401, "Ensure " + remoteFile + " is in the white list");
- });
- var fileWin = function(fileEntry) {
- var ft = new FileTransfer();
- ft.upload(fileEntry.toURL(), remoteFile, uploadWin, uploadFail, {});
- };
-
- this.after(function() {
- deleteFile(localFileName);
- });
- runs(function() {
- writeFile(localFileName, "# allow all", fileWin, fileFail);
- });
-
- waitsForAny(uploadWin, uploadFail, fileFail);
- });
- it("filetransfer.spec.25 should handle missing file", function() {
- var uploadWin = createDoNotCallSpy('uploadWin');
-
- var remoteFile = server + "/upload";
- var localFileName = "does_not_exist.txt";
-
- var uploadFail = jasmine.createSpy().andCallFake(function(error) {
- expect(error.code).toBe(FileTransferError.FILE_NOT_FOUND_ERR);
- expect(error.http_status).not.toBe(401, "Ensure " + remoteFile + " is in the white list");
- });
-
- runs(function() {
- var ft = new FileTransfer();
- ft.upload(root.toURL() + "/" + localFileName, remoteFile, uploadWin, uploadFail);
- });
-
- waitsForAny(uploadWin, uploadFail);
- });
- it("filetransfer.spec.16 should handle bad file path", function() {
- var uploadWin = createDoNotCallSpy('uploadWin');
-
- var remoteFile = server + "/upload";
-
- var uploadFail = jasmine.createSpy().andCallFake(function(error) {
- expect(error.http_status).not.toBe(401, "Ensure " + remoteFile + " is in the white list");
- });
-
- runs(function() {
- var ft = new FileTransfer();
- ft.upload("/usr/local/bad/file/path.txt", remoteFile, uploadWin, uploadFail);
- });
-
- waitsForAny(uploadWin, uploadFail);
- });
- it("filetransfer.spec.27 should be able to set custom headers", function() {
- var remoteFile = "http://whatheaders.com";
- var localFileName = "upload.txt";
-
- var fileFail = function() {};
- var uploadFail = createDoNotCallSpy('uploadFail', "Ensure " + remoteFile + " is in the white list and that Content-Length header is being set.");
-
- var uploadWin = jasmine.createSpy().andCallFake(function(uploadResult) {
- expect(uploadResult.bytesSent).toBeGreaterThan(0);
- expect(uploadResult.responseCode).toBe(200);
- expect(uploadResult.response).toBeDefined();
- var responseHtml = decodeURIComponent(uploadResult.response);
- expect(responseHtml).toMatch(/CustomHeader1[\s\S]*CustomValue1/i);
- expect(responseHtml).toMatch(/CustomHeader2[\s\S]*CustomValue2[\s\S]*CustomValue3/i, "Should allow array values");
- });
-
- var fileWin = function(fileEntry) {
- ft = new FileTransfer();
-
- var options = new FileUploadOptions();
- options.fileKey = "file";
- options.fileName = localFileName;
- options.mimeType = "text/plain";
-
- var params = new Object();
- params.value1 = "test";
- params.value2 = "param";
- options.params = params;
- options.headers = {
- "CustomHeader1": "CustomValue1",
- "CustomHeader2": ["CustomValue2", "CustomValue3"],
- };
-
- // removing options cause Android to timeout
- ft.upload(fileEntry.toURL(), remoteFile, uploadWin, uploadFail, options);
- };
-
- this.after(function() {
- deleteFile(localFileName);
- });
- runs(function() {
- writeFile(localFileName, "this file should upload", fileWin, fileFail);
- });
-
- waitsForAny(uploadWin, uploadFail);
- });
- });
- describe('Backwards compatibility', function() {
- /* These specs exist to test that the previously supported API still works with
- * the new version of file-transfer.
- * They rely on an undocumented interface to File which provides absolute file
- * paths, which are not used internally anymore.
- * If that interface is not present, then these tests will silently succeed.
- */
- it("filetransfer.spec.28 should be able to download a file using local paths", function() {
- var fail = createDoNotCallSpy('downloadFail');
- var remoteFile = server + "/robots.txt"
- var localFileName = remoteFile.substring(remoteFile.lastIndexOf('/')+1);
- var localURL = root.toURL() + "/" + localFileName;
- var lastProgressEvent = null;
-
- var downloadWin = jasmine.createSpy().andCallFake(function(entry) {
- expect(entry.name).toBe(localFileName);
- expect(lastProgressEvent.loaded).toBeGreaterThan(1);
- });
- var unsupportedOperation = jasmine.createSpy("Operation not supported");
-
- this.after(function() {
- deleteFile(localFileName);
- });
- runs(function() {
- /* This is an undocumented interface to File which exists only for testing
- * backwards compatibilty. By obtaining the raw filesystem path of the download
- * location, we can pass that to ft.download() to make sure that previously-stored
- * paths are still valid.
- */
- cordova.exec(function(localPath) {
- var ft = new FileTransfer();
- ft.onprogress = function(e) {
- lastProgressEvent = e;
- if (lastProgressEvent.lengthComputable) {
- expect(lastProgressEvent.total).not.toBeLessThan(lastProgressEvent.loaded);
- } else {
- expect(lastProgressEvent.total).toBe(0);
- }
- };
- ft.download(remoteFile, localPath, downloadWin, fail);
- }, unsupportedOperation, 'File', '_getLocalFilesystemPath', [localURL]);
- });
-
- waitsForAny(downloadWin, fail, unsupportedOperation);
- });
- it("filetransfer.spec.29 should be able to upload a file using local paths", function() {
- var remoteFile = server + "/upload";
- var localFileName = "upload.txt";
- var fileContents = 'This file should upload';
-
- var fileFail = createDoNotCallSpy('fileFail');
- var uploadFail = createDoNotCallSpy('uploadFail', "Ensure " + remoteFile + " is in the white list");
- var unsupportedOperation = jasmine.createSpy("Operation not supported");
- var lastProgressEvent = null;
-
- var uploadWin = jasmine.createSpy().andCallFake(function(uploadResult) {
- expect(uploadResult.bytesSent).toBeGreaterThan(0);
- expect(uploadResult.responseCode).toBe(200);
- var obj = null;
- try {
- obj = JSON.parse(uploadResult.response);
- expect(obj.fields).toBeDefined();
- expect(obj.fields.value1).toBe("test");
- expect(obj.fields.value2).toBe("param");
- } catch (e) {
- expect(obj).not.toBeNull('returned data from server should be valid json');
- }
- });
-
- var fileWin = function(fileEntry) {
- ft = new FileTransfer();
-
- var options = new FileUploadOptions();
- options.fileKey = "file";
- options.fileName = localFileName;
- options.mimeType = "text/plain";
-
- var params = new Object();
- params.value1 = "test";
- params.value2 = "param";
- options.params = params;
-
- ft.onprogress = function(e) {
- expect(e.lengthComputable).toBe(true);
- expect(e.total).toBeGreaterThan(0);
- expect(e.loaded).toBeGreaterThan(0);
- lastProgressEvent = e;
- };
-
- // removing options cause Android to timeout
-
- /* This is an undocumented interface to File which exists only for testing
- * backwards compatibilty. By obtaining the raw filesystem path of the download
- * location, we can pass that to ft.download() to make sure that previously-stored
- * paths are still valid.
- */
- cordova.exec(function(localPath) {
- ft.upload(localPath, remoteFile, uploadWin, uploadFail, options);
- }, unsupportedOperation, 'File', '_getLocalFilesystemPath', [fileEntry.toURL()]);
-
- };
-
- this.after(function() {
- deleteFile(localFileName);
- });
- runs(function() {
- writeFile(localFileName, fileContents, fileWin, fileFail);
- });
-
- waitsForAny(uploadWin, uploadFail, fileFail, unsupportedOperation);
- runs(function() {
- if (!unsupportedOperation.wasCalled) {
- expect(lastProgressEvent).not.toBeNull('expected progress events');
- expect(lastProgressEvent.loaded).toBeGreaterThan(1);
- expect(lastProgressEvent.total).not.toBeLessThan(lastProgressEvent.loaded);
- }
- });
- });
- });
- describe('native URL interface', function() {
- it("filetransfer.spec.30 downloaded file entries should have a toNativeURL method", function() {
- var fail = createDoNotCallSpy('downloadFail');
- var remoteFile = server + "/robots.txt";
- var localFileName = remoteFile.substring(remoteFile.lastIndexOf('/')+1)+".spec30";
-
- var downloadWin = jasmine.createSpy().andCallFake(function(entry) {
- expect(entry.toNativeURL).toBeDefined();
- expect(typeof entry.toNativeURL).toBe("function");
- var nativeURL = entry.toNativeURL();
- expect(typeof nativeURL).toBe("string");
- expect(nativeURL.substring(0,7)).toBe('file://');
- });
-
- this.after(function() {
- deleteFile(localFileName);
- });
- runs(function() {
- var ft = new FileTransfer();
- ft.download(remoteFile, root.toURL() + "/" + localFileName, downloadWin, fail);
- });
-
- waitsForAny(downloadWin, fail);
- });
- });
-});
[30/32] spec commit: Merge branch 'CB-6961' of
https://github.com/stacic/cordova-mobile-spec into CB-7086
Posted by pu...@apache.org.
Merge branch 'CB-6961' of https://github.com/stacic/cordova-mobile-spec into CB-7086
Project: http://git-wip-us.apache.org/repos/asf/cordova-mobile-spec/repo
Commit: http://git-wip-us.apache.org/repos/asf/cordova-mobile-spec/commit/bf3fb94c
Tree: http://git-wip-us.apache.org/repos/asf/cordova-mobile-spec/tree/bf3fb94c
Diff: http://git-wip-us.apache.org/repos/asf/cordova-mobile-spec/diff/bf3fb94c
Branch: refs/heads/master
Commit: bf3fb94c370ace5789691f30794fa7045175dc6c
Parents: 74eb4c2 bb1c2fc
Author: Jesse MacFadyen <pu...@gmail.com>
Authored: Wed Aug 6 17:49:26 2014 -0700
Committer: Jesse MacFadyen <pu...@gmail.com>
Committed: Wed Aug 6 17:49:26 2014 -0700
----------------------------------------------------------------------
www/autotest/pages/filetransfer.html | 54 --
www/autotest/tests/filetransfer.tests.js | 945 --------------------------
2 files changed, 999 deletions(-)
----------------------------------------------------------------------
[16/32] spec commit: CB-6962 removed globalization tests
Posted by pu...@apache.org.
CB-6962 removed globalization tests
Project: http://git-wip-us.apache.org/repos/asf/cordova-mobile-spec/repo
Commit: http://git-wip-us.apache.org/repos/asf/cordova-mobile-spec/commit/7738b67c
Tree: http://git-wip-us.apache.org/repos/asf/cordova-mobile-spec/tree/7738b67c
Diff: http://git-wip-us.apache.org/repos/asf/cordova-mobile-spec/diff/7738b67c
Branch: refs/heads/master
Commit: 7738b67c8d7cf84b83f27fb31588bae250f51bc5
Parents: 647bdb1
Author: Staci Cooper <sm...@us.ibm.com>
Authored: Mon Aug 4 11:53:03 2014 -0400
Committer: Staci Cooper <sm...@us.ibm.com>
Committed: Mon Aug 4 11:53:03 2014 -0400
----------------------------------------------------------------------
www/autotest/pages/globalization.html | 54 --
www/autotest/tests/globalization.tests.js | 864 -------------------------
2 files changed, 918 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cordova-mobile-spec/blob/7738b67c/www/autotest/pages/globalization.html
----------------------------------------------------------------------
diff --git a/www/autotest/pages/globalization.html b/www/autotest/pages/globalization.html
deleted file mode 100644
index 295067e..0000000
--- a/www/autotest/pages/globalization.html
+++ /dev/null
@@ -1,54 +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>
- <title>Cordova: Globalization API Specs</title>
-
- <meta name="viewport" content="width=device-width, height=device-height, user-scalable=yes, initial-scale=1.0;" />
-
- <!-- Load jasmine -->
- <link href="../jasmine.css" rel="stylesheet"/>
- <script type="text/javascript" src="../jasmine.js"></script>
- <script type="text/javascript" src="../html/HtmlReporterHelpers.js"></script>
- <script type="text/javascript" src="../html/HtmlReporter.js"></script>
- <script type="text/javascript" src="../html/ReporterView.js"></script>
- <script type="text/javascript" src="../html/SpecView.js"></script>
- <script type="text/javascript" src="../html/SuiteView.js"></script>
- <script type="text/javascript" src="../html/TrivialReporter.js"></script>
-
- <!-- Source -->
- <script type="text/javascript" src="../../cordova-incl.js"></script>
-
- <!-- Load Test Runner -->
- <script type="text/javascript" src="../test-runner.js"></script>
-
- <!-- Tests -->
- <script type="text/javascript" src="../tests/globalization.tests.js"></script>
- <script type="text/javascript" charset="utf-8" src="./run-tests.js"></script>
-</head>
-
-<body>
- <a href="javascript:" class="backBtn">Back</a>
-</body>
-</html>
http://git-wip-us.apache.org/repos/asf/cordova-mobile-spec/blob/7738b67c/www/autotest/tests/globalization.tests.js
----------------------------------------------------------------------
diff --git a/www/autotest/tests/globalization.tests.js b/www/autotest/tests/globalization.tests.js
deleted file mode 100644
index d540987..0000000
--- a/www/autotest/tests/globalization.tests.js
+++ /dev/null
@@ -1,864 +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('Globalization (navigator.globalization)', function () {
-
- it("globalization.spec.1 should exist", function() {
- expect(navigator.globalization).toBeDefined();
- });
-
- describe("getPreferredLanguage", function() {
- it("globalization.spec.1 should exist", function() {
- expect(typeof navigator.globalization.getPreferredLanguage).toBeDefined();
- expect(typeof navigator.globalization.getPreferredLanguage == 'function').toBe(true);
- });
- it("globalization.spec.3 getPreferredLanguage success callback should be called with a Properties object", function() {
- var win = jasmine.createSpy().andCallFake(function(a) {
- expect(a).toBeDefined();
- expect(typeof a).toBe('object');
- expect(a.value).toBeDefined();
- expect(typeof a.value).toBe('string');
- expect(a.value.length > 0).toBe(true);
- }),
- fail = jasmine.createSpy();
-
- runs(function () {
- navigator.globalization.getPreferredLanguage(win, fail);
- });
-
- waitsFor(function () { return win.wasCalled; }, "win never called", Tests.TEST_TIMEOUT);
-
- runs(function () {
- expect(fail).not.toHaveBeenCalled();
- });
- });
- });
-
- describe("getLocaleName", function() {
- it("globalization.spec.1 should exist", function() {
- expect(typeof navigator.globalization.getLocaleName).toBeDefined();
- expect(typeof navigator.globalization.getLocaleName == 'function').toBe(true);
- });
- it("globalization.spec.3 getLocaleName success callback should be called with a Properties object", function() {
- var win = jasmine.createSpy().andCallFake(function(a) {
- expect(a).toBeDefined();
- expect(typeof a).toBe('object');
- expect(a.value).toBeDefined();
- expect(typeof a.value).toBe('string');
- expect(a.value.length > 0).toBe(true);
- }),
- fail = jasmine.createSpy();
-
- runs(function () {
- navigator.globalization.getLocaleName(win, fail);
- });
-
- waitsFor(function () { return win.wasCalled; }, "win never called", Tests.TEST_TIMEOUT);
-
- runs(function () {
- expect(fail).not.toHaveBeenCalled();
- });
- });
- });
-
- describe('Globalization Constants (window.Globalization)', function () {
- it("globalization.spec.1 should exist", function() {
- expect(window.GlobalizationError).toBeDefined();
- expect(window.GlobalizationError.UNKNOWN_ERROR).toBe(0);
- expect(window.GlobalizationError.FORMATTING_ERROR).toBe(1);
- expect(window.GlobalizationError.PARSING_ERROR).toBe(2);
- expect(window.GlobalizationError.PATTERN_ERROR).toBe(3);
- });
- });
-
- describe("dateToString", function() {
- it("globalization.spec.1 should exist", function() {
- expect(typeof navigator.globalization.dateToString).toBeDefined();
- expect(typeof navigator.globalization.dateToString == 'function').toBe(true);
- });
- it("globalization.spec.5 dateToString using default options, success callback should be called with a Properties object", function() {
- var win = jasmine.createSpy().andCallFake(function(a) {
- expect(a).toBeDefined();
- expect(typeof a).toBe('object');
- expect(a.value).toBeDefined();
- expect(typeof a.value).toBe('string');
- expect(a.value.length > 0).toBe(true);
- }),
- fail = jasmine.createSpy();
-
- runs(function () {
- navigator.globalization.dateToString(new Date(), win, fail);
- });
-
- waitsFor(function () { return win.wasCalled; }, "win never called", Tests.TEST_TIMEOUT);
-
- runs(function () {
- expect(fail).not.toHaveBeenCalled();
- });
- });
- it("globalization.spec.6 dateToString using formatLength=short and selector=date options, success callback should be called with a Properties object", function() {
- var win = jasmine.createSpy().andCallFake(function(a) {
- expect(a).toBeDefined();
- expect(typeof a).toBe('object');
- expect(a.value).toBeDefined();
- expect(typeof a.value).toBe('string');
- expect(a.value.length > 0).toBe(true);
- }),
- fail = jasmine.createSpy();
-
- runs(function () {
- navigator.globalization.dateToString(new Date(), win, fail, {formatLength: 'short', selector: 'date'});
- });
-
- waitsFor(function () { return win.wasCalled; }, "win never called", Tests.TEST_TIMEOUT);
-
- runs(function () {
- expect(fail).not.toHaveBeenCalled();
- });
- });
- it("globalization.spec.7 dateToString using formatLength=full and selector=date options, success callback should be called with a Properties object", function() {
- var win = jasmine.createSpy().andCallFake(function(a) {
- expect(a).toBeDefined();
- expect(typeof a).toBe('object');
- expect(a.value).toBeDefined();
- expect(typeof a.value).toBe('string');
- expect(a.value.length > 0).toBe(true);
- }),
- fail = jasmine.createSpy();
-
- runs(function () {
- navigator.globalization.dateToString(new Date(), win, fail, {formatLength: 'full', selector: 'date'});
- });
-
- waitsFor(function () { return win.wasCalled; }, "win never called", Tests.TEST_TIMEOUT);
-
- runs(function () {
- expect(fail).not.toHaveBeenCalled();
- });
- });
- it("globalization.spec.8 dateToString using formatLength=medium and selector=date and time(default) options, success callback should be called with a Properties object", function() {
- var win = jasmine.createSpy().andCallFake(function(a) {
- expect(a).toBeDefined();
- expect(typeof a).toBe('object');
- expect(a.value).toBeDefined();
- expect(typeof a.value).toBe('string');
- expect(a.value.length > 0).toBe(true);
- }),
- fail = jasmine.createSpy();
-
- runs(function () {
- navigator.globalization.dateToString(new Date(), win, fail, {formatLength: 'medium'});
- });
-
- waitsFor(function () { return win.wasCalled; }, "win never called", Tests.TEST_TIMEOUT);
-
- runs(function () {
- expect(fail).not.toHaveBeenCalled();
- });
- });
- it("globalization.spec.9 dateToString using formatLength=long and selector=date and time(default) options, success callback should be called with a Properties object", function() {
- var win = jasmine.createSpy().andCallFake(function(a) {
- expect(a).toBeDefined();
- expect(typeof a).toBe('object');
- expect(a.value).toBeDefined();
- expect(typeof a.value).toBe('string');
- expect(a.value.length > 0).toBe(true);
- }),
- fail = jasmine.createSpy();
-
- runs(function () {
- navigator.globalization.dateToString(new Date(), win, fail, {formatLength: 'long'});
- });
-
- waitsFor(function () { return win.wasCalled; }, "win never called", Tests.TEST_TIMEOUT);
-
- runs(function () {
- expect(fail).not.toHaveBeenCalled();
- });
- });
- it("globalization.spec.10 dateToString using formatLength=full and selector=date and time(default) options, success callback should be called with a Properties object", function() {
- var win = jasmine.createSpy().andCallFake(function(a) {
- expect(a).toBeDefined();
- expect(typeof a).toBe('object');
- expect(a.value).toBeDefined();
- expect(typeof a.value).toBe('string');
- expect(a.value.length > 0).toBe(true);
- }),
- fail = jasmine.createSpy();
-
- runs(function () {
- navigator.globalization.dateToString(new Date(), win, fail, {formatLength: 'full'});
- });
-
- waitsFor(function () { return win.wasCalled; }, "win never called", Tests.TEST_TIMEOUT);
-
- runs(function () {
- expect(fail).not.toHaveBeenCalled();
- });
- });
- });
-
- describe("stringToDate", function() {
- it("globalization.spec.1 should exist", function() {
- expect(typeof navigator.globalization.stringToDate).toBeDefined();
- expect(typeof navigator.globalization.stringToDate == 'function').toBe(true);
- });
- it("globalization.spec.12 stringToDate using default options, success callback should be called with a Properties object", function() {
- var win = jasmine.createSpy().andCallFake(function(a) {
- expect(a).toBeDefined();
- expect(typeof a).toBe('object');
- expect(a.year).toBeDefined();
- expect(typeof a.year).toBe('number');
- expect(a.year >= 0 && a.year <=9999).toBe(true);
- expect(a.month).toBeDefined();
- expect(typeof a.month).toBe('number');
- expect(a.month >= 0 && a.month <=11).toBe(true);
- expect(a.day).toBeDefined();
- expect(typeof a.day).toBe('number');
- expect(a.day >= 1 && a.day <=31).toBe(true);
- expect(a.hour).toBeDefined();
- expect(typeof a.hour).toBe('number');
- expect(a.hour >= 0 && a.hour <=23).toBe(true);
- expect(a.minute).toBeDefined();
- expect(typeof a.minute).toBe('number');
- expect(a.minute >= 0 && a.minute <=59).toBe(true);
- expect(a.second).toBeDefined();
- expect(typeof a.second).toBe('number');
- expect(a.second >= 0 && a.second <=59).toBe(true);
- expect(a.millisecond).toBeDefined();
- expect(typeof a.millisecond).toBe('number');
- }),
- fail = jasmine.createSpy();
-
- var win2 = function(a) {
- navigator.globalization.stringToDate(a.value, win, fail);
- };
-
- runs(function () {
- navigator.globalization.dateToString(new Date(), win2, fail);
- });
-
- waitsFor(function () { return win.wasCalled; }, "win never called", Tests.TEST_TIMEOUT);
-
- runs(function () {
- expect(fail).not.toHaveBeenCalled();
- });
- });
- it("globalization.spec.13 stringToDate using formatLength=short and selector=date options, success callback should be called with a Properties object", function() {
- var win = jasmine.createSpy().andCallFake(function(a) {
- expect(a).toBeDefined();
- expect(typeof a).toBe('object');
- expect(a.year).toBeDefined();
- expect(typeof a.year).toBe('number');
- expect(a.year >= 0 && a.year <=9999).toBe(true);
- expect(a.month).toBeDefined();
- expect(typeof a.month).toBe('number');
- expect(a.month >= 0 && a.month <=11).toBe(true);
- expect(a.day).toBeDefined();
- expect(typeof a.day).toBe('number');
- expect(a.day >= 1 && a.day <=31).toBe(true);
- expect(a.hour).toBeDefined();
- expect(typeof a.hour).toBe('number');
- expect(a.hour >= 0 && a.hour <=23).toBe(true);
- expect(a.minute).toBeDefined();
- expect(typeof a.minute).toBe('number');
- expect(a.minute >= 0 && a.minute <=59).toBe(true);
- expect(a.second).toBeDefined();
- expect(typeof a.second).toBe('number');
- expect(a.second >= 0 && a.second <=59).toBe(true);
- expect(a.millisecond).toBeDefined();
- expect(typeof a.millisecond).toBe('number');
- }),
- fail = jasmine.createSpy();
-
- var win2 = function(a) {
- navigator.globalization.stringToDate(a.value, win, fail, {formatLength: 'short', selector: 'date'});
- };
-
- runs(function () {
- navigator.globalization.dateToString(new Date(), win2, fail, {formatLength: 'short', selector: 'date'});
- });
-
- waitsFor(function () { return win.wasCalled; }, "win never called", Tests.TEST_TIMEOUT);
-
- runs(function () {
- expect(fail).not.toHaveBeenCalled();
- });
- });
- it("globalization.spec.14 stringToDate using formatLength=full and selector=date options, success callback should be called with a Properties object", function() {
- var win = jasmine.createSpy().andCallFake(function(a) {
- expect(a).toBeDefined();
- expect(typeof a).toBe('object');
- expect(a.year).toBeDefined();
- expect(typeof a.year).toBe('number');
- expect(a.year >= 0 && a.year <=9999).toBe(true);
- expect(a.month).toBeDefined();
- expect(typeof a.month).toBe('number');
- expect(a.month >= 0 && a.month <=11).toBe(true);
- expect(a.day).toBeDefined();
- expect(typeof a.day).toBe('number');
- expect(a.day >= 1 && a.day <=31).toBe(true);
- expect(a.hour).toBeDefined();
- expect(typeof a.hour).toBe('number');
- expect(a.hour >= 0 && a.hour <=23).toBe(true);
- expect(a.minute).toBeDefined();
- expect(typeof a.minute).toBe('number');
- expect(a.minute >= 0 && a.minute <=59).toBe(true);
- expect(a.second).toBeDefined();
- expect(typeof a.second).toBe('number');
- expect(a.second >= 0 && a.second <=59).toBe(true);
- expect(a.millisecond).toBeDefined();
- expect(typeof a.millisecond).toBe('number');
- }),
- fail = jasmine.createSpy();
-
- var win2 = function(a) {
- navigator.globalization.stringToDate(a.value, win, fail, {formatLength: 'full', selector: 'date'});
- };
- runs(function () {
- navigator.globalization.dateToString(new Date(), win2, fail, {formatLength: 'full', selector: 'date'});
- });
-
- waitsFor(function () { return win.wasCalled; }, "win never called", Tests.TEST_TIMEOUT);
-
- runs(function () {
- expect(fail).not.toHaveBeenCalled();
- });
- });
- it("globalization.spec.15 stringToDate using invalid date, error callback should be called with a GlobalizationError object", function() {
- var win = jasmine.createSpy(),
- fail = jasmine.createSpy().andCallFake(function(a) {
- expect(a).toBeDefined();
- expect(typeof a).toBe('object');
- expect(a.code).toBeDefined();
- expect(typeof a.code).toBe('number');
- expect(a.code === GlobalizationError.PARSING_ERROR).toBe(true);
- expect(a.message).toBeDefined();
- expect(typeof a.message).toBe('string');
- expect(a.message !== "").toBe(true);
- });
-
- runs(function () {
- navigator.globalization.stringToDate('notADate', win, fail, {selector:'foobar'});
- });
-
- waitsFor(function () { return fail.wasCalled; }, "fail never called", Tests.TEST_TIMEOUT);
-
- runs(function () {
- expect(win).not.toHaveBeenCalled();
- });
- });
- });
-
- describe("getDatePattern", function() {
- it("globalization.spec.1 should exist", function() {
- expect(typeof navigator.globalization.getDatePattern).toBeDefined();
- expect(typeof navigator.globalization.getDatePattern == 'function').toBe(true);
- });
- it("globalization.spec.17 getDatePattern using default options, success callback should be called with a Properties object", function() {
- var win = jasmine.createSpy().andCallFake(function(a) {
- expect(a).toBeDefined();
- expect(typeof a).toBe('object');
- expect(a.pattern).toBeDefined();
- expect(typeof a.pattern).toBe('string');
- expect(a.pattern.length > 0).toBe(true);
- expect(a.timezone).toBeDefined();
- expect(typeof a.timezone).toBe('string');
- expect(a.timezone.length > 0).toBe(true);
- expect(a.utc_offset).toBeDefined();
- expect(typeof a.utc_offset).toBe('number');
- expect(a.dst_offset).toBeDefined();
- expect(typeof a.dst_offset).toBe('number');
- }),
- fail = jasmine.createSpy();
-
- runs(function () {
- navigator.globalization.getDatePattern(win, fail);
- });
-
- waitsFor(function () { return win.wasCalled; }, "win never called", Tests.TEST_TIMEOUT);
-
- runs(function () {
- expect(fail).not.toHaveBeenCalled();
- });
- });
- it("globalization.spec.18 getDatePattern using formatLength=medium and selector=date options, success callback should be called with a Properties object", function() {
- var win = jasmine.createSpy().andCallFake(function(a) {
- expect(a).toBeDefined();
- expect(typeof a).toBe('object');
- expect(a.pattern).toBeDefined();
- expect(typeof a.pattern).toBe('string');
- expect(a.pattern.length > 0).toBe(true);
- expect(a.timezone).toBeDefined();
- expect(typeof a.timezone).toBe('string');
- expect(a.timezone.length > 0).toBe(true);
- expect(a.utc_offset).toBeDefined();
- expect(typeof a.utc_offset).toBe('number');
- expect(a.dst_offset).toBeDefined();
- expect(typeof a.dst_offset).toBe('number');
- }),
- fail = jasmine.createSpy();
-
- runs(function () {
- navigator.globalization.getDatePattern(win, fail, {formatLength: 'medium', selector: 'date'});
- });
-
- waitsFor(function () { return win.wasCalled; }, "win never called", Tests.TEST_TIMEOUT);
-
- runs(function () {
- expect(fail).not.toHaveBeenCalled();
- });
- });
- });
-
- describe("getDateNames", function() {
- it("globalization.spec.1 should exist", function() {
- expect(typeof navigator.globalization.getDateNames).toBeDefined();
- expect(typeof navigator.globalization.getDateNames == 'function').toBe(true);
- });
- it("globalization.spec.20 getDateNames using default options, success callback should be called with a Properties object", function() {
- var win = jasmine.createSpy().andCallFake(function(a) {
- expect(a).toBeDefined();
- expect(typeof a).toBe('object');
- expect(a.value).toBeDefined();
- expect(a.value instanceof Array).toBe(true);
- expect(a.value.length > 0).toBe(true);
- expect(typeof a.value[0]).toBe('string');
- }),
- fail = jasmine.createSpy();
-
- runs(function () {
- navigator.globalization.getDateNames(win, fail);
- });
-
- waitsFor(function () { return win.wasCalled; }, "win never called", Tests.TEST_TIMEOUT);
-
- runs(function () {
- expect(fail).not.toHaveBeenCalled();
- });
- });
- it("globalization.spec.21 getDateNames using type=narrow and item=days options, success callback should be called with a Properties object", function() {
- var win = jasmine.createSpy().andCallFake(function(a) {
- expect(a).toBeDefined();
- expect(typeof a).toBe('object');
- expect(a.value).toBeDefined();
- expect(a.value instanceof Array).toBe(true);
- expect(a.value.length > 0).toBe(true);
- expect(typeof a.value[0]).toBe('string');
- }),
- fail = jasmine.createSpy();
-
- runs(function () {
- navigator.globalization.getDateNames(win, fail, {type: 'narrow', item: 'days'});
- });
-
- waitsFor(function () { return win.wasCalled; }, "win never called", Tests.TEST_TIMEOUT);
-
- runs(function () {
- expect(fail).not.toHaveBeenCalled();
- });
- });
- it("globalization.spec.22 getDateNames using type=narrow and item=months options, success callback should be called with a Properties object", function() {
- var win = jasmine.createSpy().andCallFake(function(a) {
- expect(a).toBeDefined();
- expect(typeof a).toBe('object');
- expect(a.value).toBeDefined();
- expect(a.value instanceof Array).toBe(true);
- expect(a.value.length > 0).toBe(true);
- expect(typeof a.value[0]).toBe('string');
- }),
- fail = jasmine.createSpy();
-
- runs(function () {
- navigator.globalization.getDateNames(win, fail, {type: 'narrow', item: 'months'});
- });
-
- waitsFor(function () { return win.wasCalled; }, "win never called", Tests.TEST_TIMEOUT);
-
- runs(function () {
- expect(fail).not.toHaveBeenCalled();
- });
- });
- it("globalization.spec.23 getDateNames using type=wide and item=days options, success callback should be called with a Properties object", function() {
- var win = jasmine.createSpy().andCallFake(function(a) {
- expect(a).toBeDefined();
- expect(typeof a).toBe('object');
- expect(a.value).toBeDefined();
- expect(a.value instanceof Array).toBe(true);
- expect(a.value.length > 0).toBe(true);
- expect(typeof a.value[0]).toBe('string');
- }),
- fail = jasmine.createSpy();
-
- runs(function () {
- navigator.globalization.getDateNames(win, fail, {type: 'wide', item: 'days'});
- });
-
- waitsFor(function () { return win.wasCalled; }, "win never called", Tests.TEST_TIMEOUT);
-
- runs(function () {
- expect(fail).not.toHaveBeenCalled();
- });
- });
- it("globalization.spec.24 getDateNames using type=wide and item=months options, success callback should be called with a Properties object", function() {
- var win = jasmine.createSpy().andCallFake(function(a) {
- expect(a).toBeDefined();
- expect(typeof a).toBe('object');
- expect(a.value).toBeDefined();
- expect(a.value instanceof Array).toBe(true);
- expect(a.value.length > 0).toBe(true);
- expect(typeof a.value[0]).toBe('string');
- }),
- fail = jasmine.createSpy();
-
- runs(function () {
- navigator.globalization.getDateNames(win, fail, {type: 'wide', item: 'months'});
- });
-
- waitsFor(function () { return win.wasCalled; }, "win never called", Tests.TEST_TIMEOUT);
-
- runs(function () {
- expect(fail).not.toHaveBeenCalled();
- });
- });
- });
-
- describe("isDayLightSavingsTime", function() {
- it("globalization.spec.1 should exist", function() {
- expect(typeof navigator.globalization.isDayLightSavingsTime).toBeDefined();
- expect(typeof navigator.globalization.isDayLightSavingsTime == 'function').toBe(true);
- });
- it("globalization.spec.26 isDayLightSavingsTime using default options, success callback should be called with a Properties object", function() {
- var win = jasmine.createSpy().andCallFake(function(a) {
- expect(a).toBeDefined();
- expect(typeof a).toBe('object');
- expect(a.dst).toBeDefined();
- expect(typeof a.dst).toBe('boolean');
- }),
- fail = jasmine.createSpy();
-
- runs(function () {
- navigator.globalization.isDayLightSavingsTime(new Date(), win, fail);
- });
-
- waitsFor(function () { return win.wasCalled; }, "win never called", Tests.TEST_TIMEOUT);
-
- runs(function () {
- expect(fail).not.toHaveBeenCalled();
- });
- });
- });
-
- describe("getFirstDayOfWeek", function() {
- it("globalization.spec.1 should exist", function() {
- expect(typeof navigator.globalization.getFirstDayOfWeek).toBeDefined();
- expect(typeof navigator.globalization.getFirstDayOfWeek == 'function').toBe(true);
- });
- it("globalization.spec.28 getFirstDayOfWeek success callback should be called with a Properties object", function() {
- var win = jasmine.createSpy().andCallFake(function(a) {
- expect(a).toBeDefined();
- expect(typeof a).toBe('object');
- expect(a.value).toBeDefined();
- expect(typeof a.value).toBe('number');
- }),
- fail = jasmine.createSpy();
-
- runs(function () {
- navigator.globalization.getFirstDayOfWeek(win, fail);
- });
-
- waitsFor(function () { return win.wasCalled; }, "win never called", Tests.TEST_TIMEOUT);
-
- runs(function () {
- expect(fail).not.toHaveBeenCalled();
- });
- });
- });
-
- describe("numberToString", function() {
- it("globalization.spec.1 should exist", function() {
- expect(typeof navigator.globalization.numberToString).toBeDefined();
- expect(typeof navigator.globalization.numberToString == 'function').toBe(true);
- });
- it("globalization.spec.30 numberToString using default options, should be called with a Properties object", function() {
- var win = jasmine.createSpy().andCallFake(function(a) {
- expect(a).toBeDefined();
- expect(typeof a).toBe('object');
- expect(a.value).toBeDefined();
- expect(typeof a.value).toBe('string');
- expect(a.value.length > 0).toBe(true);
- }),
- fail = jasmine.createSpy();
-
- runs(function () {
- navigator.globalization.numberToString(3.25, win, fail);
- });
-
- waitsFor(function () { return win.wasCalled; }, "win never called", Tests.TEST_TIMEOUT);
-
- runs(function () {
- expect(fail).not.toHaveBeenCalled();
- });
- });
- it("globalization.spec.31 numberToString using type=percent options, should be called with a Properties object", function() {
- var win = jasmine.createSpy().andCallFake(function(a) {
- expect(a).toBeDefined();
- expect(typeof a).toBe('object');
- expect(a.value).toBeDefined();
- expect(typeof a.value).toBe('string');
- expect(a.value.length > 0).toBe(true);
- }),
- fail = jasmine.createSpy();
-
- runs(function () {
- navigator.globalization.numberToString(.25, win, fail, {type: 'percent'});
- });
-
- waitsFor(function () { return win.wasCalled; }, "win never called", Tests.TEST_TIMEOUT);
-
- runs(function () {
- expect(fail).not.toHaveBeenCalled();
- });
- });
- it("globalization.spec.32 numberToString using type=currency options, should be called with a Properties object", function() {
- var win = jasmine.createSpy().andCallFake(function(a) {
- expect(a).toBeDefined();
- expect(typeof a).toBe('object');
- expect(a.value).toBeDefined();
- expect(typeof a.value).toBe('string');
- expect(a.value.length > 0).toBe(true);
- }),
- fail = jasmine.createSpy();
-
- runs(function () {
- navigator.globalization.numberToString(5.20, win, fail, {type: 'currency'});
- });
-
- waitsFor(function () { return win.wasCalled; }, "win never called", Tests.TEST_TIMEOUT);
-
- runs(function () {
- expect(fail).not.toHaveBeenCalled();
- });
- });
- });
-
- describe("stringToNumber", function() {
- it("globalization.spec.1 should exist", function() {
- expect(typeof navigator.globalization.stringToNumber).toBeDefined();
- expect(typeof navigator.globalization.stringToNumber == 'function').toBe(true);
- });
- it("globalization.spec.34 stringToNumber using default options, should be called with a Properties object", function() {
- var win = jasmine.createSpy().andCallFake(function(a) {
- expect(a).toBeDefined();
- expect(typeof a).toBe('object');
- expect(a.value).toBeDefined();
- expect(typeof a.value).toBe('number');
- expect(a.value > 0).toBe(true);
- }),
- fail = jasmine.createSpy();
-
- var win2 = function(a) {
- navigator.globalization.stringToNumber(a.value, win, fail);
- };
-
- runs(function () {
- navigator.globalization.numberToString(3.25, win2, fail);
- });
-
- waitsFor(function () { return win.wasCalled; }, "win never called", Tests.TEST_TIMEOUT);
-
- runs(function () {
- expect(fail).not.toHaveBeenCalled();
- });
- });
- it("globalization.spec.35 stringToNumber using type=percent options, should be called with a Properties object", function() {
- var win = jasmine.createSpy().andCallFake(function(a) {
- expect(a).toBeDefined();
- expect(typeof a).toBe('object');
- expect(a.value).toBeDefined();
- expect(typeof a.value).toBe('number');
- expect(a.value > 0).toBe(true);
- }),
- fail = jasmine.createSpy();
-
- var win2 = function(a) {
- navigator.globalization.stringToNumber(a.value, win, fail, {type: 'percent'});
- };
-
- runs(function () {
- navigator.globalization.numberToString(.25, win2, fail, {type: 'percent'});
- });
-
- waitsFor(function () { return win.wasCalled; }, "win never called", Tests.TEST_TIMEOUT);
-
- runs(function () {
- expect(fail).not.toHaveBeenCalled();
- });
- });
- });
-
- describe("getNumberPattern", function() {
- it("globalization.spec.1 should exist", function() {
- expect(typeof navigator.globalization.getNumberPattern).toBeDefined();
- expect(typeof navigator.globalization.getNumberPattern == 'function').toBe(true);
- });
- it("globalization.spec.37 getNumberPattern using default options, success callback should be called with a Properties object", function() {
- var win = jasmine.createSpy().andCallFake(function(a) {
- expect(a).toBeDefined();
- expect(typeof a).toBe('object');
- expect(a.pattern).toBeDefined();
- expect(typeof a.pattern).toBe('string');
- expect(a.pattern.length > 0).toBe(true);
- expect(typeof a.symbol).toBe('string');
- expect(typeof a.fraction).toBe('number');
- expect(typeof a.rounding).toBe('number');
- expect(a.positive).toBeDefined();
- expect(typeof a.positive).toBe('string');
- expect(a.positive.length >= 0).toBe(true);
- expect(a.negative).toBeDefined();
- expect(typeof a.negative).toBe('string');
- expect(a.negative.length >= 0).toBe(true);
- expect(a.decimal).toBeDefined();
- expect(typeof a.decimal).toBe('string');
- expect(a.decimal.length > 0).toBe(true);
- expect(a.grouping).toBeDefined();
- expect(typeof a.grouping).toBe('string');
- expect(a.grouping.length > 0).toBe(true);
- }),
- fail = jasmine.createSpy();
-
- runs(function () {
- navigator.globalization.getNumberPattern(win, fail);
- });
-
- waitsFor(function () { return win.wasCalled; }, "win never called", Tests.TEST_TIMEOUT);
-
- runs(function () {
- expect(fail).not.toHaveBeenCalled();
- });
- });
- it("globalization.spec.38 getNumberPattern using type=percent, success callback should be called with a Properties object", function() {
- var win = jasmine.createSpy().andCallFake(function(a) {
- expect(a).toBeDefined();
- expect(typeof a).toBe('object');
- expect(a.pattern).toBeDefined();
- expect(typeof a.pattern).toBe('string');
- expect(a.pattern.length > 0).toBe(true);
- expect(typeof a.symbol).toBe('string');
- expect(typeof a.fraction).toBe('number');
- expect(typeof a.rounding).toBe('number');
- expect(a.positive).toBeDefined();
- expect(typeof a.positive).toBe('string');
- expect(a.positive.length >= 0).toBe(true);
- expect(a.negative).toBeDefined();
- expect(typeof a.negative).toBe('string');
- expect(a.negative.length >= 0).toBe(true);
- expect(a.decimal).toBeDefined();
- expect(typeof a.decimal).toBe('string');
- expect(a.decimal.length > 0).toBe(true);
- expect(a.grouping).toBeDefined();
- expect(typeof a.grouping).toBe('string');
- expect(a.grouping.length > 0).toBe(true);
- }),
- fail = jasmine.createSpy();
-
- runs(function () {
- navigator.globalization.getNumberPattern(win, fail, {type: 'percent'});
- });
-
- waitsFor(function () { return win.wasCalled; }, "win never called", Tests.TEST_TIMEOUT);
-
- runs(function () {
- expect(fail).not.toHaveBeenCalled();
- });
- });
- it("globalization.spec.39 getNumberPattern using type=currency, success callback should be called with a Properties object", function() {
- var win = jasmine.createSpy().andCallFake(function(a) {
- expect(a).toBeDefined();
- expect(typeof a).toBe('object');
- expect(a.pattern).toBeDefined();
- expect(typeof a.pattern).toBe('string');
- expect(a.pattern.length > 0).toBe(true);
- expect(typeof a.symbol).toBe('string');
- expect(typeof a.fraction).toBe('number');
- expect(typeof a.rounding).toBe('number');
- expect(a.positive).toBeDefined();
- expect(typeof a.positive).toBe('string');
- expect(a.positive.length >= 0).toBe(true);
- expect(a.negative).toBeDefined();
- expect(typeof a.negative).toBe('string');
- expect(a.negative.length >= 0).toBe(true);
- expect(a.decimal).toBeDefined();
- expect(typeof a.decimal).toBe('string');
- expect(a.decimal.length > 0).toBe(true);
- expect(a.grouping).toBeDefined();
- expect(typeof a.grouping).toBe('string');
- expect(a.grouping.length > 0).toBe(true);
- }),
- fail = jasmine.createSpy();
-
- runs(function () {
- navigator.globalization.getNumberPattern(win, fail, {type: 'currency'});
- });
-
- waitsFor(function () { return win.wasCalled; }, "win never called", Tests.TEST_TIMEOUT);
-
- runs(function () {
- expect(fail).not.toHaveBeenCalled();
- });
- });
- });
-
- describe("getCurrencyPattern", function() {
- it("globalization.spec.1 should exist", function() {
- expect(typeof navigator.globalization.getCurrencyPattern).toBeDefined();
- expect(typeof navigator.globalization.getCurrencyPattern == 'function').toBe(true);
- });
- it("globalization.spec.41 getCurrencyPattern using EUR for currency, success callback should be called with a Properties object", function() {
- var win = jasmine.createSpy().andCallFake(function(a) {
- expect(a).toBeDefined();
- expect(typeof a).toBe('object');
- expect(a.pattern).toBeDefined();
- expect(typeof a.pattern).toBe('string');
- expect(a.pattern.length > 0).toBe(true);
- expect(a.code).toBeDefined();
- expect(typeof a.code).toBe('string');
- expect(a.code.length > 0).toBe(true);
- expect(typeof a.fraction).toBe('number');
- expect(typeof a.rounding).toBe('number');
- expect(a.decimal).toBeDefined();
- expect(typeof a.decimal).toBe('string');
- expect(a.decimal.length >= 0).toBe(true);
- expect(a.grouping).toBeDefined();
- expect(typeof a.grouping).toBe('string');
- expect(a.grouping.length >= 0).toBe(true);
- }),
- fail = jasmine.createSpy();
-
- runs(function () {
- navigator.globalization.getCurrencyPattern("EUR", win, fail);
- });
-
- waitsFor(function () { return win.wasCalled; }, "win never called", Tests.TEST_TIMEOUT);
-
- runs(function () {
- expect(fail).not.toHaveBeenCalled();
- });
- });
- });
-});
[14/32] spec commit: CB-6964 removed network tests
Posted by pu...@apache.org.
CB-6964 removed network tests
Project: http://git-wip-us.apache.org/repos/asf/cordova-mobile-spec/repo
Commit: http://git-wip-us.apache.org/repos/asf/cordova-mobile-spec/commit/c3417531
Tree: http://git-wip-us.apache.org/repos/asf/cordova-mobile-spec/tree/c3417531
Diff: http://git-wip-us.apache.org/repos/asf/cordova-mobile-spec/diff/c3417531
Branch: refs/heads/master
Commit: c341753105c35788ea703a5566550e053973e576
Parents: 647bdb1
Author: Staci Cooper <sm...@us.ibm.com>
Authored: Mon Aug 4 11:47:42 2014 -0400
Committer: Staci Cooper <sm...@us.ibm.com>
Committed: Mon Aug 4 11:47:42 2014 -0400
----------------------------------------------------------------------
www/autotest/pages/network.html | 55 -------------------------------
www/autotest/tests/network.tests.js | 56 --------------------------------
www/network/index.html | 48 ---------------------------
www/network/index.js | 38 ----------------------
4 files changed, 197 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cordova-mobile-spec/blob/c3417531/www/autotest/pages/network.html
----------------------------------------------------------------------
diff --git a/www/autotest/pages/network.html b/www/autotest/pages/network.html
deleted file mode 100644
index 6af5521..0000000
--- a/www/autotest/pages/network.html
+++ /dev/null
@@ -1,55 +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>
- <title>Cordova: Network API Specs</title>
-
- <meta name="viewport" content="width=device-width, height=device-height, user-scalable=yes, initial-scale=1.0;" />
- <!-- Load jasmine -->
- <link href="../jasmine.css" rel="stylesheet"/>
- <script type="text/javascript" src="../jasmine.js"></script>
- <script type="text/javascript" src="../html/HtmlReporterHelpers.js"></script>
- <script type="text/javascript" src="../html/HtmlReporter.js"></script>
- <script type="text/javascript" src="../html/ReporterView.js"></script>
- <script type="text/javascript" src="../html/SpecView.js"></script>
- <script type="text/javascript" src="../html/SuiteView.js"></script>
- <script type="text/javascript" src="../html/TrivialReporter.js"></script>
-
- <!-- Source -->
- <script type="text/javascript" src="../../cordova-incl.js"></script>
-
- <!-- Load Test Runner -->
- <script type="text/javascript" src="../test-runner.js"></script>
-
- <!-- Tests -->
- <script type="text/javascript" src="../tests/network.tests.js"></script>
- <script type="text/javascript" charset="utf-8" src="./run-tests.js"></script>
-</head>
-
-<body>
- <a href="javascript:" class="backBtn">Back</a>
-</body>
-</html>
-
http://git-wip-us.apache.org/repos/asf/cordova-mobile-spec/blob/c3417531/www/autotest/tests/network.tests.js
----------------------------------------------------------------------
diff --git a/www/autotest/tests/network.tests.js b/www/autotest/tests/network.tests.js
deleted file mode 100644
index bf3a940..0000000
--- a/www/autotest/tests/network.tests.js
+++ /dev/null
@@ -1,56 +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('Network (navigator.connection)', function () {
- it("network.spec.1 should exist", function() {
- expect(navigator.network && navigator.network.connection).toBeDefined();
- expect(navigator.connection).toBeDefined();
- });
-
- it("network.spec.2 should be set to a valid value", function() {
- var validValues = {
- 'unknown': 1,
- 'ethernet': 1,
- 'wifi': 1,
- '2g': 1,
- 'cellular': 1,
- '3g': 1,
- '4g': 1,
- 'none': 1
- };
- expect(validValues[navigator.connection.type]).toBe(1);
- });
-
- it("network.spec.3 should have the same value in deprecated and non-deprecated apis", function() {
- expect(navigator.network.connection.type).toBe(navigator.connection.type);
- });
-
- it("network.spec.4 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");
- expect(Connection.CELL).toBe("cellular");
- });
-});
http://git-wip-us.apache.org/repos/asf/cordova-mobile-spec/blob/c3417531/www/network/index.html
----------------------------------------------------------------------
diff --git a/www/network/index.html b/www/network/index.html
deleted file mode 100644
index b750f6c..0000000
--- a/www/network/index.html
+++ /dev/null
@@ -1,48 +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="./index.js"></script>
-</script>
-
- </head>
- <body id="stage" class="theme">
-
- <h1>Network Events and State</h1>
- <div id="info">
- <b>Results:</b><br>
- <span id="results"></span>
- </div>
-
- <h2>Action</h2>
- <div class="btn large printNetwork">Show Network Connection</div>
- <h2> </h2><div class="backBtn">Back</div>
- </body>
-</html>
-
http://git-wip-us.apache.org/repos/asf/cordova-mobile-spec/blob/c3417531/www/network/index.js
----------------------------------------------------------------------
diff --git a/www/network/index.js b/www/network/index.js
deleted file mode 100644
index 41c2c47..0000000
--- a/www/network/index.js
+++ /dev/null
@@ -1,38 +0,0 @@
-function eventOutput(s) {
- var el = document.getElementById("results");
- el.innerHTML = el.innerHTML + s + "<br>";
-}
-
-function printNetwork() {
- eventOutput("navigator.connection.type=" + navigator.connection.type);
- eventOutput("navigator.network.connection.type=" + navigator.network.connection.type);
-}
-
-/**
- * Function called when page has finished loading.
- */
-function init() {
- var deviceReady = false;
- function onEvent(e) {
- eventOutput('Event of type: ' + e.type);
- printNetwork();
- }
- document.addEventListener('online', onEvent, false);
- document.addEventListener('offline', onEvent, false);
- document.addEventListener("deviceready", function() {
- deviceReady = true;
- eventOutput("Device="+device.platform+" "+device.version);
- printNetwork();
- }, false);
- window.setTimeout(function() {
- if (!deviceReady) {
- alert("Error: Cordova did not initialize. Demo will not run correctly.");
- }
- }, 1000);
-}
-
-window.onload = function() {
- addListenerToClass('printNetwork', printNetwork);
- addListenerToClass('backBtn', backHome);
- init();
-}
[19/32] spec commit: CB-7196 removed splashscreen tests
Posted by pu...@apache.org.
CB-7196 removed splashscreen tests
Project: http://git-wip-us.apache.org/repos/asf/cordova-mobile-spec/repo
Commit: http://git-wip-us.apache.org/repos/asf/cordova-mobile-spec/commit/16584e03
Tree: http://git-wip-us.apache.org/repos/asf/cordova-mobile-spec/tree/16584e03
Diff: http://git-wip-us.apache.org/repos/asf/cordova-mobile-spec/diff/16584e03
Branch: refs/heads/master
Commit: 16584e03a338f5c9bd0aba83e7a1ed06890d0641
Parents: 647bdb1
Author: Staci Cooper <sm...@us.ibm.com>
Authored: Mon Aug 4 12:07:38 2014 -0400
Committer: Staci Cooper <sm...@us.ibm.com>
Committed: Mon Aug 4 12:07:38 2014 -0400
----------------------------------------------------------------------
www/autotest/pages/splashscreen.html | 55 ---------------------------
www/autotest/tests/splashscreen.tests.js | 36 ------------------
www/splashscreen/index.html | 48 -----------------------
3 files changed, 139 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cordova-mobile-spec/blob/16584e03/www/autotest/pages/splashscreen.html
----------------------------------------------------------------------
diff --git a/www/autotest/pages/splashscreen.html b/www/autotest/pages/splashscreen.html
deleted file mode 100644
index 6ac1c4d..0000000
--- a/www/autotest/pages/splashscreen.html
+++ /dev/null
@@ -1,55 +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>
- <title>Cordova: Splashscreen API Specs</title>
-
- <meta name="viewport" content="width=device-width, height=device-height, user-scalable=yes, initial-scale=1.0;" />
- <!-- Load jasmine -->
- <link href="../jasmine.css" rel="stylesheet"/>
- <script type="text/javascript" src="../jasmine.js"></script>
- <script type="text/javascript" src="../html/HtmlReporterHelpers.js"></script>
- <script type="text/javascript" src="../html/HtmlReporter.js"></script>
- <script type="text/javascript" src="../html/ReporterView.js"></script>
- <script type="text/javascript" src="../html/SpecView.js"></script>
- <script type="text/javascript" src="../html/SuiteView.js"></script>
- <script type="text/javascript" src="../html/TrivialReporter.js"></script>
-
- <!-- Source -->
- <script type="text/javascript" src="../../cordova-incl.js"></script>
-
- <!-- Load Test Runner -->
- <script type="text/javascript" src="../test-runner.js"></script>
-
- <!-- Tests -->
- <script type="text/javascript" src="../tests/splashscreen.tests.js"></script>
- <script type="text/javascript" charset="utf-8" src="./run-tests.js"></script>
-</head>
-
-<body>
- <a href="javascript:" class="backBtn">Back</a>
-</body>
-</html>
-
http://git-wip-us.apache.org/repos/asf/cordova-mobile-spec/blob/16584e03/www/autotest/tests/splashscreen.tests.js
----------------------------------------------------------------------
diff --git a/www/autotest/tests/splashscreen.tests.js b/www/autotest/tests/splashscreen.tests.js
deleted file mode 100644
index a57cb9f..0000000
--- a/www/autotest/tests/splashscreen.tests.js
+++ /dev/null
@@ -1,36 +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('Splashscreen (cordova)', function () {
- it("splashscreen.spec.1 should exist", function() {
- expect(navigator.splashscreen).toBeDefined();
- });
-
- it("splashscreen.spec.2 exec method should exist", function() {
- expect(navigator.splashscreen.show).toBeDefined();
- expect(typeof navigator.splashscreen.show).toBe('function');
- });
-
- it("splashscreen.spec.3 exec method should exist", function() {
- expect(navigator.splashscreen.hide).toBeDefined();
- expect(typeof navigator.splashscreen.hide).toBe('function');
- });
-});
http://git-wip-us.apache.org/repos/asf/cordova-mobile-spec/blob/16584e03/www/splashscreen/index.html
----------------------------------------------------------------------
diff --git a/www/splashscreen/index.html b/www/splashscreen/index.html
deleted file mode 100644
index 19132a4..0000000
--- a/www/splashscreen/index.html
+++ /dev/null
@@ -1,48 +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,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">
- function showFor(duration) {
- navigator.splashscreen.show();
- window.setTimeout(function() {
- navigator.splashscreen.hide();
- }, 1000 * duration);
- }
-</script>
- </head>
- <body id="stage" class="theme">
- <h1>Splashscreen</h1>
- <h2>Action</h2>
- <div class="btn large" onclick="showFor(1)">Show for 1 second</div>
- <div class="btn large" onclick="showFor(5)">Show for 5 seconds</div>
- <h2> </h2><div class="backBtn" onclick="backHome();">Back</div>
- </body>
-</html>
[04/32] spec commit: CB-7094 Removed old file tests
Posted by pu...@apache.org.
CB-7094 Removed old file tests
Project: http://git-wip-us.apache.org/repos/asf/cordova-mobile-spec/repo
Commit: http://git-wip-us.apache.org/repos/asf/cordova-mobile-spec/commit/3920e204
Tree: http://git-wip-us.apache.org/repos/asf/cordova-mobile-spec/tree/3920e204
Diff: http://git-wip-us.apache.org/repos/asf/cordova-mobile-spec/diff/3920e204
Branch: refs/heads/master
Commit: 3920e2044f0fbc4c9da09d2875626bb589c16d07
Parents: 647bdb1
Author: Martin Gonzalez <ma...@gmail.com>
Authored: Fri Aug 1 02:17:26 2014 -0500
Committer: Martin Gonzalez <ma...@gmail.com>
Committed: Fri Aug 1 02:17:26 2014 -0500
----------------------------------------------------------------------
www/autotest/index.html | 1 -
www/autotest/pages/all.html | 1 -
www/autotest/pages/file.html | 53 -
www/autotest/pages/file.js | 39 -
www/autotest/tests/file.tests.js | 4451 ---------------------------------
www/file/index.html | 73 -
www/file/index.js | 171 --
7 files changed, 4789 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cordova-mobile-spec/blob/3920e204/www/autotest/index.html
----------------------------------------------------------------------
diff --git a/www/autotest/index.html b/www/autotest/index.html
index fe1dd91..c223953 100644
--- a/www/autotest/index.html
+++ b/www/autotest/index.html
@@ -43,7 +43,6 @@
<a href="pages/compass.html" class="btn large" style="width:100%;">Run Compass Tests</a>
<a href="pages/contacts.html" class="btn large" style="width:100%;">Run Contacts Tests</a>
<a href="pages/datauri.html" class="btn large" style="width:100%;">Run Data URI Tests</a>
- <a href="pages/file.html" class="btn large" style="width:100%;">Run File Tests</a>
<a href="pages/filetransfer.html" class="btn large" style="width:100%;">Run FileTransfer Tests</a>
<a href="pages/geolocation.html" class="btn large" style="width:100%;">Run Geolocation Tests</a>
<a href="pages/globalization.html" class="btn large" style="width:100%;">Run Globalization Tests</a>
http://git-wip-us.apache.org/repos/asf/cordova-mobile-spec/blob/3920e204/www/autotest/pages/all.html
----------------------------------------------------------------------
diff --git a/www/autotest/pages/all.html b/www/autotest/pages/all.html
index 9ee9180..6e5d783 100644
--- a/www/autotest/pages/all.html
+++ b/www/autotest/pages/all.html
@@ -52,7 +52,6 @@
<script type="text/javascript" src="../tests/contacts.tests.js"></script>
<script type="text/javascript" src="../tests/camera.tests.js"></script>
<script type="text/javascript" src="../tests/datauri.tests.js"></script>
- <script type="text/javascript" src="../tests/file.tests.js"></script>
<script type="text/javascript" src="../tests/filetransfer.tests.js"></script>
<script type="text/javascript" src="../tests/geolocation.tests.js"></script>
<script type="text/javascript" src="../tests/globalization.tests.js"></script>
http://git-wip-us.apache.org/repos/asf/cordova-mobile-spec/blob/3920e204/www/autotest/pages/file.html
----------------------------------------------------------------------
diff --git a/www/autotest/pages/file.html b/www/autotest/pages/file.html
deleted file mode 100644
index d201791..0000000
--- a/www/autotest/pages/file.html
+++ /dev/null
@@ -1,53 +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>
- <title>Cordova: File API Specs</title>
-
- <meta name="viewport" content="width=device-width, height=device-height, user-scalable=yes, initial-scale=1.0;" />
- <!-- Load jasmine -->
- <link href="../jasmine.css" rel="stylesheet"/>
- <script type="text/javascript" src="../jasmine.js"></script>
- <script type="text/javascript" src="../html/HtmlReporterHelpers.js"></script>
- <script type="text/javascript" src="../html/HtmlReporter.js"></script>
- <script type="text/javascript" src="../html/ReporterView.js"></script>
- <script type="text/javascript" src="../html/SpecView.js"></script>
- <script type="text/javascript" src="../html/SuiteView.js"></script>
- <script type="text/javascript" src="../html/TrivialReporter.js"></script>
-
- <!-- Source -->
- <script type="text/javascript" src="../../cordova-incl.js"></script>
-
- <!-- Load Test Runner -->
- <script type="text/javascript" src="../test-runner.js"></script>
-
- <!-- Tests -->
- <script type="text/javascript" src="../tests/file.tests.js"></script>
- <script type="text/javascript" charset="utf-8" src="./file.js"></script>
-</head>
-
-<body>
- <a href="javascript:" class="backBtn">Back</a>
-</body>
-</html>
http://git-wip-us.apache.org/repos/asf/cordova-mobile-spec/blob/3920e204/www/autotest/pages/file.js
----------------------------------------------------------------------
diff --git a/www/autotest/pages/file.js b/www/autotest/pages/file.js
deleted file mode 100644
index 9b1a67a..0000000
--- a/www/autotest/pages/file.js
+++ /dev/null
@@ -1,39 +0,0 @@
-var root, temp_root, persistent_root;
-
-document.addEventListener('deviceready', function () {
- // one-time retrieval of the root file system entry
- var onError = function(e) {
- console.log('[ERROR] Problem setting up root filesystem for test running! Error to follow.');
- console.log(JSON.stringify(e));
- };
-
- window.requestFileSystem(LocalFileSystem.PERSISTENT, 0,
- function(fileSystem) {
- console.log('File API test Init: Setting PERSISTENT FS.');
- root = fileSystem.root; // set in file.tests.js
- persistent_root = root;
-
- // Once root is set up, fire off tests
- var jasmineEnv = jasmine.getEnv();
- jasmineEnv.updateInterval = 1000;
-
- var htmlReporter = new jasmine.HtmlReporter();
-
- jasmineEnv.addReporter(htmlReporter);
-
- jasmineEnv.specFilter = function(spec) {
- return htmlReporter.specFilter(spec);
- };
-
- jasmineEnv.execute();
- }, onError);
- window.requestFileSystem(LocalFileSystem.TEMPORARY, 0,
- function(fileSystem) {
- console.log('File API test Init: Setting TEMPORARY FS.');
- temp_root = fileSystem.root; // set in file.tests.js
- }, onError);
-}, false);
-
-window.onload = function() {
- addListenerToClass('backBtn', backHome);
-}
[27/32] spec commit: Merge branch 'CB-6964' of
https://github.com/stacic/cordova-mobile-spec into CB-7086
Posted by pu...@apache.org.
Merge branch 'CB-6964' of https://github.com/stacic/cordova-mobile-spec into CB-7086
Project: http://git-wip-us.apache.org/repos/asf/cordova-mobile-spec/repo
Commit: http://git-wip-us.apache.org/repos/asf/cordova-mobile-spec/commit/2ab1e2f7
Tree: http://git-wip-us.apache.org/repos/asf/cordova-mobile-spec/tree/2ab1e2f7
Diff: http://git-wip-us.apache.org/repos/asf/cordova-mobile-spec/diff/2ab1e2f7
Branch: refs/heads/master
Commit: 2ab1e2f7fe0c2e2c609e3836a19d1b435575e0f5
Parents: 69a8121 c341753
Author: Jesse MacFadyen <pu...@gmail.com>
Authored: Wed Aug 6 17:48:00 2014 -0700
Committer: Jesse MacFadyen <pu...@gmail.com>
Committed: Wed Aug 6 17:48:00 2014 -0700
----------------------------------------------------------------------
www/autotest/pages/network.html | 55 -------------------------------
www/autotest/tests/network.tests.js | 56 --------------------------------
www/network/index.html | 48 ---------------------------
www/network/index.js | 38 ----------------------
4 files changed, 197 deletions(-)
----------------------------------------------------------------------
[31/32] spec commit: Merge branch 'CB-7195' of
https://github.com/stacic/cordova-mobile-spec into CB-7086
Posted by pu...@apache.org.
Merge branch 'CB-7195' of https://github.com/stacic/cordova-mobile-spec into CB-7086
Project: http://git-wip-us.apache.org/repos/asf/cordova-mobile-spec/repo
Commit: http://git-wip-us.apache.org/repos/asf/cordova-mobile-spec/commit/386914a6
Tree: http://git-wip-us.apache.org/repos/asf/cordova-mobile-spec/tree/386914a6
Diff: http://git-wip-us.apache.org/repos/asf/cordova-mobile-spec/diff/386914a6
Branch: refs/heads/master
Commit: 386914a6c789cc7ef0e3ee3c1e1e991efbae6a1a
Parents: bf3fb94 8de437f
Author: Jesse MacFadyen <pu...@gmail.com>
Authored: Wed Aug 6 17:49:49 2014 -0700
Committer: Jesse MacFadyen <pu...@gmail.com>
Committed: Wed Aug 6 17:49:49 2014 -0700
----------------------------------------------------------------------
www/statusbar/index.html | 49 ----------------------------------
www/statusbar/index.js | 62 -------------------------------------------
2 files changed, 111 deletions(-)
----------------------------------------------------------------------
[28/32] spec commit: Merge branch 'CB-6965' of
https://github.com/stacic/cordova-mobile-spec into CB-7086
Posted by pu...@apache.org.
Merge branch 'CB-6965' of https://github.com/stacic/cordova-mobile-spec into CB-7086
Project: http://git-wip-us.apache.org/repos/asf/cordova-mobile-spec/repo
Commit: http://git-wip-us.apache.org/repos/asf/cordova-mobile-spec/commit/4cbafb51
Tree: http://git-wip-us.apache.org/repos/asf/cordova-mobile-spec/tree/4cbafb51
Diff: http://git-wip-us.apache.org/repos/asf/cordova-mobile-spec/diff/4cbafb51
Branch: refs/heads/master
Commit: 4cbafb510b824c7710adfe9c4dc35ea98f26c2ef
Parents: 2ab1e2f c320371
Author: Jesse MacFadyen <pu...@gmail.com>
Authored: Wed Aug 6 17:48:33 2014 -0700
Committer: Jesse MacFadyen <pu...@gmail.com>
Committed: Wed Aug 6 17:48:33 2014 -0700
----------------------------------------------------------------------
www/autotest/pages/notification.html | 55 --------------
www/autotest/tests/notification.tests.js | 46 ------------
www/notification/index.html | 51 -------------
www/notification/index.js | 100 --------------------------
4 files changed, 252 deletions(-)
----------------------------------------------------------------------
[26/32] spec commit: Merge branch 'CB-7133' of
https://github.com/stacic/cordova-mobile-spec into CB-7086
Posted by pu...@apache.org.
Merge branch 'CB-7133' of https://github.com/stacic/cordova-mobile-spec into CB-7086
Project: http://git-wip-us.apache.org/repos/asf/cordova-mobile-spec/repo
Commit: http://git-wip-us.apache.org/repos/asf/cordova-mobile-spec/commit/69a8121e
Tree: http://git-wip-us.apache.org/repos/asf/cordova-mobile-spec/tree/69a8121e
Diff: http://git-wip-us.apache.org/repos/asf/cordova-mobile-spec/diff/69a8121e
Branch: refs/heads/master
Commit: 69a8121e66f4c006493a962d8424d3bfd1a72c43
Parents: 9d39f36 0cf9184
Author: Jesse MacFadyen <pu...@gmail.com>
Authored: Wed Aug 6 17:47:38 2014 -0700
Committer: Jesse MacFadyen <pu...@gmail.com>
Committed: Wed Aug 6 17:47:38 2014 -0700
----------------------------------------------------------------------
www/inappbrowser/index.html | 236 -------------------------------------
www/inappbrowser/index.js | 242 --------------------------------------
www/inappbrowser/inject.css | 21 ----
www/inappbrowser/inject.html | 43 -------
www/inappbrowser/inject.js | 20 ----
www/inappbrowser/local.html | 64 ----------
www/inappbrowser/local.pdf | Bin 8568 -> 0 bytes
www/inappbrowser/video.html | 42 -------
8 files changed, 668 deletions(-)
----------------------------------------------------------------------
[10/32] spec commit: Removed geolocation tests
Posted by pu...@apache.org.
Removed geolocation tests
Project: http://git-wip-us.apache.org/repos/asf/cordova-mobile-spec/repo
Commit: http://git-wip-us.apache.org/repos/asf/cordova-mobile-spec/commit/08e9b5c4
Tree: http://git-wip-us.apache.org/repos/asf/cordova-mobile-spec/tree/08e9b5c4
Diff: http://git-wip-us.apache.org/repos/asf/cordova-mobile-spec/diff/08e9b5c4
Branch: refs/heads/master
Commit: 08e9b5c48e102b3ae3f7b8972105f8d1ea28d9be
Parents: 647bdb1
Author: Staci Cooper <sm...@us.ibm.com>
Authored: Mon Aug 4 11:33:54 2014 -0400
Committer: Staci Cooper <sm...@us.ibm.com>
Committed: Mon Aug 4 11:33:54 2014 -0400
----------------------------------------------------------------------
www/autotest/pages/geolocation.html | 55 ---------
www/autotest/tests/geolocation.tests.js | 160 ---------------------------
www/location/index.html | 98 ----------------
www/location/index.js | 128 ---------------------
4 files changed, 441 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cordova-mobile-spec/blob/08e9b5c4/www/autotest/pages/geolocation.html
----------------------------------------------------------------------
diff --git a/www/autotest/pages/geolocation.html b/www/autotest/pages/geolocation.html
deleted file mode 100644
index b7a0698..0000000
--- a/www/autotest/pages/geolocation.html
+++ /dev/null
@@ -1,55 +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>
- <title>Cordova: Geolocation API Specs</title>
-
- <meta name="viewport" content="width=device-width, height=device-height, user-scalable=yes, initial-scale=1.0;" />
- <!-- Load jasmine -->
- <link href="../jasmine.css" rel="stylesheet"/>
- <script type="text/javascript" src="../jasmine.js"></script>
- <script type="text/javascript" src="../html/HtmlReporterHelpers.js"></script>
- <script type="text/javascript" src="../html/HtmlReporter.js"></script>
- <script type="text/javascript" src="../html/ReporterView.js"></script>
- <script type="text/javascript" src="../html/SpecView.js"></script>
- <script type="text/javascript" src="../html/SuiteView.js"></script>
- <script type="text/javascript" src="../html/TrivialReporter.js"></script>
-
- <!-- Source -->
- <script type="text/javascript" src="../../cordova-incl.js"></script>
-
- <!-- Load Test Runner -->
- <script type="text/javascript" src="../test-runner.js"></script>
-
- <!-- Tests -->
- <script type="text/javascript" src="../tests/geolocation.tests.js"></script>
- <script type="text/javascript" charset="utf-8" src="./run-tests.js"></script>
-</head>
-
-<body>
- <a href="javascript:" class="backBtn">Back</a>
-</body>
-</html>
-
http://git-wip-us.apache.org/repos/asf/cordova-mobile-spec/blob/08e9b5c4/www/autotest/tests/geolocation.tests.js
----------------------------------------------------------------------
diff --git a/www/autotest/tests/geolocation.tests.js b/www/autotest/tests/geolocation.tests.js
deleted file mode 100644
index bdb0b53..0000000
--- a/www/autotest/tests/geolocation.tests.js
+++ /dev/null
@@ -1,160 +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('Geolocation (navigator.geolocation)', function () {
- it("geolocation.spec.1 should exist", function() {
- expect(navigator.geolocation).toBeDefined();
- });
-
- it("geolocation.spec.2 should contain a getCurrentPosition function", function() {
- expect(typeof navigator.geolocation.getCurrentPosition).toBeDefined();
- expect(typeof navigator.geolocation.getCurrentPosition == 'function').toBe(true);
- });
-
- it("geolocation.spec.3 should contain a watchPosition function", function() {
- expect(typeof navigator.geolocation.watchPosition).toBeDefined();
- expect(typeof navigator.geolocation.watchPosition == 'function').toBe(true);
- });
-
- it("geolocation.spec.4 should contain a clearWatch function", function() {
- expect(typeof navigator.geolocation.clearWatch).toBeDefined();
- expect(typeof navigator.geolocation.clearWatch == 'function').toBe(true);
- });
-
- describe('getCurrentPosition method', function() {
- // this api requires manual user confirmation on windows8 so skip it
- if (cordova.platformId == 'windows8') return;
-
- describe('error callback', function() {
- it("geolocation.spec.5 should be called if we set timeout to 0 and maximumAge to a very small number", function() {
- console.log("Here I am");
- 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", 250); //small timeout as this should fire very fast
-
- runs(function () {
- expect(win).not.toHaveBeenCalled();
- });
- });
- });
-
- describe('success callback', function() {
- it("geolocation.spec.6 should be called with a Position object", function() {
- var providerAvailable=true;
- var win = jasmine.createSpy().andCallFake(function(p) {
- expect(p.coords).toBeDefined();
- expect(p.timestamp).toBeDefined();
- }),
- fail = jasmine.createSpy().andCallFake(function(e) {
- if(e.code == 2) {
- providerAvailable=false;
- }
- });
-
- runs(function () {
- navigator.geolocation.getCurrentPosition(win, fail, {
- maximumAge:300000 // 5 minutes maximum age of cached position
- });
- });
-
- waitsFor(function () { return (win.wasCalled || fail.wasCalled); }, "win/fail never called", 20000);
-
- runs(function () {
- if(providerAvailable) {
- expect(fail).not.toHaveBeenCalled();
- }
- });
- });
- });
- });
-
- describe('watchPosition method', function() {
- // this api requires manual user confirmation on windows8 so skip it
- if (cordova.platformId == 'windows8') return;
-
- describe('error callback', function() {
- var errorWatch = null;
-
- afterEach(function() {
- navigator.geolocation.clearWatch(errorWatch);
- });
- it("geolocation.spec.7 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 () {
- errorWatch = navigator.geolocation.watchPosition(win, fail, {
- maximumAge: 0,
- timeout: 0
- });
- });
-
- waitsFor(function () { return fail.wasCalled; }, "fail never called", 250); // small timeout as this should fire very quickly
-
- runs(function () {
- expect(win).not.toHaveBeenCalled();
- });
- });
- });
-
- describe('success callback', function() {
- var successWatch = null;
-
- afterEach(function() {
- navigator.geolocation.clearWatch(successWatch);
- });
- it("geolocation.spec.8 should be called with a Position object", function() {
- var providerAvailable=true;
- var win = jasmine.createSpy().andCallFake(function(p) {
- expect(p.coords).toBeDefined();
- expect(p.timestamp).toBeDefined();
- }),
- fail = jasmine.createSpy().andCallFake(function(e) {
- if(e.code ==2) {
- providerAvailable=false;
- }
- });
-
- runs(function () {
- successWatch = navigator.geolocation.watchPosition(win, fail, {
- maximumAge:(5 * 60 * 1000) // 5 minutes maximum age of cached position
- });
- });
-
- waitsFor(function () { return (win.wasCalled || fail.wasCalled); }, "win/fail never called", 20000);
-
- runs(function () {
- if(providerAvailable) {
- expect(fail).not.toHaveBeenCalled();
- }
- });
- });
- });
- });
-});
http://git-wip-us.apache.org/repos/asf/cordova-mobile-spec/blob/08e9b5c4/www/location/index.html
----------------------------------------------------------------------
diff --git a/www/location/index.html b/www/location/index.html
deleted file mode 100644
index f0cc7de..0000000
--- a/www/location/index.html
+++ /dev/null
@@ -1,98 +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="./index.js"></script>
- </head>
- <body id="stage" class="theme">
-
- <h1>Location</h1>
- <div id="info">
- <b>Status:</b> <span id="location_status">Stopped</span>
- <table width="100%">
- <tr>
- <td><b>Latitude:</b></td>
- <td id="latitude"> </td>
- <td>(decimal degrees) geographic coordinate [<a href="http://dev.w3.org/geo/api/spec-source.html#lat">#ref]</a></td>
- </tr>
- <tr>
- <td><b>Longitude:</b></td>
- <td id="longitude"> </td>
- <td>(decimal degrees) geographic coordinate [<a href="http://dev.w3.org/geo/api/spec-source.html#lat">#ref]</a></td>
- </tr>
- <tr>
- <td><b>Altitude:</b></td>
- <td id="altitude"> </td>
- <td>null if not supported;<br>
- (meters) height above the [<a href="http://dev.w3.org/geo/api/spec-source.html#ref-wgs">WGS84</a>] ellipsoid. [<a href="http://dev.w3.org/geo/api/spec-source.html#altitude">#ref]</a></td>
- </tr>
- <tr>
- <td><b>Accuracy:</b></td>
- <td id="accuracy"> </td>
- <td>(meters; non-negative; 95% confidence level) the accuracy level of the latitude and longitude coordinates. [<a href="http://dev.w3.org/geo/api/spec-source.html#accuracy">#ref]</a></td>
- </tr>
- <tr>
- <td><b>Heading:</b></td>
- <td id="heading"> </td>
- <td>null if not supported;<br>
- NaN if speed == 0;<br>
- (degrees; 0° ≤ heading < 360°) direction of travel of the hosting device- counting clockwise relative to the true north. [<a href="http://dev.w3.org/geo/api/spec-source.html#heading">#ref]</a></td>
- </tr>
- <tr>
- <td><b>Speed:</b></td>
- <td id="speed"> </td>
- <td>null if not supported;<br>
- (meters per second; non-negative) magnitude of the horizontal component of the hosting device's current velocity. [<a href="http://dev.w3.org/geo/api/spec-source.html#speed">#ref]</a></td>
- </tr>
- <tr>
- <td><b>Altitude Accuracy:</b></td>
- <td id="altitude_accuracy"> </td>
- <td>null if not supported;<br>(meters; non-negative; 95% confidence level) the accuracy level of the altitude. [<a href="http://dev.w3.org/geo/api/spec-source.html#altitude-accuracy">#ref]</a></td>
- </tr>
- <tr>
- <td><b>Time:</b></td>
- <td id="timestamp"> </td>
- <td>(DOMTimeStamp) when the position was acquired [<a href="http://dev.w3.org/geo/api/spec-source.html#timestamp">#ref]</a></td>
- </tr>
- </table>
- </div>
- <h2>Action</h2>
- <h3>Use Built-in WebView navigator.geolocation</h3>
- <a href="javascript:" class="btn large getWebViewLocation">Get Location</a>
- <a href="javascript:" class="btn large watchWebViewLocation">Start Watching Location</a>
- <a href="javascript:" class="btn large stopWebViewLocation">Stop Watching Location</a>
- <a href="javascript:" class="btn large getWebViewLocation30">Get Location Up to 30 Seconds Old</a>
- <h3>Use Cordova Geolocation Plugin</h3>
- <a href="javascript:" class="btn large getLocation">Get Location</a>
- <a href="javascript:" class="btn large watchLocation">Start Watching Location</a>
- <a href="javascript:" class="btn large stopLocation">Stop Watching Location</a>
- <a href="javascript:" class="btn large getLocation30">Get Location Up to 30 Seconds Old</a>
- <h2> </h2><a href="javascript:" class="backBtn"">Back</a>
- </body>
-</html>
http://git-wip-us.apache.org/repos/asf/cordova-mobile-spec/blob/08e9b5c4/www/location/index.js
----------------------------------------------------------------------
diff --git a/www/location/index.js b/www/location/index.js
deleted file mode 100644
index 242919d..0000000
--- a/www/location/index.js
+++ /dev/null
@@ -1,128 +0,0 @@
-var origGeolocation = null;
-var newGeolocation = null;
-
-//-------------------------------------------------------------------------
-// Location
-//-------------------------------------------------------------------------
-var watchLocationId = null;
-
-/**
- * Start watching location
- */
-var watchLocation = function(usePlugin) {
- var geo = usePlugin ? newGeolocation : origGeolocation;
- if (!geo) {
- alert('geolocation object is missing. usePlugin = ' + usePlugin);
- return;
- }
-
- // Success callback
- var success = function(p){
- console.log('watch location success');
- setLocationDetails(p);
- };
-
- // Fail callback
- var fail = function(e){
- console.log("watchLocation fail callback with error code "+e);
- stopLocation(geo);
- };
-
- // Get location
- watchLocationId = geo.watchPosition(success, fail, {enableHighAccuracy: true});
- setLocationStatus("Running");
-};
-
-/**
- * Stop watching the location
- */
-var stopLocation = function(usePlugin) {
- var geo = usePlugin ? newGeolocation : origGeolocation;
- if (!geo) {
- alert('geolocation object is missing. usePlugin = ' + usePlugin);
- return;
- }
- setLocationStatus("Stopped");
- if (watchLocationId) {
- geo.clearWatch(watchLocationId);
- watchLocationId = null;
- }
-};
-
-/**
- * Get current location
- */
-var getLocation = function(usePlugin, opts) {
- var geo = usePlugin ? newGeolocation : origGeolocation;
- if (!geo) {
- alert('geolocation object is missing. usePlugin = ' + usePlugin);
- return;
- }
-
- // Stop location if running
- stopLocation(geo);
-
- // Success callback
- var success = function(p){
- console.log('get location success');
- setLocationDetails(p);
- setLocationStatus("Done");
- };
-
- // Fail callback
- var fail = function(e){
- console.log("getLocation fail callback with error code "+e.code);
- setLocationStatus("Error: "+e.code);
- };
-
- setLocationStatus("Retrieving location...");
-
- // Get location
- geo.getCurrentPosition(success, fail, opts || {enableHighAccuracy: true}); //, {timeout: 10000});
-
-};
-
-/**
- * Set location status
- */
-var setLocationStatus = function(status) {
- document.getElementById('location_status').innerHTML = status;
-};
-var setLocationDetails = function(p) {
-var date = (new Date(p.timestamp));
- document.getElementById('latitude').innerHTML = p.coords.latitude;
- document.getElementById('longitude').innerHTML = p.coords.longitude;
- document.getElementById('altitude').innerHTML = p.coords.altitude;
- document.getElementById('accuracy').innerHTML = p.coords.accuracy;
- document.getElementById('heading').innerHTML = p.coords.heading;
- document.getElementById('speed').innerHTML = p.coords.speed;
- document.getElementById('altitude_accuracy').innerHTML = p.coords.altitudeAccuracy;
- document.getElementById('timestamp').innerHTML = date.toDateString() + " " + date.toTimeString();
-}
-
-/**
- * Function called when page has finished loading.
- */
-function init() {
- document.addEventListener("deviceready", function() {
- newGeolocation = navigator.geolocation;
- origGeolocation = cordova.require('cordova/modulemapper').getOriginalSymbol(window, 'navigator.geolocation');
- if (!origGeolocation) {
- origGeolocation = newGeolocation;
- newGeolocation = null;
- }
- }, false);
-}
-
-window.onload = function() {
- addListenerToClass('getWebViewLocation', getLocation, [false]);
- addListenerToClass('watchWebViewLocation', watchLocation, [false]);
- addListenerToClass('stopWebViewLocation', stopLocation, [false]);
- addListenerToClass('getWebViewLocation30', getLocation, [false, {maximumAge:30000}]);
- addListenerToClass('getLocation', getLocation, [true]);
- addListenerToClass('watchLocation', watchLocation, [true]);
- addListenerToClass('stopLocation', stopLocation, [true]);
- addListenerToClass('getLocation30', getLocation, [true, {maximumAge:30000}]);
- addListenerToClass('backBtn', backHome);
- init();
-}
[08/32] spec commit: Restored page with links to avoid conflic merges
Posted by pu...@apache.org.
Restored page with links to avoid conflic merges
Project: http://git-wip-us.apache.org/repos/asf/cordova-mobile-spec/repo
Commit: http://git-wip-us.apache.org/repos/asf/cordova-mobile-spec/commit/9a3f6797
Tree: http://git-wip-us.apache.org/repos/asf/cordova-mobile-spec/tree/9a3f6797
Diff: http://git-wip-us.apache.org/repos/asf/cordova-mobile-spec/diff/9a3f6797
Branch: refs/heads/master
Commit: 9a3f679781bbcc617fa4aebd9286e6250bfb4e9a
Parents: 4866870
Author: Martin Gonzalez <ma...@gmail.com>
Authored: Fri Aug 1 12:18:55 2014 -0500
Committer: Martin Gonzalez <ma...@gmail.com>
Committed: Fri Aug 1 12:18:55 2014 -0500
----------------------------------------------------------------------
www/autotest/index.html | 1 +
www/autotest/pages/all.html | 1 +
www/index.html | 1 +
3 files changed, 3 insertions(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cordova-mobile-spec/blob/9a3f6797/www/autotest/index.html
----------------------------------------------------------------------
diff --git a/www/autotest/index.html b/www/autotest/index.html
index c223953..fe1dd91 100644
--- a/www/autotest/index.html
+++ b/www/autotest/index.html
@@ -43,6 +43,7 @@
<a href="pages/compass.html" class="btn large" style="width:100%;">Run Compass Tests</a>
<a href="pages/contacts.html" class="btn large" style="width:100%;">Run Contacts Tests</a>
<a href="pages/datauri.html" class="btn large" style="width:100%;">Run Data URI Tests</a>
+ <a href="pages/file.html" class="btn large" style="width:100%;">Run File Tests</a>
<a href="pages/filetransfer.html" class="btn large" style="width:100%;">Run FileTransfer Tests</a>
<a href="pages/geolocation.html" class="btn large" style="width:100%;">Run Geolocation Tests</a>
<a href="pages/globalization.html" class="btn large" style="width:100%;">Run Globalization Tests</a>
http://git-wip-us.apache.org/repos/asf/cordova-mobile-spec/blob/9a3f6797/www/autotest/pages/all.html
----------------------------------------------------------------------
diff --git a/www/autotest/pages/all.html b/www/autotest/pages/all.html
index 6e5d783..9ee9180 100644
--- a/www/autotest/pages/all.html
+++ b/www/autotest/pages/all.html
@@ -52,6 +52,7 @@
<script type="text/javascript" src="../tests/contacts.tests.js"></script>
<script type="text/javascript" src="../tests/camera.tests.js"></script>
<script type="text/javascript" src="../tests/datauri.tests.js"></script>
+ <script type="text/javascript" src="../tests/file.tests.js"></script>
<script type="text/javascript" src="../tests/filetransfer.tests.js"></script>
<script type="text/javascript" src="../tests/geolocation.tests.js"></script>
<script type="text/javascript" src="../tests/globalization.tests.js"></script>
http://git-wip-us.apache.org/repos/asf/cordova-mobile-spec/blob/9a3f6797/www/index.html
----------------------------------------------------------------------
diff --git a/www/index.html b/www/index.html
index 9797a59..39bc875 100644
--- a/www/index.html
+++ b/www/index.html
@@ -63,6 +63,7 @@ User-Agent: <span id="user-agent"> </span></div>
<a href="inappbrowser/index.html" class="btn large">In App Browser</a>
<a href="keyboard/index.html" class="btn large">Keyboard</a>
<a href="vibration/index.html" class="btn large">Vibration</a>
+ <a href="file/index.html" class="btn large">File & File Transfer</a>
<a href="statusbar/index.html" class="btn large">Status Bar</a>
</body>
</html>
[06/32] spec commit: CB-6966 Removed old vibration tests
Posted by pu...@apache.org.
CB-6966 Removed old vibration tests
Project: http://git-wip-us.apache.org/repos/asf/cordova-mobile-spec/repo
Commit: http://git-wip-us.apache.org/repos/asf/cordova-mobile-spec/commit/d640abfb
Tree: http://git-wip-us.apache.org/repos/asf/cordova-mobile-spec/tree/d640abfb
Diff: http://git-wip-us.apache.org/repos/asf/cordova-mobile-spec/diff/d640abfb
Branch: refs/heads/master
Commit: d640abfb35f657ef72793048576e476dcdb8909c
Parents: 647bdb1
Author: Martin Gonzalez <ma...@gmail.com>
Authored: Fri Aug 1 02:30:32 2014 -0500
Committer: Martin Gonzalez <ma...@gmail.com>
Committed: Fri Aug 1 02:30:32 2014 -0500
----------------------------------------------------------------------
www/autotest/index.html | 1 -
www/autotest/pages/vibration.html | 55 ------------------------------
www/autotest/tests/vibration.tests.js | 31 -----------------
www/index.html | 2 --
www/vibration/index.html | 43 -----------------------
www/vibration/index.js | 31 -----------------
6 files changed, 163 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cordova-mobile-spec/blob/d640abfb/www/autotest/index.html
----------------------------------------------------------------------
diff --git a/www/autotest/index.html b/www/autotest/index.html
index fe1dd91..ad20c42 100644
--- a/www/autotest/index.html
+++ b/www/autotest/index.html
@@ -56,7 +56,6 @@
<a href="pages/splashscreen.html" class="btn large" style="width:100%;">Run Splashscreen Tests</a>
<a href="pages/whitelist.html" class="btn large" style="width:100%;">Run Whitelist Tests</a>
<a href="pages/localXHR.html" class="btn large" style="width:100%;">Run local XHR Tests</a>
- <a href="pages/vibration.html" class="btn large" style="width:100%;">Run Vibration Tests</a>
<h2> </h2><div class="backBtn">Back</div>
</body>
</html>
http://git-wip-us.apache.org/repos/asf/cordova-mobile-spec/blob/d640abfb/www/autotest/pages/vibration.html
----------------------------------------------------------------------
diff --git a/www/autotest/pages/vibration.html b/www/autotest/pages/vibration.html
deleted file mode 100644
index 04db2ec..0000000
--- a/www/autotest/pages/vibration.html
+++ /dev/null
@@ -1,55 +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>
- <title>Cordova: Vibration API Specs</title>
-
- <meta name="viewport" content="width=device-width, height=device-height, user-scalable=yes, initial-scale=1.0;" />
- <!-- Load jasmine -->
- <link href="../jasmine.css" rel="stylesheet"/>
- <script type="text/javascript" src="../jasmine.js"></script>
- <script type="text/javascript" src="../html/HtmlReporterHelpers.js"></script>
- <script type="text/javascript" src="../html/HtmlReporter.js"></script>
- <script type="text/javascript" src="../html/ReporterView.js"></script>
- <script type="text/javascript" src="../html/SpecView.js"></script>
- <script type="text/javascript" src="../html/SuiteView.js"></script>
- <script type="text/javascript" src="../html/TrivialReporter.js"></script>
-
- <!-- Source -->
- <script type="text/javascript" src="../../cordova-incl.js"></script>
-
- <!-- Load Test Runner -->
- <script type="text/javascript" src="../test-runner.js"></script>
-
- <!-- Tests -->
- <script type="text/javascript" src="../tests/vibration.tests.js"></script>
- <script type="text/javascript" charset="utf-8" src="./run-tests.js"></script>
-</head>
-
-<body>
- <a href="javascript:" class="backBtn">Back</a>
-</body>
-</html>
-
http://git-wip-us.apache.org/repos/asf/cordova-mobile-spec/blob/d640abfb/www/autotest/tests/vibration.tests.js
----------------------------------------------------------------------
diff --git a/www/autotest/tests/vibration.tests.js b/www/autotest/tests/vibration.tests.js
deleted file mode 100644
index 18e75f2..0000000
--- a/www/autotest/tests/vibration.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('Vibration (navigator.notification.vibrate)', function () {
- it("navigator.notification 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");
- });
-});
http://git-wip-us.apache.org/repos/asf/cordova-mobile-spec/blob/d640abfb/www/index.html
----------------------------------------------------------------------
diff --git a/www/index.html b/www/index.html
index 39bc875..40f5046 100644
--- a/www/index.html
+++ b/www/index.html
@@ -62,8 +62,6 @@ User-Agent: <span id="user-agent"> </span></div>
<a href="benchmarks/index.html" class="btn large">Benchmarks</a>
<a href="inappbrowser/index.html" class="btn large">In App Browser</a>
<a href="keyboard/index.html" class="btn large">Keyboard</a>
- <a href="vibration/index.html" class="btn large">Vibration</a>
- <a href="file/index.html" class="btn large">File & File Transfer</a>
<a href="statusbar/index.html" class="btn large">Status Bar</a>
</body>
</html>
http://git-wip-us.apache.org/repos/asf/cordova-mobile-spec/blob/d640abfb/www/vibration/index.html
----------------------------------------------------------------------
diff --git a/www/vibration/index.html b/www/vibration/index.html
deleted file mode 100644
index a24110e..0000000
--- a/www/vibration/index.html
+++ /dev/null
@@ -1,43 +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="./index.js"></script>
- </head>
- <body id="stage" class="theme">
-
- <h1>Vibrations</h1>
- <div id="info">
- </div>
-
- <h2>Action</h2>
- <div class="btn large vibrate">Vibrate</div>
- <h2> </h2><div class="backBtn">Back</div>
- </body>
-</html>
http://git-wip-us.apache.org/repos/asf/cordova-mobile-spec/blob/d640abfb/www/vibration/index.js
----------------------------------------------------------------------
diff --git a/www/vibration/index.js b/www/vibration/index.js
deleted file mode 100644
index 0d28902..0000000
--- a/www/vibration/index.js
+++ /dev/null
@@ -1,31 +0,0 @@
-var deviceReady = false;
-
-//-------------------------------------------------------------------------
-// Vibrations
-//-------------------------------------------------------------------------
-
-var vibrate = function(){
- navigator.notification.vibrate(2500);
-};
-
-
-/**
- * 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);
-}
-
-window.onload = function() {
- addListenerToClass('vibrate', vibrate);
- addListenerToClass('backBtn', backHome);
- init();
-}
[24/32] spec commit: Merge branch 'CB-7148' of
https://github.com/stacic/cordova-mobile-spec into CB-7086
Posted by pu...@apache.org.
Merge branch 'CB-7148' of https://github.com/stacic/cordova-mobile-spec into CB-7086
Project: http://git-wip-us.apache.org/repos/asf/cordova-mobile-spec/repo
Commit: http://git-wip-us.apache.org/repos/asf/cordova-mobile-spec/commit/d0570d3a
Tree: http://git-wip-us.apache.org/repos/asf/cordova-mobile-spec/tree/d0570d3a
Diff: http://git-wip-us.apache.org/repos/asf/cordova-mobile-spec/diff/d0570d3a
Branch: refs/heads/master
Commit: d0570d3a5940441cd1713b9858cfcd139587b62f
Parents: a228588 e13d878
Author: Jesse MacFadyen <pu...@gmail.com>
Authored: Wed Aug 6 17:46:33 2014 -0700
Committer: Jesse MacFadyen <pu...@gmail.com>
Committed: Wed Aug 6 17:46:33 2014 -0700
----------------------------------------------------------------------
www/autotest/pages/contacts.html | 56 ---
www/autotest/tests/contacts.tests.js | 542 ------------------------------
www/contacts/index.html | 47 ---
www/contacts/index.js | 90 -----
4 files changed, 735 deletions(-)
----------------------------------------------------------------------
[29/32] spec commit: Merge branch 'CB-6962' of
https://github.com/stacic/cordova-mobile-spec into CB-7086
Posted by pu...@apache.org.
Merge branch 'CB-6962' of https://github.com/stacic/cordova-mobile-spec into CB-7086
Project: http://git-wip-us.apache.org/repos/asf/cordova-mobile-spec/repo
Commit: http://git-wip-us.apache.org/repos/asf/cordova-mobile-spec/commit/74eb4c29
Tree: http://git-wip-us.apache.org/repos/asf/cordova-mobile-spec/tree/74eb4c29
Diff: http://git-wip-us.apache.org/repos/asf/cordova-mobile-spec/diff/74eb4c29
Branch: refs/heads/master
Commit: 74eb4c29d53a6cee5c572861608cdc4ecddb2817
Parents: 4cbafb5 7738b67
Author: Jesse MacFadyen <pu...@gmail.com>
Authored: Wed Aug 6 17:49:04 2014 -0700
Committer: Jesse MacFadyen <pu...@gmail.com>
Committed: Wed Aug 6 17:49:04 2014 -0700
----------------------------------------------------------------------
www/autotest/pages/globalization.html | 54 --
www/autotest/tests/globalization.tests.js | 864 -------------------------
2 files changed, 918 deletions(-)
----------------------------------------------------------------------
[11/32] spec commit: CB-7148 removed contacts tests
Posted by pu...@apache.org.
CB-7148 removed contacts tests
Project: http://git-wip-us.apache.org/repos/asf/cordova-mobile-spec/repo
Commit: http://git-wip-us.apache.org/repos/asf/cordova-mobile-spec/commit/e13d8783
Tree: http://git-wip-us.apache.org/repos/asf/cordova-mobile-spec/tree/e13d8783
Diff: http://git-wip-us.apache.org/repos/asf/cordova-mobile-spec/diff/e13d8783
Branch: refs/heads/master
Commit: e13d8783d139dfd1959fcf1328cfdff5862a01ee
Parents: 647bdb1
Author: Staci Cooper <sm...@us.ibm.com>
Authored: Mon Aug 4 11:39:55 2014 -0400
Committer: Staci Cooper <sm...@us.ibm.com>
Committed: Mon Aug 4 11:39:55 2014 -0400
----------------------------------------------------------------------
www/autotest/pages/contacts.html | 56 ---
www/autotest/tests/contacts.tests.js | 542 ------------------------------
www/contacts/index.html | 47 ---
www/contacts/index.js | 90 -----
4 files changed, 735 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cordova-mobile-spec/blob/e13d8783/www/autotest/pages/contacts.html
----------------------------------------------------------------------
diff --git a/www/autotest/pages/contacts.html b/www/autotest/pages/contacts.html
deleted file mode 100644
index e8e5fae..0000000
--- a/www/autotest/pages/contacts.html
+++ /dev/null
@@ -1,56 +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>
- <title>Cordova: Contacts API Specs</title>
-
- <meta name="viewport" content="width=device-width, height=device-height, user-scalable=yes, initial-scale=1.0;" />
- <!-- Load jasmine -->
- <link href="../jasmine.css" rel="stylesheet"/>
- <script type="text/javascript" src="../jasmine.js"></script>
- <script type="text/javascript" src="../html/HtmlReporterHelpers.js"></script>
- <script type="text/javascript" src="../html/HtmlReporter.js"></script>
- <script type="text/javascript" src="../html/ReporterView.js"></script>
- <script type="text/javascript" src="../html/SpecView.js"></script>
- <script type="text/javascript" src="../html/SuiteView.js"></script>
- <script type="text/javascript" src="../html/TrivialReporter.js"></script>
-
- <!-- Source -->
- <script type="text/javascript" src="../../cordova-incl.js"></script>
-
- <!-- Load Test Runner -->
- <script type="text/javascript" src="../test-runner.js"></script>
-
- <!-- Tests -->
- <script type="text/javascript" src="../tests/contacts.tests.js"></script>
-
- <script type="text/javascript" charset="utf-8" src="./run-tests.js"></script>
-</head>
-
-<body>
- <a href="javascript:" class="backBtn" id="backHome">Back</a>
-</body>
-</html>
-
http://git-wip-us.apache.org/repos/asf/cordova-mobile-spec/blob/e13d8783/www/autotest/tests/contacts.tests.js
----------------------------------------------------------------------
diff --git a/www/autotest/tests/contacts.tests.js b/www/autotest/tests/contacts.tests.js
deleted file mode 100644
index 73a605c..0000000
--- a/www/autotest/tests/contacts.tests.js
+++ /dev/null
@@ -1,542 +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.
- *
-*/
-
-// global to store a contact so it doesn't have to be created or retrieved multiple times
-// all of the setup/teardown test methods can reference the following variables to make sure to do the right cleanup
-var gContactObj = null,
- gContactId = null,
- isWindowsPhone = cordova.platformId == 'windowsphone';
-
-var removeContact = function(){
- if (gContactObj) {
- gContactObj.remove(function(){},function(){
- console.log("[CONTACTS ERROR]: removeContact cleanup method failed to clean up test artifacts.");
- });
- gContactObj = null;
- }
-};
-
-describe("Contacts (navigator.contacts)", function () {
- it("contacts.spec.1 should exist", function() {
- expect(navigator.contacts).toBeDefined();
- });
-
- it("contacts.spec.2 should contain a find function", function() {
- expect(navigator.contacts.find).toBeDefined();
- expect(typeof navigator.contacts.find).toBe('function');
- });
-
- describe("find method", function() {
- it("contacts.spec.3 success callback should be called with an array", function() {
- var win = jasmine.createSpy().andCallFake(function(result) {
- expect(result).toBeDefined();
- expect(result instanceof Array).toBe(true);
- }),
- fail = jasmine.createSpy(),
- obj = new ContactFindOptions();
-
- runs(function () {
- obj.filter="";
- obj.multiple=true;
- navigator.contacts.find(["displayName", "name", "phoneNumbers", "emails"], win, fail, obj);
- });
-
- waitsFor(function () { return win.wasCalled; }, "win never called", Tests.TEST_TIMEOUT);
-
- runs(function () {
- expect(fail).not.toHaveBeenCalled();
- });
- });
-
- it("success callback should be called with an array, even if partial ContactFindOptions specified", function () {
- var win = jasmine.createSpy().andCallFake(function (result) {
- expect(result).toBeDefined();
- expect(result instanceof Array).toBe(true);
- }),
- fail = jasmine.createSpy();
-
- runs(function () {
- navigator.contacts.find(["displayName", "name", "phoneNumbers", "emails"], win, fail, {
- multiple: true
- });
- });
-
- waitsFor(function () { return win.wasCalled; }, "win never called", Tests.TEST_TIMEOUT);
-
- runs(function () {
- expect(fail).not.toHaveBeenCalled();
- });
- });
-
- it("contacts.spec.4 should throw an exception if success callback is empty", function() {
- var fail = function() {};
- var obj = new ContactFindOptions();
- obj.filter="";
- obj.multiple=true;
-
- expect(function () {
- navigator.contacts.find(["displayName", "name", "emails", "phoneNumbers"], null, fail, obj);
- }).toThrow();
- });
-
- it("contacts.spec.5 error callback should be called when no fields are specified", function() {
- var win = jasmine.createSpy(),
- fail = jasmine.createSpy(function(result) {
- expect(result).toBeDefined();
- expect(result.code).toBe(ContactError.INVALID_ARGUMENT_ERROR);
- }),
- obj = new ContactFindOptions();
-
- runs(function () {
- obj.filter="";
- obj.multiple=true;
- navigator.contacts.find([], win, fail, obj);
- });
-
- waitsFor(function () { return fail.wasCalled; }, Tests.TEST_TIMEOUT);
-
- runs(function () {
- expect(win).not.toHaveBeenCalled();
- expect(fail).toHaveBeenCalled();
- });
- });
-
- describe("with newly-created contact", function () {
-
- afterEach(removeContact);
-
- it("contacts.spec.6 should be able to find a contact by name", function() {
-
- // this api requires manual user confirmation on WP7/8 so skip it
- if (isWindowsPhone) return;
-
- var foundName = jasmine.createSpy().andCallFake(function(result) {
- var bFound = false;
- try {
- for (var i=0; i < result.length; i++) {
- if (result[i].name.familyName == "Delete") {
- bFound = true;
- break;
- }
- }
- } catch(e) {
- return false;
- }
- return bFound;
- }),
- fail = jasmine.createSpy(),
- test = jasmine.createSpy().andCallFake(function(savedContact) {
- console.log('in test');
- // update so contact will get removed
- gContactObj = savedContact;
- // ----
- // Find asserts
- // ---
- var findWin = jasmine.createSpy().andCallFake(function(object) {
- console.log('in findwin');
- expect(object instanceof Array).toBe(true);
- expect(object.length >= 1).toBe(true);
- expect(foundName(object)).toBe(true);
- }),
- findFail = jasmine.createSpy(),
- obj = new ContactFindOptions();
-
- obj.filter="Delete";
- obj.multiple=true;
-
- runs(function () {
- navigator.contacts.find(["displayName", "name", "phoneNumbers", "emails"], findWin, findFail, obj);
- });
-
- waitsFor(function () { return foundName.wasCalled; }, "foundName not done", Tests.TEST_TIMEOUT);
-
- runs(function () {
- expect(findFail).not.toHaveBeenCalled();
- expect(fail).not.toHaveBeenCalled();
- });
- });
-
- runs(function () {
- gContactObj = new Contact();
- gContactObj.name = new ContactName();
- gContactObj.name.familyName = "Delete";
- gContactObj.save(test, fail);
- });
-
- waitsFor(function () { return test.wasCalled; }, "test not done", Tests.TEST_TIMEOUT);
- });
- });
- });
-
- describe('create method', function() {
-
- it("contacts.spec.7 should exist", function() {
- expect(navigator.contacts.create).toBeDefined();
- expect(typeof navigator.contacts.create).toBe('function');
- });
-
- it("contacts.spec.8 should return a Contact object", function() {
- var bDay = new Date(1976, 7,4);
- var obj = navigator.contacts.create({"displayName": "test name", "gender": "male", "note": "my note", "name": {"formatted": "Mr. Test Name"}, "emails": [{"value": "here@there.com"}, {"value": "there@here.com"}], "birthday": bDay});
-
- expect(obj).toBeDefined();
- expect(obj.displayName).toBe('test name');
- expect(obj.note).toBe('my note');
- expect(obj.name.formatted).toBe('Mr. Test Name');
- expect(obj.emails.length).toBe(2);
- expect(obj.emails[0].value).toBe('here@there.com');
- expect(obj.emails[1].value).toBe('there@here.com');
- expect(obj.nickname).toBe(null);
- expect(obj.birthday).toBe(bDay);
- });
- });
-
- describe("Contact object", function () {
- it("contacts.spec.9 should be able to create instance", function() {
- var contact = new Contact("a", "b", new ContactName("a", "b", "c", "d", "e", "f"), "c", [], [], [], [], [], "f", "i",
- [], [], []);
- expect(contact).toBeDefined();
- expect(contact.id).toBe("a");
- expect(contact.displayName).toBe("b");
- expect(contact.name.formatted).toBe("a");
- expect(contact.nickname).toBe("c");
- expect(contact.phoneNumbers).toBeDefined();
- expect(contact.emails).toBeDefined();
- expect(contact.addresses).toBeDefined();
- expect(contact.ims).toBeDefined();
- expect(contact.organizations).toBeDefined();
- expect(contact.birthday).toBe("f");
- expect(contact.note).toBe("i");
- expect(contact.photos).toBeDefined();
- expect(contact.categories).toBeDefined();
- expect(contact.urls).toBeDefined();
- });
-
- it("contacts.spec.10 should be able to define a ContactName object", function() {
- var contactName = new ContactName("Dr. First Last Jr.", "Last", "First", "Middle", "Dr.", "Jr.");
- expect(contactName).toBeDefined();
- expect(contactName.formatted).toBe("Dr. First Last Jr.");
- expect(contactName.familyName).toBe("Last");
- expect(contactName.givenName).toBe("First");
- expect(contactName.middleName).toBe("Middle");
- expect(contactName.honorificPrefix).toBe("Dr.");
- expect(contactName.honorificSuffix).toBe("Jr.");
- });
-
- it("contacts.spec.11 should be able to define a ContactField object", function() {
- var contactField = new ContactField("home", "8005551212", true);
- expect(contactField).toBeDefined();
- expect(contactField.type).toBe("home");
- expect(contactField.value).toBe("8005551212");
- expect(contactField.pref).toBe(true);
- });
-
- it("contacts.spec.12 ContactField object should coerce type and value properties to strings", function() {
- var contactField = new ContactField(12345678, 12345678, true);
- expect(contactField.type).toBe("12345678");
- expect(contactField.value).toBe("12345678");
- });
-
- it("contacts.spec.13 should be able to define a ContactAddress object", function() {
- var contactAddress = new ContactAddress(true, "home", "a","b","c","d","e","f");
- expect(contactAddress).toBeDefined();
- expect(contactAddress.pref).toBe(true);
- expect(contactAddress.type).toBe("home");
- expect(contactAddress.formatted).toBe("a");
- expect(contactAddress.streetAddress).toBe("b");
- expect(contactAddress.locality).toBe("c");
- expect(contactAddress.region).toBe("d");
- expect(contactAddress.postalCode).toBe("e");
- expect(contactAddress.country).toBe("f");
- });
-
- it("contacts.spec.14 should be able to define a ContactOrganization object", function() {
- var contactOrg = new ContactOrganization(true, "home", "a","b","c","d","e","f","g");
- expect(contactOrg).toBeDefined();
- expect(contactOrg.pref).toBe(true);
- expect(contactOrg.type).toBe("home");
- expect(contactOrg.name).toBe("a");
- expect(contactOrg.department).toBe("b");
- expect(contactOrg.title).toBe("c");
- });
-
- it("contacts.spec.15 should be able to define a ContactFindOptions object", function() {
- var contactFindOptions = new ContactFindOptions("a", true, "b");
- expect(contactFindOptions).toBeDefined();
- expect(contactFindOptions.filter).toBe("a");
- expect(contactFindOptions.multiple).toBe(true);
- });
-
- it("contacts.spec.16 should contain a clone function", function() {
- var contact = new Contact();
- expect(contact.clone).toBeDefined();
- expect(typeof contact.clone).toBe('function');
- });
-
- it("contacts.spec.17 clone function should make deep copy of Contact Object", function() {
- var contact = new Contact();
- contact.id=1;
- contact.displayName="Test Name";
- contact.nickname="Testy";
- contact.gender="male";
- contact.note="note to be cloned";
- contact.name = new ContactName("Mr. Test Name");
-
- var clonedContact = contact.clone();
-
- expect(contact.id).toBe(1);
- expect(clonedContact.id).toBe(null);
- expect(clonedContact.displayName).toBe(contact.displayName);
- expect(clonedContact.nickname).toBe(contact.nickname);
- expect(clonedContact.gender).toBe(contact.gender);
- expect(clonedContact.note).toBe(contact.note);
- expect(clonedContact.name.formatted).toBe(contact.name.formatted);
- expect(clonedContact.connected).toBe(contact.connected);
- });
-
- it("contacts.spec.18 should contain a save function", function() {
- var contact = new Contact();
- expect(contact.save).toBeDefined();
- expect(typeof contact.save).toBe('function');
- });
-
- it("contacts.spec.19 should contain a remove function", function() {
- var contact = new Contact();
- expect(contact.remove).toBeDefined();
- expect(typeof contact.remove).toBe('function');
- });
- });
-
- describe('save method', function () {
- it("contacts.spec.20 should be able to save a contact", function() {
-
- // this api requires manual user confirmation on WP7/8 so skip it
- if (isWindowsPhone) return;
-
- var bDay = new Date(1976, 6,4);
- gContactObj = navigator.contacts.create({"gender": "male", "note": "my note", "name": {"familyName": "Delete", "givenName": "Test"}, "emails": [{"value": "here@there.com"}, {"value": "there@here.com"}], "birthday": bDay});
-
- var saveSuccess = jasmine.createSpy().andCallFake(function(obj) {
- expect(obj).toBeDefined();
- if (cordova.platformId !== 'blackberry10') {
- expect(obj.note).toBe('my note');
- }
- expect(obj.name.familyName).toBe('Delete');
- expect(obj.name.givenName).toBe('Test');
- expect(obj.emails.length).toBe(2);
- expect(obj.emails[0].value).toBe('here@there.com');
- expect(obj.emails[1].value).toBe('there@here.com');
- expect(obj.birthday.toDateString()).toBe(bDay.toDateString());
- expect(obj.addresses).toBe(null);
- // must store returned object in order to have id for update test below
- gContactObj = obj;
- }),
- saveFail = jasmine.createSpy();
-
- runs(function () {
- gContactObj.save(saveSuccess, saveFail);
- });
-
- waitsFor(function () { return saveSuccess.wasCalled; }, "saveSuccess never called", Tests.TEST_TIMEOUT);
-
- runs(function () {
- expect(saveFail).not.toHaveBeenCalled();
- });
- });
- // HACK: there is a reliance between the previous and next test. This is bad form.
- it("contacts.spec.21 update a contact", function() {
-
- // this api requires manual user confirmation on WP7/8 so skip it
- if (isWindowsPhone) return;
-
- expect(gContactObj).toBeDefined();
-
- var bDay = new Date(1975, 5,4);
- var noteText = "an UPDATED note";
-
- var win = jasmine.createSpy().andCallFake(function(obj) {
- expect(obj).toBeDefined();
- expect(obj.id).toBe(gContactObj.id);
- if (cordova.platformId !== 'blackberry10') {
- expect(obj.note).toBe(noteText);
- }
- expect(obj.birthday.toDateString()).toBe(bDay.toDateString());
- expect(obj.emails.length).toBe(1);
- expect(obj.emails[0].value).toBe('here@there.com');
- removeContact(); // Clean up contact object
- }), fail = jasmine.createSpy().andCallFake(removeContact);
-
- runs(function () {
- // remove an email
- gContactObj.emails[1].value = "";
- // change birthday
- gContactObj.birthday = bDay;
- // update note
- gContactObj.note = noteText;
- gContactObj.save(win, fail);
- });
-
- waitsFor(function () { return win.wasCalled; }, "saveSuccess never called", Tests.TEST_TIMEOUT);
-
- runs(function () {
- expect(fail).not.toHaveBeenCalled();
- });
- });
- });
-
- describe('Contact.remove method', function () {
- afterEach(removeContact);
-
- it("contacts.spec.22 calling remove on a contact has an id of null should return ContactError.UNKNOWN_ERROR", function() {
- var win = jasmine.createSpy();
- var fail = jasmine.createSpy().andCallFake(function(result) {
- expect(result.code).toBe(ContactError.UNKNOWN_ERROR);
- });
-
- runs(function () {
- var rmContact = new Contact();
- rmContact.remove(win, fail);
- });
-
- waitsFor(function () { return fail.wasCalled; }, Tests.TEST_TIMEOUT);
-
- runs(function () {
- expect(win).not.toHaveBeenCalled();
- });
- });
-
- it("contacts.spec.23 calling remove on a contact that does not exist should return ContactError.UNKNOWN_ERROR", function() {
- var win = jasmine.createSpy();
- var fail = jasmine.createSpy().andCallFake(function(result) {
- expect(result.code).toBe(ContactError.UNKNOWN_ERROR);
- });
-
- runs(function () {
- var rmContact = new Contact();
- // this is a bit risky as some devices may have contact ids that large
- var contact = new Contact("this string is supposed to be a unique identifier that will never show up on a device");
- contact.remove(win, fail);
- });
-
- waitsFor(function () { return fail.wasCalled; }, Tests.TEST_TIMEOUT);
-
- runs(function () {
- expect(win).not.toHaveBeenCalled();
- });
- });
- });
-
- describe("Round trip Contact tests (creating + save + delete + find).", function () {
- it("contacts.spec.24 Creating, saving, finding a contact should work, removing it should work, after which we should not be able to find it, and we should not be able to delete it again.", function() {
-
- // this api requires manual user confirmation on WP7/8 so skip it
- if (isWindowsPhone) return;
-
- var done = false;
- runs(function () {
- gContactObj = new Contact();
- gContactObj.name = new ContactName();
- gContactObj.name.familyName = "DeleteMe";
- gContactObj.save(function(c_obj) {
- var findWin = function(cs) {
- expect(cs.length).toBe(1);
- // update to have proper saved id
- gContactObj = cs[0];
- gContactObj.remove(function() {
- var findWinAgain = function(seas) {
- expect(seas.length).toBe(0);
- gContactObj.remove(function() {
- throw("success callback called after non-existent Contact object called remove(). Test failed.");
- }, function(e) {
- expect(e.code).toBe(ContactError.UNKNOWN_ERROR);
- done = true;
- });
- };
- var findFailAgain = function(e) {
- throw("find error callback invoked after delete, test failed.");
- };
- var obj = new ContactFindOptions();
- obj.filter="DeleteMe";
- obj.multiple=true;
- navigator.contacts.find(["displayName", "name", "phoneNumbers", "emails"], findWinAgain, findFailAgain, obj);
- }, function(e) {
- throw("Newly created contact's remove function invoked error callback. Test failed.");
- });
- };
- var findFail = function(e) {
- throw("Failure callback invoked in navigator.contacts.find call, test failed.");
- };
- var obj = new ContactFindOptions();
- obj.filter="DeleteMe";
- obj.multiple=true;
- navigator.contacts.find(["displayName", "name", "phoneNumbers", "emails"], findWin, findFail, obj);
- }, function(e) {
- throw("Contact creation failed, error callback was invoked.");
- });
- });
-
- waitsFor(function () { return done; }, Tests.TEST_TIMEOUT);
- });
- });
-
- describe('ContactError interface', function () {
- it("contacts.spec.25 ContactError constants should be defined", function() {
- expect(ContactError.UNKNOWN_ERROR).toBe(0);
- expect(ContactError.INVALID_ARGUMENT_ERROR).toBe(1);
- expect(ContactError.TIMEOUT_ERROR).toBe(2);
- expect(ContactError.PENDING_OPERATION_ERROR).toBe(3);
- expect(ContactError.IO_ERROR).toBe(4);
- expect(ContactError.NOT_SUPPORTED_ERROR).toBe(5);
- expect(ContactError.PERMISSION_DENIED_ERROR).toBe(20);
- });
- });
-
- describe("Contacts autotests cleanup", function () {
- it("contacts.spec.26 Cleanup any DeleteMe contacts from Contacts tests.", function() {
- var done = false;
- var obj = new ContactFindOptions();
- obj.filter="DeleteMe";
- obj.multiple=true;
- runs(function () {
- var findSuccess = function (cs) {
- var contactObj = new Contact();
- if (cs.length>0){
- contactObj = cs[0];
- contactObj.remove(function(){
- console.log("[CONTACTS CLEANUP] DeleteMe contact successfully removed");
- navigator.contacts.find(["displayName", "name", "phoneNumbers", "emails"], findSuccess, findFail, obj);
- },function(){
- console.log("[CONTACTS CLEANUP ERROR]: failed to remove DeleteMe contact");
- });
- } else {
- done = true;
- }
- };
- var findFail = function(e) {
- throw("Failure callback invoked in navigator.contacts.find call, test failed.");
- };
- navigator.contacts.find(["displayName", "name", "phoneNumbers", "emails"], findSuccess, findFail, obj);
- });
- waitsFor(function () { return done; }, Tests.TEST_TIMEOUT);
- });
- });
-
-});
http://git-wip-us.apache.org/repos/asf/cordova-mobile-spec/blob/e13d8783/www/contacts/index.html
----------------------------------------------------------------------
diff --git a/www/contacts/index.html b/www/contacts/index.html
deleted file mode 100644
index 5782713..0000000
--- a/www/contacts/index.html
+++ /dev/null
@@ -1,47 +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="./index.js"></script>
-
- </head>
- <body 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 getContacts">Get phone's contacts</div>
- <div class="btn large addContact">Add a new contact 'Dooney Evans'</div>
- <h2> </h2><div class="backBtn">Back</div>
- </body>
-</html>
http://git-wip-us.apache.org/repos/asf/cordova-mobile-spec/blob/e13d8783/www/contacts/index.js
----------------------------------------------------------------------
diff --git a/www/contacts/index.js b/www/contacts/index.js
deleted file mode 100644
index d3f3312..0000000
--- a/www/contacts/index.js
+++ /dev/null
@@ -1,90 +0,0 @@
-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(){
- 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);
-}
-
-
-window.onload = function() {
- addListenerToClass('getContacts', getContacts);
- addListenerToClass('addContact', addContact);
- addListenerToClass('backBtn', backHome);
- init();
-}
[32/32] spec commit: Merge branch 'CB-7196' of
https://github.com/stacic/cordova-mobile-spec into CB-7086
Posted by pu...@apache.org.
Merge branch 'CB-7196' of https://github.com/stacic/cordova-mobile-spec into CB-7086
Project: http://git-wip-us.apache.org/repos/asf/cordova-mobile-spec/repo
Commit: http://git-wip-us.apache.org/repos/asf/cordova-mobile-spec/commit/3444067f
Tree: http://git-wip-us.apache.org/repos/asf/cordova-mobile-spec/tree/3444067f
Diff: http://git-wip-us.apache.org/repos/asf/cordova-mobile-spec/diff/3444067f
Branch: refs/heads/master
Commit: 3444067f190e4c22eb5a287e93e760389416354a
Parents: 386914a 16584e0
Author: Jesse MacFadyen <pu...@gmail.com>
Authored: Wed Aug 6 17:50:18 2014 -0700
Committer: Jesse MacFadyen <pu...@gmail.com>
Committed: Wed Aug 6 17:50:18 2014 -0700
----------------------------------------------------------------------
www/autotest/pages/splashscreen.html | 55 ---------------------------
www/autotest/tests/splashscreen.tests.js | 36 ------------------
www/splashscreen/index.html | 48 -----------------------
3 files changed, 139 deletions(-)
----------------------------------------------------------------------
[22/32] spec commit: Merge branch 'CB-6966' of
https://github.com/martincgg/cordova-mobile-spec into CB-7086
Posted by pu...@apache.org.
Merge branch 'CB-6966' of https://github.com/martincgg/cordova-mobile-spec into CB-7086
Project: http://git-wip-us.apache.org/repos/asf/cordova-mobile-spec/repo
Commit: http://git-wip-us.apache.org/repos/asf/cordova-mobile-spec/commit/411d75db
Tree: http://git-wip-us.apache.org/repos/asf/cordova-mobile-spec/tree/411d75db
Diff: http://git-wip-us.apache.org/repos/asf/cordova-mobile-spec/diff/411d75db
Branch: refs/heads/master
Commit: 411d75db2be2304fa24f3ce61999b20e2d6a8bbb
Parents: 5b1caba e83156b
Author: Jesse MacFadyen <pu...@gmail.com>
Authored: Wed Aug 6 17:44:57 2014 -0700
Committer: Jesse MacFadyen <pu...@gmail.com>
Committed: Wed Aug 6 17:44:57 2014 -0700
----------------------------------------------------------------------
www/autotest/pages/vibration.html | 55 ------------------------------
www/autotest/tests/vibration.tests.js | 31 -----------------
www/vibration/index.html | 43 -----------------------
www/vibration/index.js | 31 -----------------
4 files changed, 160 deletions(-)
----------------------------------------------------------------------
[21/32] spec commit: Merge branch 'CB-6957' of
https://github.com/martincgg/cordova-mobile-spec into CB-7086
Posted by pu...@apache.org.
Merge branch 'CB-6957' of https://github.com/martincgg/cordova-mobile-spec into CB-7086
Project: http://git-wip-us.apache.org/repos/asf/cordova-mobile-spec/repo
Commit: http://git-wip-us.apache.org/repos/asf/cordova-mobile-spec/commit/5b1caba8
Tree: http://git-wip-us.apache.org/repos/asf/cordova-mobile-spec/tree/5b1caba8
Diff: http://git-wip-us.apache.org/repos/asf/cordova-mobile-spec/diff/5b1caba8
Branch: refs/heads/master
Commit: 5b1caba8208264d16ffc03e80a1b844d50de275e
Parents: 1a1b487 c5b6ea6
Author: Jesse MacFadyen <pu...@gmail.com>
Authored: Wed Aug 6 17:43:55 2014 -0700
Committer: Jesse MacFadyen <pu...@gmail.com>
Committed: Wed Aug 6 17:43:55 2014 -0700
----------------------------------------------------------------------
www/autotest/pages/battery.html | 51 ---------
www/autotest/tests/battery.tests.js | 187 -------------------------------
2 files changed, 238 deletions(-)
----------------------------------------------------------------------
[25/32] spec commit: Merge branch 'CB-6960' of
https://github.com/stacic/cordova-mobile-spec into CB-7086
Posted by pu...@apache.org.
Merge branch 'CB-6960' of https://github.com/stacic/cordova-mobile-spec into CB-7086
Project: http://git-wip-us.apache.org/repos/asf/cordova-mobile-spec/repo
Commit: http://git-wip-us.apache.org/repos/asf/cordova-mobile-spec/commit/9d39f364
Tree: http://git-wip-us.apache.org/repos/asf/cordova-mobile-spec/tree/9d39f364
Diff: http://git-wip-us.apache.org/repos/asf/cordova-mobile-spec/diff/9d39f364
Branch: refs/heads/master
Commit: 9d39f364c9e1661343d6d87329d6cde14b006e8b
Parents: d0570d3 2d8de52
Author: Jesse MacFadyen <pu...@gmail.com>
Authored: Wed Aug 6 17:47:08 2014 -0700
Committer: Jesse MacFadyen <pu...@gmail.com>
Committed: Wed Aug 6 17:47:08 2014 -0700
----------------------------------------------------------------------
www/autotest/pages/compass.html | 55 -------------
www/autotest/tests/compass.tests.js | 136 -------------------------------
www/compass/index.html | 48 -----------
www/compass/index.js | 104 -----------------------
4 files changed, 343 deletions(-)
----------------------------------------------------------------------
[09/32] spec commit: Restored page with links to avoid conflic merges
Posted by pu...@apache.org.
Restored page with links to avoid conflic merges
Project: http://git-wip-us.apache.org/repos/asf/cordova-mobile-spec/repo
Commit: http://git-wip-us.apache.org/repos/asf/cordova-mobile-spec/commit/e83156bd
Tree: http://git-wip-us.apache.org/repos/asf/cordova-mobile-spec/tree/e83156bd
Diff: http://git-wip-us.apache.org/repos/asf/cordova-mobile-spec/diff/e83156bd
Branch: refs/heads/master
Commit: e83156bd76c5e6179a7166b47d357b8703b9ee9a
Parents: d640abf
Author: Martin Gonzalez <ma...@gmail.com>
Authored: Fri Aug 1 12:24:02 2014 -0500
Committer: Martin Gonzalez <ma...@gmail.com>
Committed: Fri Aug 1 12:24:02 2014 -0500
----------------------------------------------------------------------
www/autotest/index.html | 1 +
www/index.html | 2 ++
2 files changed, 3 insertions(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cordova-mobile-spec/blob/e83156bd/www/autotest/index.html
----------------------------------------------------------------------
diff --git a/www/autotest/index.html b/www/autotest/index.html
index ad20c42..fe1dd91 100644
--- a/www/autotest/index.html
+++ b/www/autotest/index.html
@@ -56,6 +56,7 @@
<a href="pages/splashscreen.html" class="btn large" style="width:100%;">Run Splashscreen Tests</a>
<a href="pages/whitelist.html" class="btn large" style="width:100%;">Run Whitelist Tests</a>
<a href="pages/localXHR.html" class="btn large" style="width:100%;">Run local XHR Tests</a>
+ <a href="pages/vibration.html" class="btn large" style="width:100%;">Run Vibration Tests</a>
<h2> </h2><div class="backBtn">Back</div>
</body>
</html>
http://git-wip-us.apache.org/repos/asf/cordova-mobile-spec/blob/e83156bd/www/index.html
----------------------------------------------------------------------
diff --git a/www/index.html b/www/index.html
index 40f5046..39bc875 100644
--- a/www/index.html
+++ b/www/index.html
@@ -62,6 +62,8 @@ User-Agent: <span id="user-agent"> </span></div>
<a href="benchmarks/index.html" class="btn large">Benchmarks</a>
<a href="inappbrowser/index.html" class="btn large">In App Browser</a>
<a href="keyboard/index.html" class="btn large">Keyboard</a>
+ <a href="vibration/index.html" class="btn large">Vibration</a>
+ <a href="file/index.html" class="btn large">File & File Transfer</a>
<a href="statusbar/index.html" class="btn large">Status Bar</a>
</body>
</html>
[23/32] spec commit: Merge branch 'CB-7146' of
https://github.com/stacic/cordova-mobile-spec into CB-7086
Posted by pu...@apache.org.
Merge branch 'CB-7146' of https://github.com/stacic/cordova-mobile-spec into CB-7086
Project: http://git-wip-us.apache.org/repos/asf/cordova-mobile-spec/repo
Commit: http://git-wip-us.apache.org/repos/asf/cordova-mobile-spec/commit/a228588b
Tree: http://git-wip-us.apache.org/repos/asf/cordova-mobile-spec/tree/a228588b
Diff: http://git-wip-us.apache.org/repos/asf/cordova-mobile-spec/diff/a228588b
Branch: refs/heads/master
Commit: a228588b2d13dc60e6f436678090b6f954b006cb
Parents: 411d75d 08e9b5c
Author: Jesse MacFadyen <pu...@gmail.com>
Authored: Wed Aug 6 17:45:51 2014 -0700
Committer: Jesse MacFadyen <pu...@gmail.com>
Committed: Wed Aug 6 17:45:51 2014 -0700
----------------------------------------------------------------------
www/autotest/pages/geolocation.html | 55 ---------
www/autotest/tests/geolocation.tests.js | 160 ---------------------------
www/location/index.html | 98 ----------------
www/location/index.js | 128 ---------------------
4 files changed, 441 deletions(-)
----------------------------------------------------------------------
[03/32] CB-7094 Removed old file tests
Posted by pu...@apache.org.
http://git-wip-us.apache.org/repos/asf/cordova-mobile-spec/blob/3920e204/www/autotest/tests/file.tests.js
----------------------------------------------------------------------
diff --git a/www/autotest/tests/file.tests.js b/www/autotest/tests/file.tests.js
deleted file mode 100644
index 50c9e8e..0000000
--- a/www/autotest/tests/file.tests.js
+++ /dev/null
@@ -1,4451 +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('File API', function() {
- // Adding a Jasmine helper matcher, to report errors when comparing to FileError better.
- var fileErrorMap = {
- 1: 'NOT_FOUND_ERR',
- 2: 'SECURITY_ERR',
- 3: 'ABORT_ERR',
- 4: 'NOT_READABLE_ERR',
- 5: 'ENCODING_ERR',
- 6: 'NO_MODIFICATION_ALLOWED_ERR',
- 7: 'INVALID_STATE_ERR',
- 8: 'SYNTAX_ERR',
- 9: 'INVALID_MODIFICATION_ERR',
- 10:'QUOTA_EXCEEDED_ERR',
- 11:'TYPE_MISMATCH_ERR',
- 12:'PATH_EXISTS_ERR'
- };
- beforeEach(function() {
- this.addMatchers({
- toBeFileError: function(code) {
- var error = this.actual;
- this.message = function(){
- return "Expected FileError with code " + fileErrorMap[error.code] + " (" + error.code + ") to be " + fileErrorMap[code] + "(" + code + ")";
- };
- return (error.code == code);
- },
- toCanonicallyMatch:function(path){
- this.message = function(){
- return "Expected paths to match : " + path + " should be " + this.actual;
- };
-
- var a = path.split("/").join("").split("\\").join("");
- var b = this.actual.split("/").join("").split("\\").join("");
-
- return a == b;
- }
- });
- });
-
- // HELPER FUNCTIONS
-
- // deletes specified file or directory
- var deleteEntry = function(name, success, error) {
- // deletes entry, if it exists
- window.resolveLocalFileSystemURI(root.toURL() + '/' + name,
- function(entry) {
- if (entry.isDirectory === true) {
- entry.removeRecursively(success, error);
- } else {
- entry.remove(success, error);
- }
- }, success);
- };
- // deletes file, if it exists, then invokes callback
- var deleteFile = function(fileName, callback) {
- root.getFile(fileName, null,
- // remove file system entry
- function(entry) {
- entry.remove(callback, function() { console.log('[ERROR] deleteFile cleanup method invoked fail callback.'); });
- },
- // doesn't exist
- callback);
- };
- // deletes and re-creates the specified file
- var createFile = function(fileName, success, error) {
- deleteEntry(fileName, function() {
- root.getFile(fileName, {create: true}, success, error);
- }, error);
- };
- // deletes and re-creates the specified directory
- var createDirectory = function(dirName, success, error) {
- deleteEntry(dirName, function() {
- root.getDirectory(dirName, {create: true}, success, error);
- }, error);
- };
-
- var createFail = function(module) {
- return jasmine.createSpy("Fail").andCallFake(function(err) {
- console.log('[ERROR ' + module + '] ' + JSON.stringify(err));
- });
- };
-
- var joinURL = function(base, extension) {
- if (base.charAt(base.length-1) !== '/' && extension.charAt(0) !== '/') {
- return base + '/' + extension;
- }
- if (base.charAt(base.length-1) === '/' && extension.charAt(0) === '/') {
- return base + exension.substring(1);
- }
- return base + extension;
- };
-
- var createWin = function(module) {
- return jasmine.createSpy("Win").andCallFake(function() {
- console.log('[ERROR ' + module + '] Unexpected success callback');
- });
- };
-
- describe('FileError object', function() {
- it("file.spec.1 should define FileError constants", function() {
- expect(FileError.NOT_FOUND_ERR).toBe(1);
- expect(FileError.SECURITY_ERR).toBe(2);
- expect(FileError.ABORT_ERR).toBe(3);
- expect(FileError.NOT_READABLE_ERR).toBe(4);
- expect(FileError.ENCODING_ERR).toBe(5);
- expect(FileError.NO_MODIFICATION_ALLOWED_ERR).toBe(6);
- expect(FileError.INVALID_STATE_ERR).toBe(7);
- expect(FileError.SYNTAX_ERR).toBe(8);
- expect(FileError.INVALID_MODIFICATION_ERR).toBe(9);
- expect(FileError.QUOTA_EXCEEDED_ERR).toBe(10);
- expect(FileError.TYPE_MISMATCH_ERR).toBe(11);
- expect(FileError.PATH_EXISTS_ERR).toBe(12);
- });
- });
-
- describe('LocalFileSystem', function() {
-
- it("file.spec.2 should define LocalFileSystem constants", function() {
- expect(LocalFileSystem.TEMPORARY).toBe(0);
- expect(LocalFileSystem.PERSISTENT).toBe(1);
- });
-
- describe('window.requestFileSystem', function() {
- it("file.spec.3 should be defined", function() {
- expect(window.requestFileSystem).toBeDefined();
- });
- it("file.spec.4 should be able to retrieve a PERSISTENT file system", function() {
- var win = jasmine.createSpy().andCallFake(function(fileSystem) {
- expect(fileSystem).toBeDefined();
- expect(fileSystem.name).toBeDefined();
- expect(fileSystem.name).toBe("persistent");
- expect(fileSystem.root).toBeDefined();
- expect(fileSystem.root.filesystem).toBeDefined();
- // Shouldn't use cdvfile by default.
- expect(fileSystem.root.toURL()).not.toMatch(/^cdvfile:/);
- // All DirectoryEntry URLs should always have a trailing slash.
- expect(fileSystem.root.toURL()).toMatch(/\/$/);
- }),
- fail = createFail('window.requestFileSystem');
-
- // retrieve PERSISTENT file system
- runs(function() {
- window.requestFileSystem(LocalFileSystem.PERSISTENT, 0, win, fail);
- });
-
- waitsFor(function() { return win.wasCalled; }, "success callback never called", Tests.TEST_TIMEOUT);
-
- runs(function() {
- expect(fail).not.toHaveBeenCalled();
- expect(win).toHaveBeenCalled();
- });
- });
- it("file.spec.5 should be able to retrieve a TEMPORARY file system", function() {
- var win = jasmine.createSpy().andCallFake(function(fileSystem) {
- expect(fileSystem).toBeDefined();
- expect(fileSystem.name).toBeDefined();
- expect(fileSystem.name).toBe("temporary");
- expect(fileSystem.root).toBeDefined();
- expect(fileSystem.root.filesystem).toBeDefined();
- expect(fileSystem.root.filesystem).toBe(fileSystem);
- }),
- fail = createFail('window.requestFileSystem');
-
- // Request the file system
- runs(function() {
- window.requestFileSystem(LocalFileSystem.TEMPORARY, 0, win, fail);
- });
-
- waitsFor(function() { return win.wasCalled; }, "success callback never called", Tests.TEST_TIMEOUT);
-
- runs(function() {
- expect(fail).not.toHaveBeenCalled();
- expect(win).toHaveBeenCalled();
- });
- });
- it("file.spec.6 should error if you request a file system that is too large", function() {
- var fail = jasmine.createSpy().andCallFake(function(error) {
- expect(error).toBeDefined();
- expect(error).toBeFileError(FileError.QUOTA_EXCEEDED_ERR);
- }),
- win = createWin('window.requestFileSystem');
-
- // Request the file system
- runs(function() {
- window.requestFileSystem(LocalFileSystem.TEMPORARY, 1000000000000000, win, fail);
- });
-
- waitsFor(function() { return fail.wasCalled; }, "error callback never called", Tests.TEST_TIMEOUT);
-
- runs(function() {
- expect(win).not.toHaveBeenCalled();
- expect(fail).toHaveBeenCalled();
- });
- });
- it("file.spec.7 should error out if you request a file system that does not exist", function() {
- var fail = jasmine.createSpy().andCallFake(function(error) {
- expect(error).toBeDefined();
- expect(error).toBeFileError(FileError.SYNTAX_ERR);
- }),
- win = createWin('window.requestFileSystem');
-
- // Request the file system
- runs(function() {
- window.requestFileSystem(-1, 0, win, fail);
- });
-
- waitsFor(function() { return fail.wasCalled; }, "error callback never called", Tests.TEST_TIMEOUT);
-
- runs(function() {
- expect(win).not.toHaveBeenCalled();
- expect(fail).toHaveBeenCalled();
- });
- });
- });
-
- describe('window.resolveLocalFileSystemURI', function() {
- it("file.spec.3 should be defined", function() {
- expect(window.resolveLocalFileSystemURI).toBeDefined();
- });
- it("file.spec.9 should resolve a valid file name", function() {
- var createDirectoryFail = createFail('createDirectory');
- var resolveFail = createFail('resolveLocalFileSystemURI');
- var fileName = 'file.spec.9';
- var win = jasmine.createSpy().andCallFake(function(fileEntry) {
- expect(fileEntry).toBeDefined();
- expect(fileEntry.name).toCanonicallyMatch(fileName);
- expect(fileEntry.toURL()).not.toMatch(/^cdvfile:/, 'should not use cdvfile URL');
- expect(fileEntry.toURL()).not.toMatch(/\/$/, 'URL should not end with a slash');
-
- // cleanup
- deleteEntry(fileName);
- });
- function gotDirectory(entry) {
- // lookup file system entry
- window.resolveLocalFileSystemURL(entry.toURL(), win, resolveFail);
- }
- createFile(fileName, gotDirectory, createDirectoryFail, createDirectoryFail);
- waitsForAny(win, resolveFail, createDirectoryFail);
- });
- it("file.spec.9.5 should resolve a directory", function() {
- var createDirectoryFail = createFail('createDirectory');
- var resolveFail = createFail('resolveLocalFileSystemURI');
- var fileName = 'file.spec.9.5';
- var win = jasmine.createSpy().andCallFake(function(fileEntry) {
- expect(fileEntry).toBeDefined();
- expect(fileEntry.name).toCanonicallyMatch(fileName);
- expect(fileEntry.toURL()).not.toMatch(/^cdvfile:/, 'should not use cdvfile URL');
- expect(fileEntry.toURL()).toMatch(/\/$/, 'URL end with a slash');
-
- // cleanup
- deleteEntry(fileName);
- });
- function gotDirectory(entry) {
- // lookup file system entry
- window.resolveLocalFileSystemURL(entry.toURL(), win, resolveFail);
- }
- createDirectory(fileName, gotDirectory, createDirectoryFail, createDirectoryFail);
- waitsForAny(win, resolveFail, createDirectoryFail);
- });
- it("file.spec.10 resolve valid file name with parameters", function() {
- var fileName = "resolve.file.uri.params",
- win = jasmine.createSpy().andCallFake(function(fileEntry) {
- expect(fileEntry).toBeDefined();
- if (fileEntry.toURL().toLowerCase().substring(0,10) === "cdvfile://") {
- expect(fileEntry.fullPath).toBe("/" + fileName + "?1234567890");
- }
- expect(fileEntry.name).toBe(fileName);
-
- // cleanup
- deleteEntry(fileName);
- }),
- fail = createFail('window.resolveLocalFileSystemURI');
- resolveCallback = jasmine.createSpy().andCallFake(function(entry) {
- // lookup file system entry
- runs(function() {
- window.resolveLocalFileSystemURI(entry.toURL() + "?1234567890", win, fail);
- });
-
- waitsFor(function() { return win.wasCalled; }, "resolveLocalFileSystemURI callback never called", Tests.TEST_TIMEOUT);
-
- runs(function() {
- expect(win).toHaveBeenCalled();
- expect(fail).not.toHaveBeenCalled();
- });
- });
-
- // create a new file entry
- runs(function() {
- createFile(fileName, resolveCallback, fail);
- });
-
- waitsFor(function() { return resolveCallback.wasCalled; }, "createFile callback never called", Tests.TEST_TIMEOUT);
- });
- it("file.spec.11 should error (NOT_FOUND_ERR) when resolving (non-existent) invalid file name", function() {
- var fileName = joinURL(root.toURL(), "this.is.not.a.valid.file.txt");
- fail = jasmine.createSpy().andCallFake(function(error) {
- expect(error).toBeDefined();
- expect(error).toBeFileError(FileError.NOT_FOUND_ERR);
- }),
- win = createWin('window.resolveLocalFileSystemURI');
-
- // lookup file system entry
- runs(function() {
- window.resolveLocalFileSystemURI(fileName, win, fail);
- });
-
- waitsFor(function() { return fail.wasCalled; }, "error callback never called", Tests.TEST_TIMEOUT);
-
- runs(function() {
- expect(fail).toHaveBeenCalled();
- expect(win).not.toHaveBeenCalled();
- });
- });
- it("file.spec.12 should error (ENCODING_ERR) when resolving invalid URI with leading /", function() {
- var fail = jasmine.createSpy().andCallFake(function(error) {
- expect(error).toBeDefined();
- expect(error).toBeFileError(FileError.ENCODING_ERR);
- }),
- win = createWin('window.resolveLocalFileSystemURI');
-
- // lookup file system entry
- runs(function() {
- window.resolveLocalFileSystemURI("/this.is.not.a.valid.url", win, fail);
- });
-
- waitsFor(function() { return fail.wasCalled; }, "error callback never called", Tests.TEST_TIMEOUT);
-
- runs(function() {
- expect(fail).toHaveBeenCalled();
- expect(win).not.toHaveBeenCalled();
- });
- });
- });
- });
-
- describe('Metadata interface', function() {
- it("file.spec.13 should exist and have the right properties", function() {
- var metadata = new Metadata();
- expect(metadata).toBeDefined();
- expect(metadata.modificationTime).toBeDefined();
- });
- });
-
- describe('Flags interface', function() {
- it("file.spec.13 should exist and have the right properties", function() {
- var flags = new Flags(false, true);
- expect(flags).toBeDefined();
- expect(flags.create).toBeDefined();
- expect(flags.create).toBe(false);
- expect(flags.exclusive).toBeDefined();
- expect(flags.exclusive).toBe(true);
- });
- });
-
- describe('FileSystem interface', function() {
- it("file.spec.15 should have a root that is a DirectoryEntry", function() {
- var win = jasmine.createSpy().andCallFake(function(entry) {
- expect(entry).toBeDefined();
- expect(entry.isFile).toBe(false);
- expect(entry.isDirectory).toBe(true);
- expect(entry.name).toBeDefined();
- expect(entry.fullPath).toBeDefined();
- expect(entry.getMetadata).toBeDefined();
- expect(entry.moveTo).toBeDefined();
- expect(entry.copyTo).toBeDefined();
- expect(entry.toURL).toBeDefined();
- expect(entry.remove).toBeDefined();
- expect(entry.getParent).toBeDefined();
- expect(entry.createReader).toBeDefined();
- expect(entry.getFile).toBeDefined();
- expect(entry.getDirectory).toBeDefined();
- expect(entry.removeRecursively).toBeDefined();
- }),
- fail = createFail('FileSystem');
-
- runs(function() {
- window.resolveLocalFileSystemURI(root.toURL(), win, fail);
- });
-
- waitsFor(function() { return win.wasCalled; }, "success callback never called", Tests.TEST_TIMEOUT);
-
- runs(function() {
- expect(fail).not.toHaveBeenCalled();
- expect(win).toHaveBeenCalled();
- });
- });
- });
-
- describe('DirectoryEntry', function() {
- it("file.spec.16 getFile: get Entry for file that does not exist", function() {
- var fileName = "de.no.file",
- filePath = joinURL(root.fullPath, fileName),
- fail = jasmine.createSpy().andCallFake(function(error) {
- expect(error).toBeDefined();
- expect(error).toBeFileError(FileError.NOT_FOUND_ERR);
- }),
- win = createWin('DirectoryEntry');
-
- // create:false, exclusive:false, file does not exist
- runs(function() {
- root.getFile(fileName, {create:false}, win, fail);
- });
-
- waitsFor(function() { return fail.wasCalled; }, "error callback never called", Tests.TEST_TIMEOUT);
-
- runs(function() {
- expect(fail).toHaveBeenCalled();
- expect(win).not.toHaveBeenCalled();
- });
- });
- it("file.spec.17 getFile: create new file", function() {
- var fileName = "de.create.file",
- filePath = joinURL(root.fullPath, fileName),
- win = jasmine.createSpy().andCallFake(function(entry) {
- expect(entry).toBeDefined();
- expect(entry.isFile).toBe(true);
- expect(entry.isDirectory).toBe(false);
- expect(entry.name).toCanonicallyMatch(fileName);
- expect(entry.fullPath).toCanonicallyMatch(filePath);
- // cleanup
- entry.remove(null, null);
- }),
- fail = createFail('DirectoryEntry');
-
- // create:true, exclusive:false, file does not exist
- runs(function() {
- root.getFile(fileName, {create: true}, win, fail);
- });
-
- waitsFor(function() { return win.wasCalled; }, "success callback never called", Tests.TEST_TIMEOUT);
-
- runs(function() {
- expect(win).toHaveBeenCalled();
- expect(fail).not.toHaveBeenCalled();
- });
- });
- it("file.spec.18 getFile: create new file (exclusive)", function() {
- var fileName = "de.create.exclusive.file",
- filePath = joinURL(root.fullPath, fileName),
- win = jasmine.createSpy().andCallFake(function(entry) {
- expect(entry).toBeDefined();
- expect(entry.isFile).toBe(true);
- expect(entry.isDirectory).toBe(false);
- expect(entry.name).toBe(fileName);
- expect(entry.fullPath).toCanonicallyMatch(filePath);
-
- // cleanup
- entry.remove(null, null);
- }),
- fail = createFail('DirectoryEntry');
-
- // create:true, exclusive:true, file does not exist
- runs(function() {
- root.getFile(fileName, {create: true, exclusive:true}, win, fail);
- });
-
- waitsFor(function() { return win.wasCalled; }, "success callback never called", Tests.TEST_TIMEOUT);
-
- runs(function() {
- expect(win).toHaveBeenCalled();
- expect(fail).not.toHaveBeenCalled();
- });
- });
- it("file.spec.19 getFile: create file that already exists", function() {
- var fileName = "de.create.existing.file",
- filePath = joinURL(root.fullPath, fileName),
- getFile = jasmine.createSpy().andCallFake(function(file) {
- // create:true, exclusive:false, file exists
- runs(function() {
- root.getFile(fileName, {create:true}, win, fail);
- });
-
- waitsFor(function() { return win.wasCalled; }, "win was never called", Tests.TEST_TIMEOUT);
-
- runs(function() {
- expect(win).toHaveBeenCalled();
- expect(fail).not.toHaveBeenCalled();
- });
- }),
- fail = createFail('DirectoryEntry'),
- win = jasmine.createSpy().andCallFake(function(entry) {
- expect(entry).toBeDefined();
- expect(entry.isFile).toBe(true);
- expect(entry.isDirectory).toBe(false);
- expect(entry.name).toCanonicallyMatch(fileName);
- expect(entry.fullPath).toCanonicallyMatch(filePath);
-
- // cleanup
- entry.remove(null, fail);
- });
- // create file to kick off it
- runs(function() {
- root.getFile(fileName, {create:true}, getFile, fail);
- });
-
- waitsFor(function() { return getFile.wasCalled; }, "getFile was never called", Tests.TEST_TIMEOUT);
- });
- it("file.spec.20 getFile: create file that already exists (exclusive)", function() {
- var fileName = "de.create.exclusive.existing.file",
- filePath = joinURL(root.fullPath, fileName),
- existingFile,
- getFile = jasmine.createSpy().andCallFake(function(file) {
- existingFile = file;
- // create:true, exclusive:true, file exists
- runs(function() {
- root.getFile(fileName, {create:true, exclusive:true}, win, fail);
- });
-
- waitsFor(function() { return fail.wasCalled; }, "fail never called", Tests.TEST_TIMEOUT);
-
- runs(function() {
- expect(fail).toHaveBeenCalled();
- expect(win).not.toHaveBeenCalled();
- });
- }),
- fail = jasmine.createSpy().andCallFake(function(error) {
- expect(error).toBeDefined();
- expect(error).toBeFileError(FileError.PATH_EXISTS_ERR);
-
- // cleanup
- existingFile.remove(null, fail);
- }),
- win = createWin('DirectoryEntry');
-
- // create file to kick off it
- runs(function() {
- root.getFile(fileName, {create:true}, getFile, fail);
- });
-
- waitsFor(function() { return getFile.wasCalled; }, "getFile never called", Tests.TEST_TIMEOUT);
- });
- it("file.spec.21 DirectoryEntry.getFile: get Entry for existing file", function() {
- var fileName = "de.get.file",
- filePath = joinURL(root.fullPath, fileName),
- win = jasmine.createSpy().andCallFake(function(entry) {
- expect(entry).toBeDefined();
- expect(entry.isFile).toBe(true);
- expect(entry.isDirectory).toBe(false);
- expect(entry.name).toCanonicallyMatch(fileName);
- expect(entry.fullPath).toCanonicallyMatch(filePath);
- expect(entry.filesystem).toBeDefined();
- expect(entry.filesystem).toBe(root.filesystem);
- entry.remove(null, fail); //clean up
- }),
- fail = createFail('DirectoryEntry'),
- getFile = jasmine.createSpy().andCallFake(function(file) {
- // create:false, exclusive:false, file exists
- runs(function() {
- root.getFile(fileName, {create:false}, win, fail);
- });
-
- waitsFor(function() { return win.wasCalled; }, "getFile success callback", Tests.TEST_TIMEOUT);
-
- runs(function() {
- expect(win).toHaveBeenCalled();
- expect(fail).not.toHaveBeenCalled();
- });
- });
-
- // create file to kick off it
- runs(function() {
- root.getFile(fileName, {create:true}, getFile, fail);
- });
-
- waitsFor(function() { return getFile.wasCalled; }, "file creation", Tests.TEST_TIMEOUT);
- });
- it("file.spec.22 DirectoryEntry.getFile: get FileEntry for invalid path", function() {
- var fileName = "de:invalid:path",
- fail = jasmine.createSpy().andCallFake(function(error) {
- expect(error).toBeDefined();
- expect(error).toBeFileError(FileError.ENCODING_ERR);
- }),
- win = createWin('DirectoryEntry');
-
- // create:false, exclusive:false, invalid path
- runs(function() {
- root.getFile(fileName, {create:false}, win, fail);
- });
-
- waitsFor(function() { return fail.wasCalled; }, "fail never called", Tests.TEST_TIMEOUT);
-
- runs(function() {
- expect(fail).toHaveBeenCalled();
- expect(win).not.toHaveBeenCalled();
- });
-
- });
- it("file.spec.23 DirectoryEntry.getDirectory: get Entry for directory that does not exist", function() {
- var dirName = "de.no.dir",
- dirPath = joinURL(root.fullPath, dirName),
- fail = jasmine.createSpy().andCallFake(function(error) {
- expect(error).toBeDefined();
- expect(error).toBeFileError(FileError.NOT_FOUND_ERR);
- }),
- win = createWin('DirectoryEntry');
-
- // create:false, exclusive:false, directory does not exist
- runs(function() {
- root.getDirectory(dirName, {create:false}, win, fail);
- });
-
- waitsFor(function() { return fail.wasCalled; }, "fail never called", Tests.TEST_TIMEOUT);
-
- runs(function() {
- expect(fail).toHaveBeenCalled();
- expect(win).not.toHaveBeenCalled();
- });
- });
- it("file.spec.24 DirectoryEntry.getDirectory: create new dir with space then resolveFileSystemURI", function() {
- var dirName = "de create dir",
- dirPath = joinURL(root.fullPath, encodeURIComponent(dirName)),
- getDir = jasmine.createSpy().andCallFake(function(dirEntry) {
- expect(dirEntry.filesystem).toBeDefined();
- expect(dirEntry.filesystem).toBe(root.filesystem);
- var dirURI = dirEntry.toURL();
- // now encode URI and try to resolve
- window.resolveLocalFileSystemURI(dirURI, win, fail);
- }),
- win = jasmine.createSpy().andCallFake(function(directory) {
-
- expect(directory).toBeDefined();
- expect(directory.isFile).toBe(false);
- expect(directory.isDirectory).toBe(true);
- expect(directory.name).toCanonicallyMatch(dirName);
- expect(directory.fullPath).toCanonicallyMatch(joinURL(root.fullPath, dirName));
-
- // cleanup
- directory.remove(null, fail);
- }),
- fail = createFail('DirectoryEntry');
-
- // create:true, exclusive:false, directory does not exist
- root.getDirectory(dirName, {create: true}, getDir, fail);
-
- waitsForAny(fail, win);
- });
-
- // This test is excluded, and should probably be removed. Filesystem
- // should always be properly encoded URLs, and *not* raw paths, and it
- // doesn't make sense to double-encode the URLs and expect that to be
- // handled by the implementation.
- // If a particular platform uses paths internally rather than URLs,
- // then that platform should careful to pass them correctly to its
- // backend.
- xit("file.spec.25 DirectoryEntry.getDirectory: create new dir with space resolveFileSystemURI with encoded URI", function() {
- var dirName = "de create dir2",
- dirPath = joinURL(root.fullPath, dirName),
- getDir = jasmine.createSpy().andCallFake(function(dirEntry) {
- var dirURI = dirEntry.toURL();
- // now encode URI and try to resolve
- runs(function() {
- window.resolveLocalFileSystemURI(encodeURI(dirURI), win, fail);
- });
-
- waitsFor(function() { return win.wasCalled; }, "win never called", Tests.TEST_TIMEOUT);
-
- runs(function() {
- expect(win).toHaveBeenCalled();
- expect(fail).not.toHaveBeenCalled();
- });
- }),
- win = jasmine.createSpy().andCallFake(function(directory) {
- expect(directory).toBeDefined();
- expect(directory.isFile).toBe(false);
- expect(directory.isDirectory).toBe(true);
- expect(directory.name).toCanonicallyMatch(dirName);
- expect(directory.fullPath).toCanonicallyMatch(dirPath);
- // cleanup
- directory.remove(null, fail);
- }),
- fail = createFail('DirectoryEntry');
-
- // create:true, exclusive:false, directory does not exist
- runs(function() {
- root.getDirectory(dirName, {create: true}, getDir, fail);
- });
-
- waitsFor(function() { return getDir.wasCalled; }, "getDir never called", Tests.TEST_TIMEOUT);
- });
-
- it("file.spec.26 DirectoryEntry.getDirectory: create new directory", function() {
- var dirName = "de.create.dir",
- dirPath = joinURL(root.fullPath, dirName),
- win = jasmine.createSpy().andCallFake(function(directory) {
- expect(directory).toBeDefined();
- expect(directory.isFile).toBe(false);
- expect(directory.isDirectory).toBe(true);
- expect(directory.name).toCanonicallyMatch(dirName);
- expect(directory.fullPath).toCanonicallyMatch(dirPath);
- expect(directory.filesystem).toBeDefined();
- expect(directory.filesystem).toBe(root.filesystem);
-
- // cleanup
- directory.remove(null, fail);
- }),
- fail = createFail('DirectoryEntry');
-
- // create:true, exclusive:false, directory does not exist
- runs(function() {
- root.getDirectory(dirName, {create: true}, win, fail);
- });
-
- waitsFor(function() { return win.wasCalled; }, "win never called", Tests.TEST_TIMEOUT);
-
- runs(function() {
- expect(win).toHaveBeenCalled();
- expect(fail).not.toHaveBeenCalled();
- });
- });
-
- it("file.spec.27 DirectoryEntry.getDirectory: create new directory (exclusive)", function() {
- var dirName = "de.create.exclusive.dir",
- dirPath = joinURL(root.fullPath, dirName),
- win = jasmine.createSpy().andCallFake(function(directory) {
- expect(directory).toBeDefined();
- expect(directory.isFile).toBe(false);
- expect(directory.isDirectory).toBe(true);
- expect(directory.name).toCanonicallyMatch(dirName);
- expect(directory.fullPath).toCanonicallyMatch(dirPath);
- expect(directory.filesystem).toBeDefined();
- expect(directory.filesystem).toBe(root.filesystem);
-
- // cleanup
- directory.remove(null, fail);
- }),
- fail = createFail('DirectoryEntry');
- // create:true, exclusive:true, directory does not exist
- runs(function() {
- root.getDirectory(dirName, {create: true, exclusive:true}, win, fail);
- });
-
- waitsFor(function() { return win.wasCalled; }, "win never called", Tests.TEST_TIMEOUT);
-
- runs(function() {
- expect(win).toHaveBeenCalled();
- expect(fail).not.toHaveBeenCalled();
- });
- });
- it("file.spec.28 DirectoryEntry.getDirectory: create directory that already exists", function() {
- var dirName = "de.create.existing.dir",
- dirPath = joinURL(root.fullPath, dirName),
- getDir = jasmine.createSpy().andCallFake(function(directory) {
- // create:true, exclusive:false, directory exists
- runs(function() {
- root.getDirectory(dirName, {create:true}, win, fail);
- });
-
- waitsFor(function() { return win.wasCalled; }, "win never called", Tests.TEST_TIMEOUT);
-
- runs(function() {
- expect(win).toHaveBeenCalled();
- expect(fail).not.toHaveBeenCalled();
- });
- }),
- win = jasmine.createSpy().andCallFake(function(directory) {
- expect(directory).toBeDefined();
- expect(directory.isFile).toBe(false);
- expect(directory.isDirectory).toBe(true);
- expect(directory.name).toCanonicallyMatch(dirName);
- expect(directory.fullPath).toCanonicallyMatch(dirPath);
-
- // cleanup
- directory.remove(null, fail);
- }),
- fail = createFail('DirectoryEntry');
-
- // create directory to kick off it
- runs(function() {
- root.getDirectory(dirName, {create:true}, getDir, this.fail);
- });
-
- waitsFor(function() { return getDir.wasCalled; }, "getDir never called", Tests.TEST_TIMEOUT);
- });
- it("file.spec.29 DirectoryEntry.getDirectory: create directory that already exists (exclusive)", function() {
- var dirName = "de.create.exclusive.existing.dir",
- dirPath = joinURL(root.fullPath, dirName),
- existingDir,
- getDir = jasmine.createSpy().andCallFake(function(directory) {
- existingDir = directory;
- // create:true, exclusive:true, directory exists
- runs(function() {
- root.getDirectory(dirName, {create:true, exclusive:true}, win, fail);
- });
-
- waitsFor(function() { return fail.wasCalled; }, "fail never called", Tests.TEST_TIMEOUT);
-
- runs(function() {
- expect(fail).toHaveBeenCalled();
- expect(win).not.toHaveBeenCalled();
- });
- }),
- fail = jasmine.createSpy().andCallFake(function(error) {
- expect(error).toBeDefined();
- expect(error).toBeFileError(FileError.PATH_EXISTS_ERR);
-
- // cleanup
- existingDir.remove(null, fail);
- }),
- win = createWin('DirectoryEntry');
-
- // create directory to kick off it
- runs(function() {
- root.getDirectory(dirName, {create:true}, getDir, fail);
- });
-
- waitsFor(function() { return getDir.wasCalled; }, "getDir never called", Tests.TEST_TIMEOUT);
- });
- it("file.spec.30 DirectoryEntry.getDirectory: get Entry for existing directory", function() {
- var dirName = "de.get.dir",
- dirPath = joinURL(root.fullPath, dirName),
- getDir = jasmine.createSpy().andCallFake(function(directory) {
- // create:false, exclusive:false, directory exists
- runs(function() {
- root.getDirectory(dirName, {create:false}, win, fail);
- });
-
- waitsFor(function() { return win.wasCalled; }, "win never called", Tests.TEST_TIMEOUT);
-
- runs(function() {
- expect(win).toHaveBeenCalled();
- expect(fail).not.toHaveBeenCalled();
- });
- }),
- win = jasmine.createSpy().andCallFake(function(directory) {
- expect(directory).toBeDefined();
- expect(directory.isFile).toBe(false);
- expect(directory.isDirectory).toBe(true);
- expect(directory.name).toCanonicallyMatch(dirName);
-
- expect(directory.fullPath).toCanonicallyMatch(dirPath);
-
- // cleanup
- directory.remove(null, fail);
- }),
- fail = createFail('DirectoryEntry');
-
- // create directory to kick it off
- runs(function() {
- root.getDirectory(dirName, {create:true}, getDir, fail);
- });
- waitsFor(function() { return getDir.wasCalled; }, "getDir never called", Tests.TEST_TIMEOUT);
- });
- it("file.spec.31 DirectoryEntry.getDirectory: get DirectoryEntry for invalid path", function() {
- var dirName = "de:invalid:path",
- fail = jasmine.createSpy().andCallFake(function(error) {
- expect(error).toBeDefined();
- expect(error).toBeFileError(FileError.ENCODING_ERR);
- }),
- win = createWin('DirectoryEntry');
-
- // create:false, exclusive:false, invalid path
- runs(function() {
- root.getDirectory(dirName, {create:false}, win, fail);
- });
-
- waitsFor(function() { return fail.wasCalled; }, "fail never called", Tests.TEST_TIMEOUT);
-
- runs(function() {
- expect(fail).toHaveBeenCalled();
- expect(win).not.toHaveBeenCalled();
- });
- });
- it("file.spec.32 DirectoryEntry.getDirectory: get DirectoryEntry for existing file", function() {
- var fileName = "de.existing.file",
- existingFile,
- filePath = joinURL(root.fullPath, fileName),
- getDir = jasmine.createSpy().andCallFake(function(file) {
- existingFile = file;
- // create:false, exclusive:false, existing file
- runs(function() {
- root.getDirectory(fileName, {create:false}, win, fail);
- });
-
- waitsFor(function() { return fail.wasCalled; }, "fail never called", Tests.TEST_TIMEOUT);
-
- runs(function() {
- expect(fail).toHaveBeenCalled();
- expect(win).not.toHaveBeenCalled();
- });
- }),
- fail = jasmine.createSpy().andCallFake(function(error) {
- expect(error).toBeDefined();
- expect(error).toBeFileError(FileError.TYPE_MISMATCH_ERR);
-
- // cleanup
- existingFile.remove(null, null);
- }),
- win = createWin('DirectoryEntry');
-
- // create file to kick off it
- runs(function() {
- root.getFile(fileName, {create:true}, getDir, fail);
- });
-
- waitsFor(function() { return getDir.wasCalled; }, "getDir was never called", Tests.TEST_TIMEOUT);
- });
- it("file.spec.33 DirectoryEntry.getFile: get FileEntry for existing directory", function() {
- var dirName = "de.existing.dir",
- existingDir,
- dirPath = joinURL(root.fullPath, dirName),
- getFile = jasmine.createSpy().andCallFake(function(directory) {
- existingDir = directory;
- // create:false, exclusive:false, existing directory
- runs(function() {
- root.getFile(dirName, {create:false}, win, fail);
- });
-
- waitsFor(function() { return fail.wasCalled; }, "fail never called", Tests.TEST_TIMEOUT);
-
- runs(function() {
- expect(fail).toHaveBeenCalled();
- expect(win).not.toHaveBeenCalled();
- });
- }),
- fail = jasmine.createSpy().andCallFake(function(error) {
- expect(error).toBeDefined();
- expect(error).toBeFileError(FileError.TYPE_MISMATCH_ERR);
-
- // cleanup
- existingDir.remove(null, null);
- }),
- win = createWin('DirectoryEntry');
-
- // create directory to kick off it
- runs(function() {
- root.getDirectory(dirName, {create:true}, getFile, fail);
- });
-
- waitsFor(function() { return getFile.wasCalled; }, "getFile never called", Tests.TEST_TIMEOUT);
- });
- it("file.spec.34 DirectoryEntry.removeRecursively on directory", function() {
- var dirName = "de.removeRecursively",
- subDirName = "dir",
- dirPath = joinURL(root.fullPath, dirName),
- subDirPath = joinURL(dirPath, subDirName),
- entryCallback = jasmine.createSpy().andCallFake(function(entry) {
- // delete directory
- var deleteDirectory = jasmine.createSpy().andCallFake(function(directory) {
- runs(function() {
- entry.removeRecursively(remove, fail);
- });
-
- waitsFor(function() { return remove.wasCalled; }, "remove never called", Tests.TEST_TIMEOUT);
- });
- // create a sub-directory within directory
- runs(function() {
- entry.getDirectory(subDirName, {create: true}, deleteDirectory, fail);
- });
-
- waitsFor(function() { return deleteDirectory.wasCalled; }, "deleteDirectory never called", Tests.TEST_TIMEOUT);
- }),
- remove = jasmine.createSpy().andCallFake(function() {
- // it that removed directory no longer exists
- runs(function() {
- root.getDirectory(dirName, {create:false}, win, dirExists);
- });
-
- waitsFor(function() { return dirExists.wasCalled; }, "dirExists never called", Tests.TEST_TIMEOUT);
-
- runs(function() {
- expect(dirExists).toHaveBeenCalled();
- expect(win).not.toHaveBeenCalled();
- });
- }),
- dirExists = jasmine.createSpy().andCallFake(function(error){
- expect(error).toBeDefined();
- expect(error).toBeFileError(FileError.NOT_FOUND_ERR);
- }),
- fail = createFail('DirectoryEntry'),
- win = createWin('DirectoryEntry');
-
- // create a new directory entry to kick off it
- runs(function() {
- root.getDirectory(dirName, {create:true}, entryCallback, fail);
- });
-
- waitsFor(function() { return entryCallback.wasCalled; }, "entryCallback never called", Tests.TEST_TIMEOUT);
- });
- it("file.spec.35 createReader: create reader on existing directory", function() {
- // create reader for root directory
- var reader = root.createReader();
- expect(reader).toBeDefined();
- expect(typeof reader.readEntries).toBe('function');
- });
- it("file.spec.36 removeRecursively on root file system", function() {
- var remove = jasmine.createSpy().andCallFake(function(error) {
- expect(error).toBeDefined();
- expect(error).toBeFileError(FileError.NO_MODIFICATION_ALLOWED_ERR);
- }),
- win = createWin('DirectoryEntry');
-
- // remove root file system
- runs(function() {
- root.removeRecursively(win, remove);
- });
-
- waitsFor(function() { return remove.wasCalled; }, "remove never called", Tests.TEST_TIMEOUT);
-
- runs(function() {
- expect(win).not.toHaveBeenCalled();
- expect(remove).toHaveBeenCalled();
- });
- });
- });
-
- describe('DirectoryReader interface', function() {
- describe("readEntries", function() {
- it("file.spec.37 should read contents of existing directory", function() {
- var reader,
- win = jasmine.createSpy().andCallFake(function(entries) {
- expect(entries).toBeDefined();
- expect(entries instanceof Array).toBe(true);
- }),
- fail = createFail('DirectoryReader');
-
- // create reader for root directory
- reader = root.createReader();
- // read entries
- runs(function() {
- reader.readEntries(win, fail);
- });
-
- waitsFor(function() { return win.wasCalled; }, "win never called", Tests.TEST_TIMEOUT);
-
- runs(function() {
- expect(win).toHaveBeenCalled();
- expect(fail).not.toHaveBeenCalled();
- });
- });
- it("file.spec.37.1 should read contents of existing directory", function(done) {
- var fail = createFail('DirectoryReader', done),
- dirName = 'readEntries.dir',
- fileName = 'readeEntries.file';
- root.getDirectory(dirName, {create: true}, function(directory) {
- directory.getFile(fileName, {create: true}, function(fileEntry) {
- var reader = directory.createReader();
- reader.readEntries(function(entries) {
- expect(entries).toBeDefined();
- expect(entries instanceof Array).toBe(true);
- expect(entries.length).toBe(1);
- expect(entries[0].fullPath).toCanonicallyMatch(fileEntry.fullPath);
- expect(entries[0].filesystem).not.toBe(null)
- expect(entries[0].filesystem instanceof FileSystem).toBe(true)
-
- // cleanup
- directory.removeRecursively(done, fail);
- }, fail);
- }, fail);
- }, fail);
- });
- it("file.spec.109 should return an empty entry list on the second call", function() {
- var reader,
- firstWin = jasmine.createSpy().andCallFake(function(entries) {
- expect(entries).toBeDefined();
- expect(entries instanceof Array).toBe(true);
- expect(entries.length).not.toBe(0);
- reader.readEntries(secondWin, fail);
- }),
- secondWin = jasmine.createSpy().andCallFake(function(entries) {
- expect(entries).toBeDefined();
- expect(entries instanceof Array).toBe(true);
- expect(entries.length).toBe(0);
- }),
- fail = createFail('DirectoryReader');
-
- runs(function() {
- // Add a file to ensure the root directory is non-empty and then read the contents of the directory.
- root.getFile('test109.txt', { create: true }, function() {
- reader = root.createReader();
- reader.readEntries(firstWin, fail);
- }, fail);
- });
-
- waitsFor(function() { return secondWin.wasCalled; }, "secondWin never called", Tests.TEST_TIMEOUT);
-
- runs(function() {
- expect(firstWin).toHaveBeenCalled();
- expect(secondWin).toHaveBeenCalled();
- expect(fail).not.toHaveBeenCalled();
-
- // Remove the test file.
- root.getFile('test109.txt', { create: false }, function(fileEntry) {
- fileEntry.remove();
- }, fail);
- });
- });
- it("file.spec.38 should read contents of directory that has been removed", function() {
- var dirName = "de.createReader.notfound",
- dirPath = joinURL(root.fullPath, dirName),
- entryCallback = jasmine.createSpy().andCallFake(function(directory) {
- // read entries
- var readEntries = jasmine.createSpy().andCallFake(function() {
- var reader = directory.createReader();
-
- runs(function() {
- reader.readEntries(win, itReader);
- });
-
- waitsFor(function() { return itReader.wasCalled; }, "itReader never called", Tests.TEST_TIMEOUT);
- });
- // delete directory
- runs(function() {
- directory.removeRecursively(readEntries, fail);
- });
-
- waitsFor(function() { return readEntries.wasCalled; }, "readEntries never called", Tests.TEST_TIMEOUT);
- }),
- itReader = jasmine.createSpy().andCallFake(function(error) {
- var itDirectoryExists = jasmine.createSpy().andCallFake(function(error) {
- expect(error).toBeDefined();
- expect(error).toBeFileError(FileError.NOT_FOUND_ERR);
- });
-
- expect(error).toBeDefined();
- expect(error).toBeFileError(FileError.NOT_FOUND_ERR);
-
- runs(function() {
- root.getDirectory(dirName, {create:false}, win, itDirectoryExists);
- });
-
- waitsFor(function() { return itDirectoryExists.wasCalled; }, "itDirectoryExists never called", Tests.TEST_TIMEOUT);
-
- runs(function() {
- expect(itDirectoryExists).toHaveBeenCalled();
- expect(win).not.toHaveBeenCalled();
- });
- }),
- fail = createFail('DirectoryReader'),
- win = createWin('DirectoryReader');
-
- // create a new directory entry to kick off it
- runs(function() {
- root.getDirectory(dirName, {create:true}, entryCallback, fail);
- });
-
- waitsFor(function() { return entryCallback.wasCalled; }, "entryCallback never called", Tests.TEST_TIMEOUT);
- });
- });
- });
-
- describe('File', function() {
- it("file.spec.39 constructor should be defined", function() {
- expect(File).toBeDefined();
- expect(typeof File).toBe('function');
- });
- it("file.spec.40 should be define File attributes", function() {
- var file = new File();
- expect(file.name).toBeDefined();
- expect(file.type).toBeDefined();
- expect(file.lastModifiedDate).toBeDefined();
- expect(file.size).toBeDefined();
- });
- });
-
- describe('FileEntry', function() {
- it("file.spec.41 should be define FileEntry methods", function() {
- var fileName = "fe.methods",
- itFileEntry = jasmine.createSpy().andCallFake(function(fileEntry) {
- expect(fileEntry).toBeDefined();
- expect(typeof fileEntry.createWriter).toBe('function');
- expect(typeof fileEntry.file).toBe('function');
-
- // cleanup
- fileEntry.remove(null, fail);
- }),
- fail = createFail('FileEntry');
-
- // create a new file entry to kick off it
- runs(function() {
- root.getFile(fileName, {create:true}, itFileEntry, fail);
- });
-
- waitsFor(function() { return itFileEntry.wasCalled; }, "itFileEntry never called", Tests.TEST_TIMEOUT);
-
- runs(function() {
- expect(itFileEntry).toHaveBeenCalled();
- expect(fail).not.toHaveBeenCalled();
- });
- });
- it("file.spec.42 createWriter should return a FileWriter object", function() {
- var fileName = "fe.createWriter",
- itFile,
- entryCallback = jasmine.createSpy().andCallFake(function(fileEntry) {
- itFile = fileEntry;
-
- runs(function() {
- fileEntry.createWriter(itWriter, fail);
- });
-
- waitsFor(function() { return itWriter.wasCalled; }, "itWriter", Tests.TEST_TIMEOUT);
-
- runs(function() {
- expect(itWriter).toHaveBeenCalled();
- expect(fail).not.toHaveBeenCalled();
- });
- }),
- itWriter = jasmine.createSpy().andCallFake(function(writer) {
- expect(writer).toBeDefined();
- expect(writer instanceof FileWriter).toBe(true);
-
- // cleanup
- itFile.remove(null, fail);
- }),
- fail = createFail('FileEntry');
-
- // create a new file entry to kick off it
- runs(function() {
- root.getFile(fileName, {create:true}, entryCallback, fail);
- });
-
- waitsFor(function() { return entryCallback.wasCalled; }, "entryCallback never called", Tests.TEST_TIMEOUT);
- });
- it("file.spec.43 file should return a File object", function() {
- var fileName = "fe.file",
- newFile,
- entryCallback = jasmine.createSpy().andCallFake(function(fileEntry) {
- newFile = fileEntry;
-
- runs(function() {
- fileEntry.file(itFile, fail);
- });
-
- waitsFor(function() { return itFile.wasCalled; }, "itFile never called", Tests.TEST_TIMEOUT);
-
- runs(function() {
- expect(itFile).toHaveBeenCalled();
- expect(fail).not.toHaveBeenCalled();
- });
- }),
- itFile = jasmine.createSpy().andCallFake(function(file) {
- expect(file).toBeDefined();
- expect(file instanceof File).toBe(true);
-
- // cleanup
- newFile.remove(null, fail);
- }),
- fail = createFail('FileEntry');
-
- // create a new file entry to kick off it
- runs(function() {
- root.getFile(fileName, {create:true}, entryCallback, fail);
- });
-
- waitsFor(function() { return entryCallback.wasCalled; }, "entryCallback never called", Tests.TEST_TIMEOUT);
- });
- it("file.spec.44 file: on File that has been removed", function() {
- var fileName = "fe.no.file",
- entryCallback = jasmine.createSpy().andCallFake(function(fileEntry) {
- // create File object
- var getFile = jasmine.createSpy().andCallFake(function() {
- runs(function() {
- fileEntry.file(win, itFile);
- });
-
- waitsFor(function() { return itFile.wasCalled; }, "itFile never called", Tests.TEST_TIMEOUT);
-
- runs(function() {
- expect(itFile).toHaveBeenCalled();
- expect(win).not.toHaveBeenCalled();
- });
- });
- // delete file
- runs(function() {
- fileEntry.remove(getFile, fail);
- });
-
- waitsFor(function() { return getFile.wasCalled; }, "getFile never called", Tests.TEST_TIMEOUT);
- }),
- itFile = jasmine.createSpy().andCallFake(function(error) {
- expect(error).toBeDefined();
- expect(error).toBeFileError(FileError.NOT_FOUND_ERR);
- }),
- fail = createFail('FileEntry'),
- win = createWin('FileEntry');
-
- // create a new file entry to kick off it
- runs(function() {
- root.getFile(fileName, {create:true}, entryCallback, fail);
- });
-
- waitsFor(function() { return entryCallback.wasCalled; }, "entryCallback never called", Tests.TEST_TIMEOUT);
- });
- });
- describe('Entry', function() {
- it("file.spec.45 Entry object", function() {
- var fileName = "entry",
- fullPath = joinURL(root.fullPath, fileName),
- fail = createFail('Entry'),
- itEntry = jasmine.createSpy().andCallFake(function(entry) {
- expect(entry).toBeDefined();
- expect(entry.isFile).toBe(true);
- expect(entry.isDirectory).toBe(false);
- expect(entry.name).toCanonicallyMatch(fileName);
- expect(entry.fullPath).toCanonicallyMatch(fullPath);
- expect(typeof entry.getMetadata).toBe('function');
- expect(typeof entry.setMetadata).toBe('function');
- expect(typeof entry.moveTo).toBe('function');
- expect(typeof entry.copyTo).toBe('function');
- expect(typeof entry.toURL).toBe('function');
- expect(typeof entry.remove).toBe('function');
- expect(typeof entry.getParent).toBe('function');
- expect(typeof entry.createWriter).toBe('function');
- expect(typeof entry.file).toBe('function');
-
- // cleanup
- deleteEntry(fileName);
- });
-
- // create a new file entry
- runs(function() {
- createFile(fileName, itEntry, fail);
- });
-
- waitsFor(function() { return itEntry.wasCalled; }, "itEntry", Tests.TEST_TIMEOUT);
-
- runs(function() {
- expect(itEntry).toHaveBeenCalled();
- expect(fail).not.toHaveBeenCalled();
- });
- });
- it("file.spec.46 Entry.getMetadata on file", function() {
- var fileName = "entry.metadata.file",
- entryCallback = jasmine.createSpy().andCallFake(function(entry) {
- runs(function() {
- entry.getMetadata(itMetadata, fail);
- });
-
- waitsFor(function() { return itMetadata.wasCalled; }, "itMetadata never called", Tests.TEST_TIMEOUT);
-
- runs(function() {
- expect(itMetadata).toHaveBeenCalled();
- expect(fail).not.toHaveBeenCalled();
- });
- }),
- fail = createFail('Entry'),
- itMetadata = jasmine.createSpy().andCallFake(function(metadata) {
- expect(metadata).toBeDefined();
- expect(metadata.modificationTime instanceof Date).toBe(true);
- expect(isNaN(metadata.modificationTime.getTime())).toBe(false);
- expect(typeof metadata.size).toBe("number");
-
- // cleanup
- deleteEntry(fileName);
- });
-
- // create a new file entry
- runs(function() {
- createFile(fileName, entryCallback, fail);
- });
-
- waitsFor(function() { return entryCallback.wasCalled; }, 'entryCallback never called', Tests.TEST_TIMEOUT);
- });
- it("file.spec.47 Entry.getMetadata on directory", function() {
- var dirName = "entry.metadata.dir",
- entryCallback = jasmine.createSpy().andCallFake(function(entry) {
- runs(function() {
- entry.getMetadata(itMetadata, fail);
- });
-
- waitsFor(function() { return itMetadata.wasCalled; }, "itMetadata never called", Tests.TEST_TIMEOUT);
-
- runs(function() {
- expect(itMetadata).toHaveBeenCalled();
- expect(fail).not.toHaveBeenCalled();
- });
- }),
- fail = createFail('Entry'),
- itMetadata = jasmine.createSpy().andCallFake(function(metadata) {
- expect(metadata).toBeDefined();
- expect(metadata.modificationTime instanceof Date).toBe(true);
- expect(isNaN(metadata.modificationTime.getTime())).toBe(false);
- expect(typeof metadata.size).toBe("number");
- expect(metadata.size).toBe(0);
-
- // cleanup
- deleteEntry(dirName);
- });
-
- // create a new directory entry
- runs(function() {
- createDirectory(dirName, entryCallback, fail);
- });
-
- waitsFor(function() { return entryCallback.wasCalled; }, "entryCallback never called", Tests.TEST_TIMEOUT);
- });
- it("file.spec.48 Entry.getParent on file in root file system", function() {
- var fileName = "entry.parent.file",
- rootPath = root.fullPath,
- fail = createFail('Entry'),
- entryCallback = jasmine.createSpy().andCallFake(function(entry) {
- runs(function() {
- entry.getParent(itParent, fail);
- });
-
- waitsFor(function() { return itParent.wasCalled; }, "itCalled never called", Tests.TEST_TIMEOUT);
-
- runs(function() {
- expect(itParent).toHaveBeenCalled();
- expect(fail).not.toHaveBeenCalled();
- });
- }),
- itParent = jasmine.createSpy().andCallFake(function(parent) {
- expect(parent).toBeDefined();
- expect(parent.fullPath).toCanonicallyMatch(rootPath);
-
- // cleanup
- deleteEntry(fileName);
- });
-
- // create a new file entry
- runs(function() {
- createFile(fileName, entryCallback, fail);
- });
-
- waitsFor(function() { return entryCallback.wasCalled; }, "entryCallback never called", Tests.TEST_TIMEOUT);
- });
- it("file.spec.49 Entry.getParent on directory in root file system", function() {
- var dirName = "entry.parent.dir",
- rootPath = root.fullPath,
- fail = createFail('Entry'),
- entryCallback = jasmine.createSpy().andCallFake(function(entry) {
- runs(function() {
- entry.getParent(itParent, fail);
- });
-
- waitsFor(function() { return itParent.wasCalled; }, "itParent never called", Tests.TEST_TIMEOUT);
-
- runs(function() {
- expect(itParent).toHaveBeenCalled();
- expect(fail).not.toHaveBeenCalled();
- });
- }),
- itParent = jasmine.createSpy().andCallFake(function(parent) {
- expect(parent).toBeDefined();
- expect(parent.fullPath).toCanonicallyMatch(rootPath);
-
- // cleanup
- deleteEntry(dirName);
- });
-
- // create a new directory entry
- runs(function() {
- createDirectory(dirName, entryCallback, fail);
- });
-
- waitsFor(function() { return entryCallback.wasCalled; }, "entryCallback never called", Tests.TEST_TIMEOUT);
- });
- it("file.spec.50 Entry.getParent on root file system", function() {
- var rootPath = root.fullPath,
- itParent = jasmine.createSpy().andCallFake(function(parent) {
- expect(parent).toBeDefined();
- expect(parent.fullPath).toCanonicallyMatch(rootPath);
- }),
- fail = createFail('Entry');
-
- // create a new directory entry
- runs(function() {
- root.getParent(itParent, fail);
- });
-
- waitsFor(function() { return itParent.wasCalled; }, "itParent never called", Tests.TEST_TIMEOUT);
-
- runs(function() {
- expect(itParent).toHaveBeenCalled();
- expect(fail).not.toHaveBeenCalled();
- });
- });
- it("file.spec.51 Entry.toURL on file", function() {
- var fileName = "entry.uri.file",
- rootPath = root.fullPath,
- itURI = jasmine.createSpy().andCallFake(function(entry) {
- var uri = entry.toURL();
- expect(uri).toBeDefined();
- expect(uri.indexOf(rootPath)).not.toBe(-1);
-
- // cleanup
- deleteEntry(fileName);
- }),
- fail = createFail('Entry');
-
- // create a new file entry
- runs(function() {
- createFile(fileName, itURI, fail);
- });
-
- waitsFor(function() { return itURI.wasCalled; }, "itURI never called", Tests.TEST_TIMEOUT);
-
- runs(function() {
- expect(itURI).toHaveBeenCalled();
- expect(fail).not.toHaveBeenCalled();
- });
- });
- it("file.spec.52 Entry.toURL on directory", function() {
- var dirName1 = "num 1",
- dirName2 = "num 2",
- rootPath = root.fullPath,
- fail = createFail('Entry');
-
- createDirectory(dirName1, createNext, fail);
- function createNext(e1) {
- e1.getDirectory(dirName2, {create: true}, check, fail);
- }
- var check = jasmine.createSpy().andCallFake(function(entry) {
- var uri = entry.toURL();
- expect(uri).toBeDefined();
- expect(uri).toContain('/num%201/num%202/');
- expect(uri.indexOf(rootPath)).not.toBe(-1);
- // cleanup
- deleteEntry(dirName1);
- });
- waitsForAny(check, fail);
- });
- it("file.spec.53 Entry.remove on file", function() {
- var fileName = "entr .rm.file",
- fullPath = joinURL(root.fullPath, fileName),
- win = createWin('Entry'),
- entryCallback = jasmine.createSpy().andCallFake(function(entry) {
- var checkRemove = jasmine.createSpy().andCallFake(function() {
- runs(function() {
- root.getFile(fileName, null, win, itRemove);
- });
-
- waitsFor(function() { return itRemove.wasCalled; }, "itRemove never called", Tests.TEST_TIMEOUT);
-
- runs(function() {
- expect(win).not.toHaveBeenCalled();
- expect(fail).not.toHaveBeenCalled();
- expect(itRemove).toHaveBeenCalled();
- });
- });
- expect(entry).toBeDefined();
-
- runs(function() {
- entry.remove(checkRemove, fail);
- });
-
- waitsFor(function() { return checkRemove.wasCalled; }, "checkRemove never called", Tests.TEST_TIMEOUT);
- }),
- itRemove = jasmine.createSpy().andCallFake(function(error) {
- expect(error).toBeDefined();
- expect(error).toBeFileError(FileError.NOT_FOUND_ERR);
- // cleanup
- deleteEntry(fileName);
- }),
- fail = createFail('Entry');
-
- // create a new file entry
- runs(function() {
- createFile(fileName, entryCallback, fail);
- });
-
- waitsFor(function() { return entryCallback.wasCalled; }, "entryCallback never called", Tests.TEST_TIMEOUT);
- });
- it("file.spec.54 remove on empty directory", function() {
- var dirName = "entry.rm.dir",
- dirPath = joinURL(root.fullPath, dirName),
- entryCallback = jasmine.createSpy().andCallFake(function(entry) {
- var checkRemove = jasmine.createSpy().andCallFake(function() {
- runs(function() {
- root.getDirectory(dirName, null, win, itRemove);
- });
-
- waitsFor(function() { return itRemove.wasCalled; }, "itRemove never called", Tests.TEST_TIMEOUT);
-
- runs(function() {
- expect(itRemove).toHaveBeenCalled();
- expect(win).not.toHaveBeenCalled();
- expect(fail).not.toHaveBeenCalled();
- });
- });
-
- expect(entry).toBeDefined();
-
- runs(function() {
- entry.remove(checkRemove, fail);
- });
-
- waitsFor(function() { return checkRemove.wasCalled; }, "checkRemove never called", Tests.TEST_TIMEOUT);
- }),
- itRemove = jasmine.createSpy().andCallFake(function(error) {
- expect(error).toBeDefined();
- expect(error).toBeFileError(FileError.NOT_FOUND_ERR);
- // cleanup
- deleteEntry(dirName);
- }),
- win = createWin('Entry'),
- fail = createFail('Entry');
-
- // create a new directory entry
- runs(function() {
- createDirectory(dirName, entryCallback, fail);
- });
-
- waitsFor(function() { return entryCallback.wasCalled; }, "entryCallback never called", Tests.TEST_TIMEOUT);
- });
- it("file.spec.55 remove on non-empty directory", function() {
- var dirName = "ent y.rm.dir.not.empty",
- fileName = "re ove.txt",
- fullPath = joinURL(root.fullPath, dirName),
- entryCallback = jasmine.createSpy().andCallFake(function(entry) {
- var checkFile = jasmine.createSpy().andCallFake(function(error) {
- expect(error).toBeDefined();
- expect(error).toBeFileError(FileError.INVALID_MODIFICATION_ERR);
- // verify that dir still exists
- runs(function() {
- root.getDirectory(dirName, null, itRemove, fail);
- });
-
- waitsFor(function() { return itRemove.wasCalled; }, "itRemove never called", Tests.TEST_TIMEOUT);
-
- runs(function() {
- expect(win).not.toHaveBeenCalled();
- expect(fail).not.toHaveBeenCalled();
- expect(itRemove).toHaveBeenCalled();
- });
- });
- // delete directory
- var deleteDirectory = jasmine.createSpy().andCallFake(function(fileEntry) {
- runs(function() {
- entry.remove(win, checkFile);
- });
-
- waitsFor(function() { return checkFile.wasCalled; }, "checkFile never called", Tests.TEST_TIMEOUT);
- });
- // create a file within directory, then try to delete directory
- runs(function() {
- entry.getFile(fileName, {create: true}, deleteDirectory, fail);
- });
-
- waitsFor(function() { return deleteDirectory.wasCalled; }, "deleteDirectory never called", Tests.TEST_TIMEOUT);
- }),
- itRemove = jasmine.createSpy().andCallFake(function(entry) {
- expect(entry).toBeDefined();
- expect(entry.fullPath).toCanonicallyMatch(fullPath);
- // cleanup
- deleteEntry(dirName);
- }),
- win = createWin('Entry'),
- fail = createFail('Entry');
-
- // create a new directory entry
- runs(function() {
- createDirectory(dirName, entryCallback, fail);
- });
-
- waitsFor(function() { return entryCallback.wasCalled; }, "entryCallback never called", Tests.TEST_TIMEOUT);
- });
- it("file.spec.56 remove on root file system", function() {
- var itRemove = jasmine.createSpy().andCallFake(function(error) {
- expect(error).toBeDefined();
- expect(error).toBeFileError(FileError.NO_MODIFICATION_ALLOWED_ERR);
- }),
- win = createWin('Entry');
-
- // remove entry that doesn't exist
- runs(function() {
- root.remove(win, itRemove);
- });
-
- waitsFor(function() { return itRemove.wasCalled; }, "itRemove never called", Tests.TEST_TIMEOUT);
-
- runs(function() {
- expect(win).not.toHaveBeenCalled();
- expect(itRemove).toHaveBeenCalled();
- });
- });
- it("file.spec.57 copyTo: file", function() {
- var file1 = "entry copy.file1",
- file2 = "entry copy.file2",
- fullPath = joinURL(root.fullPath, file2),
- fail = createFail('Entry'),
- entryCallback = function(entry) {
- // copy file1 to file2
- entry.copyTo(root, file2, itCopy, fail);
- },
- itCopy = function(entry) {
- expect(entry).toBeDefined();
- expect(entry.isFile).toBe(true);
- expect(entry.isDirectory).toBe(false);
- expect(entry.fullPath).toCanonicallyMatch(fullPath);
- expect(entry.name).toCanonicallyMatch(file2);
-
- root.getFile(file2, {create:false}, itFileExists, fail);
- },
- itFileExists = jasmine.createSpy().andCallFake(function(entry2) {
- // a bit redundant since copy returned this entry already
- expect(entry2).toBeDefined();
- expect(entry2.isFile).toBe(true);
- expect(entry2.isDirectory).toBe(false);
- expect(entry2.fullPath).toCanonicallyMatch(fullPath);
- expect(entry2.name).toCanonicallyMatch(file2);
-
- // cleanup
- deleteEntry(file1);
- deleteEntry(file2);
- });
-
- // create a new file entry to kick off it
- deleteEntry(file2, function() {
- createFile(file1, entryCallback, fail);
- }, fail);
-
- waitsForAny(itFileExists, fail);
- });
- it("file.spec.58 copyTo: file onto itself", function() {
- var file1 = "entry.copy.fos.file1",
- entryCallback = jasmine.createSpy().andCallFake(function(entry) {
- // copy file1 onto itself
- runs(function() {
- entry.copyTo(root, null, win, itCopy);
- });
-
- waitsFor(function() { return itCopy.wasCalled; }, "itCopy never called", Tests.TEST_TIMEOUT);
-
- runs(function() {
- expect(itCopy).toHaveBeenCalled();
- expect(fail).not.toHaveBeenCalled();
- expect(win).not.toHaveBeenCalled();
- });
- }),
- fail = createFail('Entry'),
- win = createWin('Entry'),
- itCopy = jasmine.createSpy().andCallFake(function(error) {
- expect(error).toBeDefined();
- expect(error).toBeFileError(FileError.INVALID_MODIFICATION_ERR);
-
- // cleanup
- deleteEntry(file1);
- });
-
- // create a new file entry to kick off it
- runs(function() {
- createFile(file1, entryCallback, fail);
- });
-
- waitsFor(function() { return entryCallback.wasCalled; }, "entryCallback never called", Tests.TEST_TIMEOUT);
- });
- it("file.spec.59 copyTo: directory", function() {
- var file1 = "file1",
- srcDir = "entry.copy.srcDir",
- dstDir = "entry.copy.dstDir",
- dstPath = joinURL(root.fullPath, dstDir),
- filePath = joinURL(dstPath, file1),
- entryCallback = jasmine.createSpy().andCallFake(function(directory) {
- var copyDir = jasmine.createSpy().andCallFake(function(fileEntry) {
- // copy srcDir to dstDir
- runs(function() {
- directory.copyTo(root, dstDir, itCopy, fail);
- });
-
- waitsFor(function() { return itCopy.wasCalled; }, "itCopy never called", Tests.TEST_TIMEOUT);
- });
-
- // create a file within new directory
- runs(function() {
- directory.getFile(file1, {create: true}, copyDir, fail);
- });
-
- waitsFor(function() { return copyDir.wasCalled; }, "copyDir never called", Tests.TEST_TIMEOUT);
- }),
- itCopy = jasmine.createSpy().andCallFake(function(directory) {
- expect(directory).toBeDefined();
- expect(directory.isFile).toBe(false);
- expect(directory.isDirectory).toBe(true);
- expect(directory.fullPath).toCanonicallyMatch(dstPath);
- expect(directory.name).toCanonicallyMatch(dstDir);
-
- runs(function() {
- root.getDirectory(dstDir, {create:false}, itDirExists, fail);
- });
-
- waitsFor(function() { return itDirExists.wasCalled; }, "itDirExists never called", Tests.TEST_TIMEOUT);
- }),
- itDirExists = jasmine.createSpy().andCallFake(function(dirEntry) {
- expect(dirEntry).toBeDefined();
- expect(dirEntry.isFile).toBe(false);
- expect(dirEntry.isDirectory).toBe(true);
- expect(dirEntry.fullPath).toCanonicallyMatch(dstPath);
- expect(dirEntry.name).toCanonicallyMatch(dstDir);
-
- runs(function() {
- dirEntry.getFile(file1, {create:false}, itFileExists, fail);
- });
-
- waitsFor(function() { return itFileExists.wasCalled; }, "itFileExists never called", Tests.TEST_TIMEOUT);
-
- runs(function() {
- expect(itFileExists).toHaveBeenCalled();
- expect(fail).not.toHaveBeenCalled();
- });
- }),
- itFileExists = jasmine.createSpy().andCallFake(function(fileEntry) {
- expect(fileEntry).toBeDefined();
- expect(fileEntry.isFile).toBe(true);
- expect(fileEntry.isDirectory).toBe(false);
- expect(fileEntry.fullPath).toCanonicallyMatch(filePath);
- expect(fileEntry.name).toCanonicallyMatch(file1);
-
- // cleanup
- deleteEntry(srcDir);
- deleteEntry(dstDir);
- }),
- fail = createFail('Entry');
-
- // create a new directory entry to kick off it
- runs(function() {
- deleteEntry(dstDir, function() {
- createDirectory(srcDir, entryCallback, fail);
- }, fail);
- });
-
- waitsFor(function() { return entryCallback.wasCalled; }, "entryCallback never called", Tests.TEST_TIMEOUT);
- });
- it("file.spec.60 copyTo: directory to backup at same root directory", function() {
- var file1 = "file1",
- srcDir = "entry.copy srcDirSame",
- dstDir = "entry.copy srcDirSame-backup",
- dstPath = joinURL(root.fullPath, dstDir),
- filePath = joinURL(dstPath, file1),
- fail = createFail('Entry copyTo: directory to backup at same root'),
- entryCallback = function(directory) {
- var copyDir = function(fileEntry) {
- // copy srcDir to dstDir
- directory.copyTo(root, dstDir, itCopy, fail);
- };
- // create a file within new directory
- directory.getFile(file1, {create: true}, copyDir, fail);
- },
- itCopy = function(directory) {
- expect(directory).toBeDefined();
- expect(directory.isFile).toBe(false);
- expect(directory.isDirectory).toBe(true);
- expect(directory.fullPath).toCanonicallyMatch(dstPath);
- expect(directory.name).toCanonicallyMatch(dstDir);
-
- root.getDirectory(dstDir, {create:false}, itDirExists, fail);
- },
- itDirExists = function(dirEntry) {
- expect(dirEntry).toBeDefined();
- expect(dirEntry.isFile).toBe(false);
- expect(dirEntry.isDirectory).toBe(true);
- expect(dirEntry.fullPath).toCanonicallyMatch(dstPath);
- expect(dirEntry.name).toCanonicallyMatch(dstDir);
-
- dirEntry.getFile(file1, {create:false}, itFileExists, fail);
- },
- itFileExists = jasmine.createSpy().andCallFake(function(fileEntry) {
- var cleanSrc = jasmine.createSpy();
- var cleanDst = jasmine.createSpy();
- expect(fileEntry).toBeDefined();
- expect(fileEntry.isFile).toBe(true);
- expect(fileEntry.isDirectory).toBe(false);
- expect(fileEntry.fullPath).toCanonicallyMatch(filePath);
- expect(fileEntry.name).toCanonicallyMatch(file1);
- expect(fail).not.toHaveBeenCalled();
-
- // cleanup
- deleteEntry(srcDir, cleanSrc);
- deleteEntry(dstDir, cleanDst);
- });
-
- // create a new directory entry to kick off it
- deleteEntry(dstDir, function() {
- createDirectory(srcDir, entryCallback, fail);
- }, fail);
-
- waitsForAny(itFileExists, fail);
- });
- it("file.spec.61 copyTo: directory onto itself", function() {
- var file1 = "file1",
- srcDir = "entry.copy.dos.srcDir",
- srcPath = joinURL(root.fullPath, srcDir),
- filePath = joinURL(srcPath, file1),
- win = createWin('Entry'),
- fail = createFail('Entry copyTo: directory onto itself'),
- entryCallback = jasmine.createSpy().andCallFake(function(directory) {
- var copyDir = jasmine.createSpy().andCallFake(function(fileEntry) {
- // copy srcDir onto itself
- runs(function() {
- directory.copyTo(root, null, win, itCopy);
- });
-
- waitsFor(function() { return itCopy.wasCalled; }, "itCopy never called", Tests.TEST_TIMEOUT);
- });
- // create a file within new directory
- runs(function() {
- directory.getFile(file1, {create: true}, copyDir, fail);
- });
-
- waitsFor(function() { return copyDir.wasCalled; }, "copyDir never called", Tests.TEST_TIMEOUT);
- }),
- itCopy = jasmine.createSpy().andCallFake(function(error) {
- expect(error).toBeDefined();
- expect(error).toBeFileError(FileError.INVALID_MODIFICATION_ERR);
-
- runs(function() {
- root.getDirectory(srcDir, {create:false}, itDi
<TRUNCATED>
[13/32] spec commit: CB-7133 removed inappbrowser tests
Posted by pu...@apache.org.
CB-7133 removed inappbrowser tests
Project: http://git-wip-us.apache.org/repos/asf/cordova-mobile-spec/repo
Commit: http://git-wip-us.apache.org/repos/asf/cordova-mobile-spec/commit/0cf9184f
Tree: http://git-wip-us.apache.org/repos/asf/cordova-mobile-spec/tree/0cf9184f
Diff: http://git-wip-us.apache.org/repos/asf/cordova-mobile-spec/diff/0cf9184f
Branch: refs/heads/master
Commit: 0cf9184ff8b86c635a48b1878ac8f7db78eab6c3
Parents: 647bdb1
Author: Staci Cooper <sm...@us.ibm.com>
Authored: Mon Aug 4 11:45:19 2014 -0400
Committer: Staci Cooper <sm...@us.ibm.com>
Committed: Mon Aug 4 11:45:19 2014 -0400
----------------------------------------------------------------------
www/inappbrowser/index.html | 236 -------------------------------------
www/inappbrowser/index.js | 242 --------------------------------------
www/inappbrowser/inject.css | 21 ----
www/inappbrowser/inject.html | 43 -------
www/inappbrowser/inject.js | 20 ----
www/inappbrowser/local.html | 64 ----------
www/inappbrowser/local.pdf | Bin 8568 -> 0 bytes
www/inappbrowser/video.html | 42 -------
8 files changed, 668 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cordova-mobile-spec/blob/0cf9184f/www/inappbrowser/index.html
----------------------------------------------------------------------
diff --git a/www/inappbrowser/index.html b/www/inappbrowser/index.html
deleted file mode 100644
index b06ed11..0000000
--- a/www/inappbrowser/index.html
+++ /dev/null
@@ -1,236 +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="./index.js"></script>
- </head>
- <body id="stage" class="theme">
-
- <h1>InAppBrowser</h1>
- <div id="info">
- Make sure http://www.google.com is white listed. </br>
- Make sure http://www.apple.com is not in the white list.</br> In iOS, starred <span style="vertical-align:super">*</span> tests will put the app in a state with no way to return. </br>
- <h4>User-Agent: <span id="user-agent"> </span></h4>
- </div>
- <div class="btn small backBtn">Back</div>
-
- <h1>Local URL</h1>
- <div class="btn large openLocal">target = Default</div>
- Expected result: opens successfully in CordovaWebView.
-
- <p/>
- <div class="btn large openLocalSelf">target=_self</div>
- Expected result: opens successfully in CordovaWebView.
-
- <p/>
- <div class="btn large openLocalSystem">target=_system</div>
- Expected result: fails to open.
-
- <p/>
- <div class="btn large openLocalBlank">target=_blank</div>
- Expected result: opens successfully in InAppBrowser with locationBar at top.
-
- <p/>
- <div class="btn large openLocalRandomNoLocation">target=Random, location=no,disallowoverscroll=yes</div>
- Expected result: opens successfully in InAppBrowser without locationBar.
-
- <p/>
- <div class="btn large openLocalRandomToolBarBottom">target=Random, toolbarposition=bottom</div>
- Expected result: opens successfully in InAppBrowser with locationBar. On iOS the toolbar is at the bottom.
-
- <p/>
- <div class="btn large openLocalRandomToolBarTop">target=Random, toolbarposition=top</div>
- Expected result: opens successfully in InAppBrowser with locationBar. On iOS the toolbar is at the top.
-
- <p/>
- <div class="btn large openLocalRandomToolBarTopNoLocation">target=Random, toolbarposition=top,location=no</div>
- Expected result: opens successfully in InAppBrowser with no locationBar. On iOS the toolbar is at the top.
-
- <h1>White Listed URL</h1>
-
- <div class="btn large openWhiteListed">target=Default<span style="vertical-align:super">*</span></div>
- Expected result: open successfully in CordovaWebView to www.google.com.
-
- <p/>
- <div class="btn large openWhiteListedSelf">target=_self<span style="vertical-align:super">*</span></div>
- Expected result: open successfully in CordovaWebView to www.google.com.
-
- <p/>
- <div class="btn large openWhiteListedSystem">target=_system</div>
- Expected result: open successfully in system browser to www.google.com.
-
- <p/>
- <div class="btn large openWhiteListedBlank">target=_blank</div>
- Expected result: open successfully in InAppBrowser to www.google.com.
-
- <p/>
- <div class="btn large openWhiteListedRandom">target=Random</div>
- Expected result: open successfully in InAppBrowser to www.google.com.
-
- <p/>
- <div class="btn large openWhiteListedRandomNoLocation">target=Random, no location bar<span style="vertical-align:super">*</span></div>
- Expected result: open successfully in InAppBrowser to www.google.com with no location bar.
-
- <h1>Non White Listed URL</h1>
-
- <div class="btn large openNonWhiteListed">target=Default</div>
- Expected result: open successfully in InAppBrowser to apple.com (_self enforces whitelist).
-
- <p/>
- <div class="btn larg openNonWhiteListedSelf">target=_self</div>
- Expected result: open successfully in InAppBrowser to apple.com (_self enforces whitelist).
-
- <p/>
- <div class="btn large openNonWhiteListedSystem">target=_system</div>
- Expected result: open successfully in system browser to apple.com.
-
- <p/>
- <div class="btn large openNonWhiteListedBlank">target=_blank</div>
- Expected result: open successfully in InAppBrowser to apple.com.
-
- <p/>
- <div class="btn large openNonWhiteListedRandom">target=Random</div>
- Expected result: open successfully in InAppBrowser to apple.com.
-
- <p/>
- <div class="btn large openNonWhiteListedRandomNoLocation">target=Random, no location bar<span style="vertical-align:super">*</span></div>
- Expected result: open successfully in InAppBrowser to apple.com without locationBar.
-
- <h1>Page with redirect</h1>
-
- <div class="btn large openRedirect301">http://google.com</div>
- Expected result: should 301 and open successfully in InAppBrowser to www.google.com.
-
- <p/>
- <div class="btn large openRedirect302">http://goo.gl/pUFqg</div>
- Expected result: should 302 and open successfully in InAppBrowser to www.zhihu.com/answer/16714076.
-
- <h1>PDF URL</h1>
-
- <div class="btn large openPDF">Remote URL</div>
- Expected result: InAppBrowser opens. PDF should render on iOS.
-
- <p/>
- <div class="btn large openPDFBlank">Local URL</div>
- Expected result: InAppBrowser opens. PDF should render on iOS.
-
- <h1>Invalid URL</h1>
-
- <div class="btn large openInvalidScheme">Invalid Scheme</div>
- Expected result: fail to load in InAppBrowser.
-
- <p/>
- <div class="btn large openInvalidHost">Invalid Host</div>
- Expected result: fail to load in InAppBrowser.
-
- <p/>
- <div class="btn large openInvalidMissing">Missing Local File</div>
- Expected result: fail to load in InAppBrowser (404).
-
- <h1>CSS / JS Injection</h1>
-
- <div class="btn large openOriginalDocument">Original Document</div>
- Expected result: open successfully in InAppBrowser without text "Style updated from..."
-
- <p/>
- <div class="btn large openCSSInjection">CSS File Injection</div>
- Expected result: open successfully in InAppBrowser with "Style updated from file".
-
- <p/>
- <div class="btn large openCSSInjectionCallback">CSS File Injection (callback)</div>
- Expected result: open successfully in InAppBrowser with "Style updated from file", and alert dialog with text "Results verified".
-
- <p/>
- <div class="btn large openCSSLiteralInjection">CSS Literal Injection</div>
- Expected result: open successfully in InAppBrowser with "Style updated from literal".
-
- <p/>
- <div class="btn large openCSSLiteralInjectionCallback">CSS Literal Injection (callback)</div>
- Expected result: open successfully in InAppBrowser with "Style updated from literal", and alert dialog with text "Results verified".
-
- <p/>
- <div class="btn large openScriptInjection">Script File Injection</div>
- Expected result: open successfully in InAppBrowser with text "Script file successfully injected".
-
- <p/>
- <div class="btn large openScriptInjectionCallback">Script File Injection (callback)</div>
- Expected result: open successfully in InAppBrowser with text "Script file successfully injected" and alert dialog with the text "Results verified".
-
- <p/>
- <div class="btn large openScriptLiteralInjection">Script Literal Injection</div>
- Expected result: open successfully in InAppBrowser with the text "Script literal successfully injected" .
-
- <p/>
- <div class="btn large openScriptLiteralInjectionCallback">Script Literal Injection (callback)</div>
- Expected result: open successfully in InAppBrowser with the text "Script literal successfully injected" and alert dialog with the text "Results verified".
-
- <h1>Open Hidden </h1>
- <div class="btn large openHidden">create hidden</div>
- Expected result: no additional browser window. Alert appears with the text "background window loaded".
-
- <p/>
- <div class="btn large showHidden">show hidden</div>
- Expected result: after first clicking on previous test "create hidden", open successfully in InAppBrowser to google.com.
-
- <p/>
- <div class="btn large closeHidden">close hidden</div>
- Expected result: no output. But click on "show hidden" again and nothing should be shown.
-
- <p/>
- <div class="btn large openHiddenShow">google.com not hidden</div>
- Expected result: open successfully in InAppBrowser to www.google.com
-
- <h1>Clearing Cache</h1>
-
- <div class="btn large openClearCache">Clear Browser Cache</div>
- Expected result: ?
-
- <p/>
- <div class="btn large openClearSessionCache">Clear Session Cache</div>
- Expected result: ?
-
- <h1>Video tag</h1>
-
- <div class="btn large openRemoteVideo">remote video</div>
- Expected result: open successfully in InAppBrowser with an embedded video that works after clicking the "play" button.
-
- <h1>Local with anchor tag</h1>
-
- <div class="btn large openAnchor1">Anchor1</div>
- Expected result: open successfully in InAppBrowser to the local page, scrolled to the top.
-
- <p/>
- <div class="btn large openAnchor2">Anchor2</div>
- Expected result: open successfully in InAppBrowser to the local page, scrolled to the beginning of the tall div with border.
-
- <p/>
- <div class="backBtn">Back</div>
-
- </body>
-</html>
http://git-wip-us.apache.org/repos/asf/cordova-mobile-spec/blob/0cf9184f/www/inappbrowser/index.js
----------------------------------------------------------------------
diff --git a/www/inappbrowser/index.js b/www/inappbrowser/index.js
deleted file mode 100644
index a08c30d..0000000
--- a/www/inappbrowser/index.js
+++ /dev/null
@@ -1,242 +0,0 @@
-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);
- function updateUserAgent() {
- document.getElementById("user-agent").textContent = navigator.userAgent;
- }
- updateUserAgent();
- window.setInterval(updateUserAgent, 1500);
- window.setTimeout(function() {
- if (!deviceReady) {
- alert("Error: Apache Cordova did not initialize. Demo will not run correctly.");
- }
- },1000);
-}
-
-function doOpen(url, target, params, numExpectedRedirects) {
- numExpectedRedirects = numExpectedRedirects || 0;
- var iab = window.open(url, target, params);
- if (!iab) {
- alert('window.open returned ' + iab);
- return;
- }
- var counts;
- var lastLoadStartURL;
- var wasReset = false;
- function reset() {
- counts = {
- 'loaderror': 0,
- 'loadstart': 0,
- 'loadstop': 0,
- 'exit': 0
- };
- lastLoadStartURL = '';
- }
- reset();
-
- function logEvent(e) {
- console.log('IAB event=' + JSON.stringify(e));
- counts[e.type]++;
- // Verify that event.url gets updated on redirects.
- if (e.type == 'loadstart') {
- if (e.url == lastLoadStartURL) {
- alert('Unexpected: loadstart fired multiple times for the same URL.');
- }
- lastLoadStartURL = e.url;
- }
- // Verify the right number of loadstart events were fired.
- if (e.type == 'loadstop' || e.type == 'loaderror') {
- if (e.url != lastLoadStartURL) {
- alert('Unexpected: ' + e.type + ' event.url != loadstart\'s event.url');
- }
- if (numExpectedRedirects === 0 && counts['loadstart'] !== 1) {
- // Do allow a loaderror without a loadstart (e.g. in the case of an invalid URL).
- if (!(e.type == 'loaderror' && counts['loadstart'] === 0)) {
- alert('Unexpected: got multiple loadstart events. (' + counts['loadstart'] + ')');
- }
- } else if (numExpectedRedirects > 0 && counts['loadstart'] < (numExpectedRedirects+1)) {
- alert('Unexpected: should have got at least ' + (numExpectedRedirects+1) + ' loadstart events, but got ' + counts['loadstart']);
- }
- wasReset = true;
- numExpectedRedirects = 0;
- reset();
- }
- // Verify that loadend / loaderror was called.
- if (e.type == 'exit') {
- var numStopEvents = counts['loadstop'] + counts['loaderror'];
- if (numStopEvents === 0 && !wasReset) {
- alert('Unexpected: browser closed without a loadstop or loaderror.')
- } else if (numStopEvents > 1) {
- alert('Unexpected: got multiple loadstop/loaderror events.');
- }
- }
- }
- iab.addEventListener('loaderror', logEvent);
- iab.addEventListener('loadstart', logEvent);
- iab.addEventListener('loadstop', logEvent);
- iab.addEventListener('exit', logEvent);
-
- return iab;
-}
-
-function openWithStyle(url, cssUrl, useCallback) {
- var iab = doOpen(url, '_blank', 'location=yes');
- var callback = function(results) {
- if (results && results.length === 0) {
- alert('Results verified');
- } else {
- console.log(results);
- alert('Got: ' + typeof(results) + '\n' + JSON.stringify(results));
- }
- };
- if (cssUrl) {
- iab.addEventListener('loadstop', function(event) {
- iab.insertCSS({file: cssUrl}, useCallback && callback);
- });
- } else {
- iab.addEventListener('loadstop', function(event) {
- iab.insertCSS({code:'#style-update-literal { \ndisplay: block !important; \n}'},
- useCallback && callback);
- });
- }
-}
-
-function openWithScript(url, jsUrl, useCallback) {
- var iab = doOpen(url, '_blank', 'location=yes');
- if (jsUrl) {
- iab.addEventListener('loadstop', function(event) {
- iab.executeScript({file: jsUrl}, useCallback && function(results) {
- if (results && results.length === 0) {
- alert('Results verified');
- } else {
- console.log(results);
- alert('Got: ' + typeof(results) + '\n' + JSON.stringify(results));
- }
- });
- });
- } else {
- iab.addEventListener('loadstop', function(event) {
- var code = '(function(){\n' +
- ' var header = document.getElementById("header");\n' +
- ' header.innerHTML = "Script literal successfully injected";\n' +
- ' return "abc";\n' +
- '})()';
- iab.executeScript({code:code}, useCallback && function(results) {
- if (results && results.length === 1 && results[0] === 'abc') {
- alert('Results verified');
- } else {
- console.log(results);
- alert('Got: ' + typeof(results) + '\n' + JSON.stringify(results));
- }
- });
- });
- }
-}
-var hiddenwnd=null;
-var loadlistener = function(event) { alert('background window loaded ' ); };
-function openHidden(url, startHidden) {
- var shopt =(startHidden) ? 'hidden=yes' : '';
- hiddenwnd = window.open(url,'random_string',shopt);
- if (!hiddenwnd) {
- alert('window.open returned ' + hiddenwnd);
- return;
- }
- if(startHidden) hiddenwnd.addEventListener('loadstop', loadlistener);
-}
-function showHidden() {
- if(!!hiddenwnd ) {
- hiddenwnd.show();
- }
-}
-function closeHidden() {
- if(!!hiddenwnd ) {
- hiddenwnd.removeEventListener('loadstop',loadlistener);
- hiddenwnd.close();
- hiddenwnd=null;
- }
-}
-
-window.onload = function() {
- addListenerToClass('openLocal', doOpen, 'local.html');
- addListenerToClass('openLocalSelf', doOpen, ['local.html', '_self']);
- addListenerToClass('openLocalSystem', doOpen, ['local.html', '_system']);
- addListenerToClass('openLocalBlank', doOpen, ['local.html', '_blank']);
- addListenerToClass('openLocalRandomNoLocation', doOpen,
- ['local.html', 'random_string', 'location=no,disallowoverscroll=yes']);
- addListenerToClass('openLocalRandomToolBarBottom', doOpen,
- ['local.html', 'random_string', 'toolbarposition=bottom']);
- addListenerToClass('openLocalRandomToolBarTop', doOpen,
- ['local.html', 'random_string', 'toolbarposition=top']);
- addListenerToClass('openLocalRandomToolBarTopNoLocation', doOpen,
- ['local.html', 'random_string', 'toolbarposition=top,location=no']);
- addListenerToClass('openWhiteListed', doOpen, 'http://www.google.com');
- addListenerToClass('openWhiteListedSelf', doOpen,
- ['http://www.google.com', '_self']);
- addListenerToClass('openWhiteListedSystem', doOpen,
- ['http://www.google.com', '_system']);
- addListenerToClass('openWhiteListedBlank', doOpen,
- ['http://www.google.com', '_blank']);
- addListenerToClass('openWhiteListedRandom', doOpen,
- ['http://www.google.com', 'random_string']);
- addListenerToClass('openWhiteListedRandomNoLocation', doOpen,
- ['http://www.google.com', 'random_string', 'location=no']);
- addListenerToClass('openNonWhiteListed', doOpen, 'http://www.apple.com');
- addListenerToClass('openNonWhiteListedSelf', doOpen,
- ['http://www.apple.com', '_self']);
- addListenerToClass('openNonWhiteListedSystem', doOpen,
- ['http://www.apple.com', '_system']);
- addListenerToClass('openNonWhiteListedBlank', doOpen,
- ['http://www.apple.com', '_blank']);
- addListenerToClass('openNonWhiteListedRandom', doOpen,
- ['http://www.apple.com', 'random_string']);
- addListenerToClass('openNonWhiteListedRandomNoLocation', doOpen,
- ['http://www.apple.com', 'random_string', 'location=no']);
- addListenerToClass('openRedirect301', doOpen,
- ['http://google.com', 'random_string', '', 1]);
- addListenerToClass('openRedirect302', doOpen,
- ['http://goo.gl/pUFqg', 'random_string', '', 2]);
- addListenerToClass('openPDF', doOpen, 'http://www.stluciadance.com/prospectus_file/sample.pdf');
- addListenerToClass('openPDFBlank', doOpen, ['local.pdf', '_blank']);
- addListenerToClass('openInvalidScheme', doOpen,
- ['x-ttp://www.invalid.com/', '_blank']);
- addListenerToClass('openInvalidHost', doOpen,
- ['http://www.inv;alid.com/', '_blank']);
- addListenerToClass('openInvalidMissing', doOpen, ['nonexistent.html', '_blank']);
- addListenerToClass('openOriginalDocument', doOpen, ['inject.html', '_blank']);
- addListenerToClass('openCSSInjection', openWithStyle,
- ['inject.html','inject.css']);
- addListenerToClass('openCSSInjectionCallback', openWithStyle,
- ['inject.html','inject.css', true]);
- addListenerToClass('openCSSLiteralInjection', openWithStyle, 'inject.html');
- addListenerToClass('openCSSLiteralInjectionCallback', openWithStyle,
- ['inject.html', null, true]);
- addListenerToClass('openScriptInjection', openWithScript,
- ['inject.html', 'inject.js']);
- addListenerToClass('openScriptInjectionCallback', openWithScript,
- ['inject.html', 'inject.js', true]);
- addListenerToClass('openScriptLiteralInjection', openWithScript, 'inject.html');
- addListenerToClass('openScriptLiteralInjectionCallback', openWithScript,
- ['inject.html', null, true]);
- addListenerToClass('openHidden', openHidden, ['http://google.com', true]);
- addListenerToClass('showHidden', showHidden);
- addListenerToClass('closeHidden', closeHidden);
- addListenerToClass('openHiddenShow', openHidden, ['http://google.com', false]);
- addListenerToClass('openClearCache', doOpen,
- ['http://www.google.com', '_blank', 'clearcache=yes']);
- addListenerToClass('openClearSessionCache', doOpen,
- ['http://www.google.com', '_blank', 'clearsessioncache=yes']);
- addListenerToClass('openRemoteVideo', doOpen, ['video.html', '_blank']);
- addListenerToClass('openAnchor1', doOpen, ['local.html#anchor1', '_blank']);
- addListenerToClass('openAnchor2', doOpen, ['local.html#anchor2', '_blank']);
-
-
- addListenerToClass('backBtn', backHome);
- init();
-}
http://git-wip-us.apache.org/repos/asf/cordova-mobile-spec/blob/0cf9184f/www/inappbrowser/inject.css
----------------------------------------------------------------------
diff --git a/www/inappbrowser/inject.css b/www/inappbrowser/inject.css
deleted file mode 100644
index 3f6e41c..0000000
--- a/www/inappbrowser/inject.css
+++ /dev/null
@@ -1,21 +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.
-*/
-#style-update-file {
- display: block !important;
-}
http://git-wip-us.apache.org/repos/asf/cordova-mobile-spec/blob/0cf9184f/www/inappbrowser/inject.html
----------------------------------------------------------------------
diff --git a/www/inappbrowser/inject.html b/www/inappbrowser/inject.html
deleted file mode 100644
index 0f1efdd..0000000
--- a/www/inappbrowser/inject.html
+++ /dev/null
@@ -1,43 +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">
- </head>
- <body id="stage" class="theme">
- <h1 id="header">InAppBrowser - Script / Style Injection Test</h1>
- <h2 id="style-update-file" style="display:none">Style updated from file</h2>
- <h2 id="style-update-literal" style="display:none">Style updated from literal</h2>
- </body>
- <script>
- function updateUserAgent() {
- document.getElementById("u-a").textContent = navigator.userAgent;
- }
- updateUserAgent();
- window.setInterval(updateUserAgent, 1500);
- </script>
-</html>
http://git-wip-us.apache.org/repos/asf/cordova-mobile-spec/blob/0cf9184f/www/inappbrowser/inject.js
----------------------------------------------------------------------
diff --git a/www/inappbrowser/inject.js b/www/inappbrowser/inject.js
deleted file mode 100644
index 6f25493..0000000
--- a/www/inappbrowser/inject.js
+++ /dev/null
@@ -1,20 +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 d = document.getElementById("header")
-d.innerHTML = "Script file successfully injected";
http://git-wip-us.apache.org/repos/asf/cordova-mobile-spec/blob/0cf9184f/www/inappbrowser/local.html
----------------------------------------------------------------------
diff --git a/www/inappbrowser/local.html b/www/inappbrowser/local.html
deleted file mode 100644
index 5e33800..0000000
--- a/www/inappbrowser/local.html
+++ /dev/null
@@ -1,64 +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>IAB test page</title>
- <script type="text/javascript" charset="utf-8" src="../cordova-incl.js"></script>
- <script type="text/javascript" charset="utf-8">
- function onDeviceReady() {
- document.getElementById("hint").textContent = "Running CordovaWebView, deviceVersion=" + device.version + ", no toolbar should be present, Back link should work, logcat should NOT have failed 'gap:' calls.";
- }
- document.addEventListener("deviceready", onDeviceReady, false);
- </script>
- </head>
- <body id="stage" class="theme">
- <h1>Local URL</h1>
- <div id="info">
- You have successfully loaded a local URL:
- <script>document.write(location.href)</script>
- </div>
- <hr />
- <div>User-Agent = <span id="u-a"></span></div>
- <hr />
- <div id="hint">Likely running inAppBrowser: Device version from Cordova=not found, Back link should not work, toolbar may be present, logcat should show failed 'gap:' calls.</div>
- <hr />
- <div><a href="http://www.google.com">Visit Google</a> (whitelisted)</div>
- <div><a href="http://www.yahoo.com">Visit Yahoo</a> (not whitelisted)</div>
- <div><a href="http://www.stluciadance.com/prospectus_file/sample.pdf">Check out my remote PDF</a></div>
- <div><a href="local.pdf">Check out my local PDF</a></div>
- <p /><a href="javascript:;" onclick="history.back();">Back</a>
- <p />
- <a name="anchor2"></a>
- <div style="height: 1000px;border:1px solid red;">tall div with border</div>
- </body>
- <script>
- function updateUserAgent() {
- document.getElementById("u-a").textContent = navigator.userAgent;
- }
- updateUserAgent();
- window.setInterval(updateUserAgent, 1500);
- </script>
-</html>
http://git-wip-us.apache.org/repos/asf/cordova-mobile-spec/blob/0cf9184f/www/inappbrowser/local.pdf
----------------------------------------------------------------------
diff --git a/www/inappbrowser/local.pdf b/www/inappbrowser/local.pdf
deleted file mode 100644
index b54f1b7..0000000
Binary files a/www/inappbrowser/local.pdf and /dev/null differ
http://git-wip-us.apache.org/repos/asf/cordova-mobile-spec/blob/0cf9184f/www/inappbrowser/video.html
----------------------------------------------------------------------
diff --git a/www/inappbrowser/video.html b/www/inappbrowser/video.html
deleted file mode 100644
index 64ea3d1..0000000
--- a/www/inappbrowser/video.html
+++ /dev/null
@@ -1,42 +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>
-
- </head>
- <body>
- <video width=100% height=100% id="player">
- <source src="http://m.comptoir-info.com/app/beta/sample.mp4">
- <meta property="og:video:secure_url" content="http://m.comptoir-info.com/app/beta/sample.mp4">
- <meta property="og:video:type" content="video/mp4">
- </video>
- <div>
- <button onclick="document.getElementById('player').play()"> play </button>
- <button onclick="document.getElementById('player').pause()"> pause </button>
- </div>
- </body>
-</html>
[05/32] spec commit: Removed remaining button on index.html
Posted by pu...@apache.org.
Removed remaining button on index.html
Project: http://git-wip-us.apache.org/repos/asf/cordova-mobile-spec/repo
Commit: http://git-wip-us.apache.org/repos/asf/cordova-mobile-spec/commit/4866870e
Tree: http://git-wip-us.apache.org/repos/asf/cordova-mobile-spec/tree/4866870e
Diff: http://git-wip-us.apache.org/repos/asf/cordova-mobile-spec/diff/4866870e
Branch: refs/heads/master
Commit: 4866870e5f2f0428a0450cf6cff7b2e88800b2b2
Parents: 3920e20
Author: Martin Gonzalez <ma...@gmail.com>
Authored: Fri Aug 1 02:25:40 2014 -0500
Committer: Martin Gonzalez <ma...@gmail.com>
Committed: Fri Aug 1 02:25:40 2014 -0500
----------------------------------------------------------------------
www/index.html | 1 -
1 file changed, 1 deletion(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cordova-mobile-spec/blob/4866870e/www/index.html
----------------------------------------------------------------------
diff --git a/www/index.html b/www/index.html
index 39bc875..9797a59 100644
--- a/www/index.html
+++ b/www/index.html
@@ -63,7 +63,6 @@ User-Agent: <span id="user-agent"> </span></div>
<a href="inappbrowser/index.html" class="btn large">In App Browser</a>
<a href="keyboard/index.html" class="btn large">Keyboard</a>
<a href="vibration/index.html" class="btn large">Vibration</a>
- <a href="file/index.html" class="btn large">File & File Transfer</a>
<a href="statusbar/index.html" class="btn large">Status Bar</a>
</body>
</html>