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/19 03:06:08 UTC

[1/6] git commit: CB-7160 added manual tests

Repository: cordova-plugin-device-motion
Updated Branches:
  refs/heads/master ad94eecd3 -> d6cd397d6


CB-7160 added manual tests


Project: http://git-wip-us.apache.org/repos/asf/cordova-plugin-device-motion/repo
Commit: http://git-wip-us.apache.org/repos/asf/cordova-plugin-device-motion/commit/7880ada9
Tree: http://git-wip-us.apache.org/repos/asf/cordova-plugin-device-motion/tree/7880ada9
Diff: http://git-wip-us.apache.org/repos/asf/cordova-plugin-device-motion/diff/7880ada9

Branch: refs/heads/master
Commit: 7880ada99b453799d5083b6ad3dc87b094a498fb
Parents: 1954d48
Author: Staci Cooper <sm...@us.ibm.com>
Authored: Thu Jul 17 15:46:14 2014 -0400
Committer: Staci Cooper <sm...@us.ibm.com>
Committed: Thu Jul 17 15:46:14 2014 -0400

----------------------------------------------------------------------
 test/tests.js | 135 ++++++++++++++++++++++++++++++++++++++++++++++++++++-
 1 file changed, 134 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cordova-plugin-device-motion/blob/7880ada9/test/tests.js
