cordova-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From purplecabb...@apache.org
Subject [01/32] spec commit: CB-6957 Removed battery-status tests
Date Thu, 07 Aug 2014 00:53:19 GMT
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 <martin.c.glez.glez@gmail.com>
Authored: Fri Aug 1 02:14:38 2014 -0500
Committer: Martin Gonzalez <martin.c.glez.glez@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>


Mime
View raw message