----------------------------------------------------------------------
diff --git a/test/tests.js b/test/tests.js
index f85e695..75016d0 100644
--- a/test/tests.js
+++ b/test/tests.js
@@ -1,4 +1,25 @@
-exports.defineAutoTests = function() {
+/*
+ *
+ * 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.
+ *
+*/
+
+exports.defineAutoTests = function () {
   describe('Accelerometer (navigator.accelerometer)', function () {
     var fail = function(done) {
       expect(true).toBe(false);
@@ -152,3 +173,115 @@ exports.defineAutoTests = function() {
     });
   });
 };
+
+/******************************************************************************/
+/******************************************************************************/
+/******************************************************************************/
+
+exports.defineManualTests = function (contentEl, createActionButton) {
+    function roundNumber(num) {
+        var dec = 3;
+        var result = Math.round(num * Math.pow(10, dec)) / Math.pow(10, dec);
+        return result;
+    }
+
+    var watchAccelId = null;
+
+    /**
+     * Start watching acceleration
+     */
+    var watchAccel = function () {
+        console.log("watchAccel()");
+
+        // Success callback
+        var success = function (a) {
+            document.getElementById('x').innerHTML = roundNumber(a.x);
+            document.getElementById('y').innerHTML = roundNumber(a.y);
+            document.getElementById('z').innerHTML = roundNumber(a.z);
+        };
+
+        // Fail callback
+        var fail = function (e) {
+            console.log("watchAccel fail callback with error code " + e);
+            stopAccel();
+            setAccelStatus(Accelerometer.ERROR_MSG[e]);
+        };
+
+        // Update acceleration every 1 sec
+        var opt = {};
+        opt.frequency = 1000;
+        watchAccelId = navigator.accelerometer.watchAcceleration(success, fail, opt);
+
+        setAccelStatus("Running");
+    };
+
+    /**
+     * Stop watching the acceleration
+     */
+    var stopAccel = function () {
+        console.log("stopAccel()");
+        setAccelStatus("Stopped");
+        if (watchAccelId) {
+            navigator.accelerometer.clearWatch(watchAccelId);
+            watchAccelId = null;
+        }
+    };
+
+    /**
+     * Get current acceleration
+     */
+    var getAccel = function () {
+        console.log("getAccel()");
+
+        // Stop accel if running
+        stopAccel();
+
+        // Success callback
+        var success = function (a) {
+            document.getElementById('x').innerHTML = roundNumber(a.x);
+            document.getElementById('y').innerHTML = roundNumber(a.y);
+            document.getElementById('z').innerHTML = roundNumber(a.z);
+            console.log("getAccel success callback");
+        };
+
+        // Fail callback
+        var fail = function (e) {
+            console.log("getAccel fail callback with error code " + e);
+            setAccelStatus(Accelerometer.ERROR_MSG[e]);
+        };
+
+        // Make call
+        var opt = {};
+        navigator.accelerometer.getCurrentAcceleration(success, fail, opt);
+    };
+
+    /**
+     * Set accelerometer status
+     */
+    var setAccelStatus = function (status) {
+        document.getElementById('accel_status').innerHTML = status;
+    };
+
+    /******************************************************************************/
+
+    contentEl.innerHTML = '<div id="info">' +
+        'Status: <span id="accel_status">Stopped</span>' +
+        '<table width="100%">' +
+        '<tr><td width="20%">X:</td><td id="x"> </td></tr>' +
+        '<tr><td width="20%">Y:</td><td id="y"> </td></tr>' +
+        '<tr><td width="20%">Z:</td><td id="z"> </td></tr>' +
+        '</table></div>' +
+        '<div id="actions"></div>';
+
+    createActionButton('Get Acceleration', function () {
+        getAccel();
+    }, 'actions');
+
+    createActionButton('Start Watch', function () {
+        watchAccel();
+    }, 'actions');
+
+    createActionButton('Clear Watch', function () {
+        stopAccel();
+    }, 'actions');
+};


[3/6] git commit: Merging to work on top of test framework changes

Posted by pu...@apache.org.
Merging to work on top of test framework changes


Project: http://git-wip-us.apache.org/repos/asf/cordova-plugin-device-motion/repo
Commit: http://git-wip-us.apache.org/repos/asf/cordova-plugin-device-motion/commit/fdbc17d3
Tree: http://git-wip-us.apache.org/repos/asf/cordova-plugin-device-motion/tree/fdbc17d3
Diff: http://git-wip-us.apache.org/repos/asf/cordova-plugin-device-motion/diff/fdbc17d3

Branch: refs/heads/master
Commit: fdbc17d3e10a16cab260d5a4b9deb3fa4b2d70f8
Parents: 8c85ec8 c16c6e4
Author: Edna Morales <ed...@ednas-mbp-2.raleigh.ibm.com>
Authored: Wed Jul 23 16:31:16 2014 -0400
Committer: Edna Morales <ed...@ednas-mbp-2.raleigh.ibm.com>
Committed: Wed Jul 23 16:31:16 2014 -0400

----------------------------------------------------------------------
 plugin.xml    |   2 +-
 test/tests.js | 287 +++++++++++++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 288 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cordova-plugin-device-motion/blob/fdbc17d3/plugin.xml
----------------------------------------------------------------------


[2/6] git commit: Removed js-module for tests from plugin.xml

Posted by pu...@apache.org.
Removed js-module for tests from plugin.xml


Project: http://git-wip-us.apache.org/repos/asf/cordova-plugin-device-motion/repo
Commit: http://git-wip-us.apache.org/repos/asf/cordova-plugin-device-motion/commit/c16c6e42
Tree: http://git-wip-us.apache.org/repos/asf/cordova-plugin-device-motion/tree/c16c6e42
Diff: http://git-wip-us.apache.org/repos/asf/cordova-plugin-device-motion/diff/c16c6e42

Branch: refs/heads/master
Commit: c16c6e426bcf8359b721ea3360ab8c9a0eb94119
Parents: 7880ada
Author: Staci Cooper <sm...@us.ibm.com>
Authored: Thu Jul 17 15:47:20 2014 -0400
Committer: Staci Cooper <sm...@us.ibm.com>
Committed: Thu Jul 17 15:47:20 2014 -0400

----------------------------------------------------------------------
 plugin.xml | 3 ---
 1 file changed, 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cordova-plugin-device-motion/blob/c16c6e42/plugin.xml
----------------------------------------------------------------------
diff --git a/plugin.xml b/plugin.xml
index c32a175..451dbb8 100644
--- a/plugin.xml
+++ b/plugin.xml
@@ -37,9 +37,6 @@
         <clobbers target="navigator.accelerometer" />
     </js-module>
 
-    <js-module src="test/tests.js" name="tests">
-    </js-module>
-    
     <!-- firefoxos -->
     <platform name="firefoxos">
         <config-file target="config.xml" parent="/*">


[6/6] git commit: rebasing from master

Posted by pu...@apache.org.
rebasing from master


Project: http://git-wip-us.apache.org/repos/asf/cordova-plugin-device-motion/repo
Commit: http://git-wip-us.apache.org/repos/asf/cordova-plugin-device-motion/commit/d6cd397d
Tree: http://git-wip-us.apache.org/repos/asf/cordova-plugin-device-motion/tree/d6cd397d
Diff: http://git-wip-us.apache.org/repos/asf/cordova-plugin-device-motion/diff/d6cd397d

Branch: refs/heads/master
Commit: d6cd397d613695b4922467a836c82c55db576dec
Parents: 6ec6016 ad94eec
Author: Edna Morales <ed...@ednas-mbp-2.raleigh.ibm.com>
Authored: Mon Aug 18 11:44:16 2014 -0400
Committer: Edna Morales <ed...@ednas-mbp-2.raleigh.ibm.com>
Committed: Mon Aug 18 11:44:16 2014 -0400

----------------------------------------------------------------------
 doc/index.md | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
----------------------------------------------------------------------



[4/6] git commit: added documentation for manual tests

Posted by pu...@apache.org.
added documentation for manual tests


Project: http://git-wip-us.apache.org/repos/asf/cordova-plugin-device-motion/repo
Commit: http://git-wip-us.apache.org/repos/asf/cordova-plugin-device-motion/commit/183e8712
Tree: http://git-wip-us.apache.org/repos/asf/cordova-plugin-device-motion/tree/183e8712
Diff: http://git-wip-us.apache.org/repos/asf/cordova-plugin-device-motion/diff/183e8712

Branch: refs/heads/master
Commit: 183e8712782eea400faaa495366d4de3ade0a2a5
Parents: fdbc17d
Author: Edna Morales <ed...@ednas-mbp-2.raleigh.ibm.com>
Authored: Thu Jul 24 13:28:30 2014 -0400
Committer: Edna Morales <ed...@ednas-mbp-2.raleigh.ibm.com>
Committed: Thu Jul 24 13:28:30 2014 -0400

----------------------------------------------------------------------
 test/tests.js | 15 +++++++++++----
 1 file changed, 11 insertions(+), 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cordova-plugin-device-motion/blob/183e8712/test/tests.js
----------------------------------------------------------------------
diff --git a/test/tests.js b/test/tests.js
index 75016d0..6bcd61c 100644
--- a/test/tests.js
+++ b/test/tests.js
@@ -264,6 +264,13 @@ exports.defineManualTests = function (contentEl, createActionButton) {
 
     /******************************************************************************/
 
+    var accelerometer_tests = '<div id="getAcceleration"></div>' +
+        'Expected result: Will update the status box with X, Y, and Z values when pressed. Status will read "Stopped"' +
+        '<p/> <div id="watchAcceleration"></div>' +
+        'Expected result: When pressed, will start a watch on the accelerometer and update X,Y,Z values when movement is sensed. Status will read "Running"' +
+        '<p/> <div id="clearAcceleration"></div>' +
+        'Expected result: Will clear the accelerometer watch, so X,Y,Z values will no longer be updated. Status will read "Stopped"';
+
     contentEl.innerHTML = '<div id="info">' +
         'Status: <span id="accel_status">Stopped</span>' +
         '<table width="100%">' +
@@ -271,17 +278,17 @@ exports.defineManualTests = function (contentEl, createActionButton) {
         '<tr><td width="20%">Y:</td><td id="y"> </td></tr>' +
         '<tr><td width="20%">Z:</td><td id="z"> </td></tr>' +
         '</table></div>' +
-        '<div id="actions"></div>';
+        accelerometer_tests;
 
     createActionButton('Get Acceleration', function () {
         getAccel();
-    }, 'actions');
+    }, 'getAcceleration');
 
     createActionButton('Start Watch', function () {
         watchAccel();
-    }, 'actions');
+    }, 'watchAcceleration');
 
     createActionButton('Clear Watch', function () {
         stopAccel();
-    }, 'actions');
+    }, 'clearAcceleration');
 };


[5/6] git commit: merged with renamed tests dir

Posted by pu...@apache.org.
merged with renamed tests dir


Project: http://git-wip-us.apache.org/repos/asf/cordova-plugin-device-motion/repo
Commit: http://git-wip-us.apache.org/repos/asf/cordova-plugin-device-motion/commit/6ec6016a
Tree: http://git-wip-us.apache.org/repos/asf/cordova-plugin-device-motion/tree/6ec6016a
Diff: http://git-wip-us.apache.org/repos/asf/cordova-plugin-device-motion/diff/6ec6016a

Branch: refs/heads/master
Commit: 6ec6016a67e8f83ea8cb5022920e49e6c14c0418
Parents: 183e871 cf06008
Author: Edna Morales <ed...@ednas-mbp-2.raleigh.ibm.com>
Authored: Wed Aug 13 12:53:01 2014 -0400
Committer: Edna Morales <ed...@ednas-mbp-2.raleigh.ibm.com>
Committed: Wed Aug 13 12:53:01 2014 -0400

----------------------------------------------------------------------
 RELEASENOTES.md                |   6 +
 doc/pl/index.md                |  42 +++---
 plugin.xml                     |   2 +-
 src/firefoxos/accelerometer.js |   2 +-
 test/tests.js                  | 294 ------------------------------------
 tests/plugin.xml               |  29 ++++
 tests/tests.js                 | 294 ++++++++++++++++++++++++++++++++++++
 7 files changed, 352 insertions(+), 317 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cordova-plugin-device-motion/blob/6ec6016a/tests/tests.js
----------------------------------------------------------------------
diff --cc tests/tests.js
index 0000000,1deb0c4..6bcd61c
mode 000000,100644..100644
--- a/tests/tests.js
+++ b/tests/tests.js
@@@ -1,0 -1,287 +1,294 @@@
+ /*
+  *
+  * 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.
+  *
+ */
+ 
+ exports.defineAutoTests = function () {
 -    describe('Accelerometer (navigator.accelerometer)', function () {
 -        var fail = function (done) {
 -            expect(true).toBe(false);
 -            done();
++  describe('Accelerometer (navigator.accelerometer)', function () {
++    var fail = function(done) {
++      expect(true).toBe(false);
++      done();
++    };
++
++    it("accelerometer.spec.1 should exist", function () {
++      expect(navigator.accelerometer).toBeDefined();
++    });
++
++    describe("getCurrentAcceleration", function() {
++      it("accelerometer.spec.2 should exist", function() {
++        expect(typeof navigator.accelerometer.getCurrentAcceleration).toBeDefined();
++        expect(typeof navigator.accelerometer.getCurrentAcceleration == 'function').toBe(true);
++      });
++
++      it("accelerometer.spec.3 success callback should be called with an Acceleration object", function(done) {
++        var win = function(a) {
++          expect(a).toBeDefined();
++          expect(a.x).toBeDefined();
++          expect(typeof a.x == 'number').toBe(true);
++          expect(a.y).toBeDefined();
++          expect(typeof a.y == 'number').toBe(true);
++          expect(a.z).toBeDefined();
++          expect(typeof a.z == 'number').toBe(true);
++          expect(a.timestamp).toBeDefined();
++          expect(typeof a.timestamp).toBe('number');
++          done();
+         };
+ 
 -        it("accelerometer.spec.1 should exist", function () {
 -            expect(navigator.accelerometer).toBeDefined();
 -        });
++        navigator.accelerometer.getCurrentAcceleration(win, fail.bind(null, done));
++      });
++
++      it("accelerometer.spec.4 success callback Acceleration object should have (reasonable) values for x, y and z expressed in m/s^2", function(done) {
++        var reasonableThreshold = 15;
++        var win = function(a) {
++          expect(a.x).toBeLessThan(reasonableThreshold);
++          expect(a.x).toBeGreaterThan(reasonableThreshold * -1);
++          expect(a.y).toBeLessThan(reasonableThreshold);
++          expect(a.y).toBeGreaterThan(reasonableThreshold * -1);
++          expect(a.z).toBeLessThan(reasonableThreshold);
++          expect(a.z).toBeGreaterThan(reasonableThreshold * -1);
++          done()
++        };
+ 
 -        describe("getCurrentAcceleration", function () {
 -            it("accelerometer.spec.2 should exist", function () {
 -                expect(typeof navigator.accelerometer.getCurrentAcceleration).toBeDefined();
 -                expect(typeof navigator.accelerometer.getCurrentAcceleration == 'function').toBe(true);
 -            });
 -
 -            it("accelerometer.spec.3 success callback should be called with an Acceleration object", function (done) {
 -                var win = function (a) {
 -                    expect(a).toBeDefined();
 -                    expect(a.x).toBeDefined();
 -                    expect(typeof a.x == 'number').toBe(true);
 -                    expect(a.y).toBeDefined();
 -                    expect(typeof a.y == 'number').toBe(true);
 -                    expect(a.z).toBeDefined();
 -                    expect(typeof a.z == 'number').toBe(true);
 -                    expect(a.timestamp).toBeDefined();
 -                    expect(typeof a.timestamp).toBe('number');
 -                    done();
 -                };
 -
 -                navigator.accelerometer.getCurrentAcceleration(win, fail.bind(null, done));
 -            });
 -
 -            it("accelerometer.spec.4 success callback Acceleration object should have (reasonable) values for x, y and z expressed in m/s^2", function (done) {
 -                var reasonableThreshold = 15;
 -                var win = function (a) {
 -                    expect(a.x).toBeLessThan(reasonableThreshold);
 -                    expect(a.x).toBeGreaterThan(reasonableThreshold * -1);
 -                    expect(a.y).toBeLessThan(reasonableThreshold);
 -                    expect(a.y).toBeGreaterThan(reasonableThreshold * -1);
 -                    expect(a.z).toBeLessThan(reasonableThreshold);
 -                    expect(a.z).toBeGreaterThan(reasonableThreshold * -1);
 -                    done()
 -                };
 -
 -                navigator.accelerometer.getCurrentAcceleration(win, fail.bind(null, done));
 -            });
 -
 -            it("accelerometer.spec.5 success callback Acceleration object should return a recent timestamp", function (done) {
 -                var veryRecently = (new Date()).getTime();
 -                // Need to check that dates returned are not vastly greater than a recent time stamp.
 -                // In case the timestamps returned are ridiculously high
 -                var reasonableTimeLimit = veryRecently + 5000; // 5 seconds from now
 -                var win = function (a) {
 -                    expect(a.timestamp).toBeGreaterThan(veryRecently);
 -                    expect(a.timestamp).toBeLessThan(reasonableTimeLimit);
 -                    done();
 -                };
 -
 -                navigator.accelerometer.getCurrentAcceleration(win, fail.bind(null, done));
 -            });
 -        });
++        navigator.accelerometer.getCurrentAcceleration(win, fail.bind(null,done));
++      });
++
++      it("accelerometer.spec.5 success callback Acceleration object should return a recent timestamp", function(done) {
++        var veryRecently = (new Date()).getTime();
++        // Need to check that dates returned are not vastly greater than a recent time stamp.
++        // In case the timestamps returned are ridiculously high
++        var reasonableTimeLimit = veryRecently + 5000; // 5 seconds from now
++        var win = function(a) {
++          expect(a.timestamp).toBeGreaterThan(veryRecently);
++          expect(a.timestamp).toBeLessThan(reasonableTimeLimit);
++          done();
++        };
++
++        navigator.accelerometer.getCurrentAcceleration(win, fail.bind(null,done));
++      });
++    });
++
++    describe("watchAcceleration", function() {
++      var id;
++
++      afterEach(function() {
++          navigator.accelerometer.clearWatch(id);
++      });
++
++      it("accelerometer.spec.6 should exist", function() {
++          expect(navigator.accelerometer.watchAcceleration).toBeDefined();
++          expect(typeof navigator.accelerometer.watchAcceleration == 'function').toBe(true);
++      });
++
++      it("accelerometer.spec.7 success callback should be called with an Acceleration object", function(done) {
++        var win = function(a) {
++          expect(a).toBeDefined();
++          expect(a.x).toBeDefined();
++          expect(typeof a.x == 'number').toBe(true);
++          expect(a.y).toBeDefined();
++          expect(typeof a.y == 'number').toBe(true);
++          expect(a.z).toBeDefined();
++          expect(typeof a.z == 'number').toBe(true);
++          expect(a.timestamp).toBeDefined();
++          expect(typeof a.timestamp).toBe('number');
++          done();
++        };
++
++        id = navigator.accelerometer.watchAcceleration(win, fail.bind(null,done), {frequency:100});
++      });
++
++        it("accelerometer.spec.8 success callback Acceleration object should have (reasonable) values for x, y and z expressed in m/s^2", function(done) {
++          var reasonableThreshold = 15;
++          var win = function(a) {
++            expect(a.x).toBeLessThan(reasonableThreshold);
++            expect(a.x).toBeGreaterThan(reasonableThreshold * -1);
++            expect(a.y).toBeLessThan(reasonableThreshold);
++            expect(a.y).toBeGreaterThan(reasonableThreshold * -1);
++            expect(a.z).toBeLessThan(reasonableThreshold);
++            expect(a.z).toBeGreaterThan(reasonableThreshold * -1);
++            done();
++          };
+ 
 -        describe("watchAcceleration", function () {
 -            var id;
 -
 -            afterEach(function () {
 -                navigator.accelerometer.clearWatch(id);
 -            });
 -
 -            it("accelerometer.spec.6 should exist", function () {
 -                expect(navigator.accelerometer.watchAcceleration).toBeDefined();
 -                expect(typeof navigator.accelerometer.watchAcceleration == 'function').toBe(true);
 -            });
 -
 -            it("accelerometer.spec.7 success callback should be called with an Acceleration object", function (done) {
 -                var win = function (a) {
 -                    expect(a).toBeDefined();
 -                    expect(a.x).toBeDefined();
 -                    expect(typeof a.x == 'number').toBe(true);
 -                    expect(a.y).toBeDefined();
 -                    expect(typeof a.y == 'number').toBe(true);
 -                    expect(a.z).toBeDefined();
 -                    expect(typeof a.z == 'number').toBe(true);
 -                    expect(a.timestamp).toBeDefined();
 -                    expect(typeof a.timestamp).toBe('number');
 -                    done();
 -                };
 -
 -                id = navigator.accelerometer.watchAcceleration(win, fail.bind(null, done), { frequency: 100 });
 -            });
 -
 -            it("accelerometer.spec.8 success callback Acceleration object should have (reasonable) values for x, y and z expressed in m/s^2", function (done) {
 -                var reasonableThreshold = 15;
 -                var win = function (a) {
 -                    expect(a.x).toBeLessThan(reasonableThreshold);
 -                    expect(a.x).toBeGreaterThan(reasonableThreshold * -1);
 -                    expect(a.y).toBeLessThan(reasonableThreshold);
 -                    expect(a.y).toBeGreaterThan(reasonableThreshold * -1);
 -                    expect(a.z).toBeLessThan(reasonableThreshold);
 -                    expect(a.z).toBeGreaterThan(reasonableThreshold * -1);
 -                    done();
 -                };
 -
 -                id = navigator.accelerometer.watchAcceleration(win, fail.bind(null, done), { frequency: 100 });
 -            });
 -
 -            it("accelerometer.spec.9 success callback Acceleration object should return a recent timestamp", function (done) {
 -                var veryRecently = (new Date()).getTime();
 -                // Need to check that dates returned are not vastly greater than a recent time stamp.
 -                // In case the timestamps returned are ridiculously high
 -                var reasonableTimeLimit = veryRecently + 5000; // 5 seconds from now
 -                var win = function (a) {
 -                    expect(a.timestamp).toBeGreaterThan(veryRecently);
 -                    expect(a.timestamp).toBeLessThan(reasonableTimeLimit);
 -                    done();
 -                };
 -
 -                id = navigator.accelerometer.watchAcceleration(win, fail.bind(null, done), { frequency: 100 });
 -            });
++          id = navigator.accelerometer.watchAcceleration(win, fail.bind(null,done), {frequency:100});
+         });
+ 
 -        describe("clearWatch", function () {
 -            it("accelerometer.spec.10 should exist", function () {
 -                expect(navigator.accelerometer.clearWatch).toBeDefined();
 -                expect(typeof navigator.accelerometer.clearWatch == 'function').toBe(true);
 -            });
 -
 -            it("accelerometer.spec.11 should clear an existing watch", function (done) {
 -                var id;
 -
 -                // expect win to get called exactly once
 -                var win = function (a) {
 -                    // clear watch on first call
 -                    navigator.accelerometer.clearWatch(id);
 -                    // if win isn't called again in 201 ms we assume success
 -                    var tid = setTimeout(function () {
 -                        expect(true).toBe(true);
 -                        done();
 -                    }, 101);
 -                    // if win is called again, clear the timeout and fail the test
 -                    win = function () {
 -                        clearTimeout(tid);
 -                        fail(done);
 -                    }
 -                };
 -
 -                // wrap the success call in a closure since the value of win changes between calls
 -                id = navigator.accelerometer.watchAcceleration(function () { win(); }, fail.bind(null, done), { frequency: 100 });
 -            });
++        it("accelerometer.spec.9 success callback Acceleration object should return a recent timestamp", function(done) {
++          var veryRecently = (new Date()).getTime();
++          // Need to check that dates returned are not vastly greater than a recent time stamp.
++          // In case the timestamps returned are ridiculously high
++          var reasonableTimeLimit = veryRecently + 5000; // 5 seconds from now
++          var win = function(a) {
++            expect(a.timestamp).toBeGreaterThan(veryRecently);
++            expect(a.timestamp).toBeLessThan(reasonableTimeLimit);
++            done();
++          };
++
++          id = navigator.accelerometer.watchAcceleration(win, fail.bind(null,done), {frequency:100});
+         });
+     });
++
++    describe("clearWatch", function() {
++      it("accelerometer.spec.10 should exist", function() {
++          expect(navigator.accelerometer.clearWatch).toBeDefined();
++          expect(typeof navigator.accelerometer.clearWatch == 'function').toBe(true);
++      });
++
++      it("accelerometer.spec.11 should clear an existing watch", function(done) {
++          var id;
++
++          // expect win to get called exactly once
++          var win = function(a) {
++            // clear watch on first call
++            navigator.accelerometer.clearWatch(id);
++            // if win isn't called again in 201 ms we assume success
++            var tid = setTimeout(function() {
++              expect(true).toBe(true);
++              done();
++            }, 101);
++            // if win is called again, clear the timeout and fail the test
++            win = function() {
++              clearTimeout(tid);
++              fail(done);
++            }
++          };
++
++          // wrap the success call in a closure since the value of win changes between calls
++          id = navigator.accelerometer.watchAcceleration(function() { win(); }, fail.bind(null, done), {frequency:100});
++      });
++    });
++  });
+ };
+ 
+ /******************************************************************************/
+ /******************************************************************************/
+ /******************************************************************************/
+ 
+ exports.defineManualTests = function (contentEl, createActionButton) {
+     function roundNumber(num) {
+         var dec = 3;
+         var result = Math.round(num * Math.pow(10, dec)) / Math.pow(10, dec);
+         return result;
+     }
+ 
+     var watchAccelId = null;
+ 
+     /**
+      * Start watching acceleration
+      */
+     var watchAccel = function () {
+         console.log("watchAccel()");
+ 
+         // Success callback
+         var success = function (a) {
+             document.getElementById('x').innerHTML = roundNumber(a.x);
+             document.getElementById('y').innerHTML = roundNumber(a.y);
+             document.getElementById('z').innerHTML = roundNumber(a.z);
+         };
+ 
+         // Fail callback
+         var fail = function (e) {
+             console.log("watchAccel fail callback with error code " + e);
+             stopAccel();
+             setAccelStatus(Accelerometer.ERROR_MSG[e]);
+         };
+ 
+         // Update acceleration every 1 sec
+         var opt = {};
+         opt.frequency = 1000;
+         watchAccelId = navigator.accelerometer.watchAcceleration(success, fail, opt);
+ 
+         setAccelStatus("Running");
+     };
+ 
+     /**
+      * Stop watching the acceleration
+      */
+     var stopAccel = function () {
+         console.log("stopAccel()");
+         setAccelStatus("Stopped");
+         if (watchAccelId) {
+             navigator.accelerometer.clearWatch(watchAccelId);
+             watchAccelId = null;
+         }
+     };
+ 
+     /**
+      * Get current acceleration
+      */
+     var getAccel = function () {
+         console.log("getAccel()");
+ 
+         // Stop accel if running
+         stopAccel();
+ 
+         // Success callback
+         var success = function (a) {
+             document.getElementById('x').innerHTML = roundNumber(a.x);
+             document.getElementById('y').innerHTML = roundNumber(a.y);
+             document.getElementById('z').innerHTML = roundNumber(a.z);
+             console.log("getAccel success callback");
+         };
+ 
+         // Fail callback
+         var fail = function (e) {
+             console.log("getAccel fail callback with error code " + e);
+             setAccelStatus(Accelerometer.ERROR_MSG[e]);
+         };
+ 
+         // Make call
+         var opt = {};
+         navigator.accelerometer.getCurrentAcceleration(success, fail, opt);
+     };
+ 
+     /**
+      * Set accelerometer status
+      */
+     var setAccelStatus = function (status) {
+         document.getElementById('accel_status').innerHTML = status;
+     };
+ 
+     /******************************************************************************/
+ 
++    var accelerometer_tests = '<div id="getAcceleration"></div>' +
++        'Expected result: Will update the status box with X, Y, and Z values when pressed. Status will read "Stopped"' +
++        '<p/> <div id="watchAcceleration"></div>' +
++        'Expected result: When pressed, will start a watch on the accelerometer and update X,Y,Z values when movement is sensed. Status will read "Running"' +
++        '<p/> <div id="clearAcceleration"></div>' +
++        'Expected result: Will clear the accelerometer watch, so X,Y,Z values will no longer be updated. Status will read "Stopped"';
++
+     contentEl.innerHTML = '<div id="info">' +
+         'Status: <span id="accel_status">Stopped</span>' +
+         '<table width="100%">' +
+         '<tr><td width="20%">X:</td><td id="x"> </td></tr>' +
+         '<tr><td width="20%">Y:</td><td id="y"> </td></tr>' +
+         '<tr><td width="20%">Z:</td><td id="z"> </td></tr>' +
+         '</table></div>' +
 -        '<div id="actions"></div>';
++        accelerometer_tests;
+ 
+     createActionButton('Get Acceleration', function () {
+         getAccel();
 -    }, 'actions');
++    }, 'getAcceleration');
+ 
+     createActionButton('Start Watch', function () {
+         watchAccel();
 -    }, 'actions');
++    }, 'watchAcceleration');
+ 
+     createActionButton('Clear Watch', function () {
+         stopAccel();
 -    }, 'actions');
++    }, 'clearAcceleration');
+ };