You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cordova.apache.org by ag...@apache.org on 2014/07/07 20:08:12 UTC
[08/19] Move mobilespec into www/ so as to not include non-app files
in the app
http://git-wip-us.apache.org/repos/asf/cordova-mobile-spec/blob/77ff9a37/www/autotest/pages/compass.html
----------------------------------------------------------------------
diff --git a/www/autotest/pages/compass.html b/www/autotest/pages/compass.html
new file mode 100644
index 0000000..80de16f
--- /dev/null
+++ b/www/autotest/pages/compass.html
@@ -0,0 +1,55 @@
+<!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/77ff9a37/www/autotest/pages/contacts.html
----------------------------------------------------------------------
diff --git a/www/autotest/pages/contacts.html b/www/autotest/pages/contacts.html
new file mode 100644
index 0000000..e8e5fae
--- /dev/null
+++ b/www/autotest/pages/contacts.html
@@ -0,0 +1,56 @@
+<!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/77ff9a37/www/autotest/pages/datauri.html
----------------------------------------------------------------------
diff --git a/www/autotest/pages/datauri.html b/www/autotest/pages/datauri.html
new file mode 100644
index 0000000..33474dd
--- /dev/null
+++ b/www/autotest/pages/datauri.html
@@ -0,0 +1,53 @@
+<!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: Data URI tests</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/datauri.tests.js"></script>
+ <script type="text/javascript" charset="utf-8" src="./run-tests.js"></script>
+</head>
+
+<body>
+ <a href="javascript:" class="backBtn" onclick="backHome();">Back</a>
+</body>
+</html>
+
http://git-wip-us.apache.org/repos/asf/cordova-mobile-spec/blob/77ff9a37/www/autotest/pages/device.html
----------------------------------------------------------------------
diff --git a/www/autotest/pages/device.html b/www/autotest/pages/device.html
new file mode 100644
index 0000000..b1bed1d
--- /dev/null
+++ b/www/autotest/pages/device.html
@@ -0,0 +1,55 @@
+<!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: Device 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/device.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/77ff9a37/www/autotest/pages/file.html
----------------------------------------------------------------------
diff --git a/www/autotest/pages/file.html b/www/autotest/pages/file.html
new file mode 100644
index 0000000..d201791
--- /dev/null
+++ b/www/autotest/pages/file.html
@@ -0,0 +1,53 @@
+<!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/77ff9a37/www/autotest/pages/file.js
----------------------------------------------------------------------
diff --git a/www/autotest/pages/file.js b/www/autotest/pages/file.js
new file mode 100644
index 0000000..9b1a67a
--- /dev/null
+++ b/www/autotest/pages/file.js
@@ -0,0 +1,39 @@
+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);
+}
http://git-wip-us.apache.org/repos/asf/cordova-mobile-spec/blob/77ff9a37/www/autotest/pages/filetransfer.html
----------------------------------------------------------------------
diff --git a/www/autotest/pages/filetransfer.html b/www/autotest/pages/filetransfer.html
new file mode 100644
index 0000000..09809d8
--- /dev/null
+++ b/www/autotest/pages/filetransfer.html
@@ -0,0 +1,54 @@
+<!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/77ff9a37/www/autotest/pages/geolocation.html
----------------------------------------------------------------------
diff --git a/www/autotest/pages/geolocation.html b/www/autotest/pages/geolocation.html
new file mode 100644
index 0000000..b7a0698
--- /dev/null
+++ b/www/autotest/pages/geolocation.html
@@ -0,0 +1,55 @@
+<!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/77ff9a37/www/autotest/pages/globalization.html
----------------------------------------------------------------------
diff --git a/www/autotest/pages/globalization.html b/www/autotest/pages/globalization.html
new file mode 100644
index 0000000..295067e
--- /dev/null
+++ b/www/autotest/pages/globalization.html
@@ -0,0 +1,54 @@
+<!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/77ff9a37/www/autotest/pages/localXHR.html
----------------------------------------------------------------------
diff --git a/www/autotest/pages/localXHR.html b/www/autotest/pages/localXHR.html
new file mode 100644
index 0000000..10415f0
--- /dev/null
+++ b/www/autotest/pages/localXHR.html
@@ -0,0 +1,54 @@
+<!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: Local XHR 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/localXHR.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/77ff9a37/www/autotest/pages/media.html
----------------------------------------------------------------------
diff --git a/www/autotest/pages/media.html b/www/autotest/pages/media.html
new file mode 100644
index 0000000..ac1fa75
--- /dev/null
+++ b/www/autotest/pages/media.html
@@ -0,0 +1,55 @@
+<!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: Media 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/media.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/77ff9a37/www/autotest/pages/network.html
----------------------------------------------------------------------
diff --git a/www/autotest/pages/network.html b/www/autotest/pages/network.html
new file mode 100644
index 0000000..6af5521
--- /dev/null
+++ b/www/autotest/pages/network.html
@@ -0,0 +1,55 @@
+<!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/77ff9a37/www/autotest/pages/notification.html
----------------------------------------------------------------------
diff --git a/www/autotest/pages/notification.html b/www/autotest/pages/notification.html
new file mode 100644
index 0000000..50777bf
--- /dev/null
+++ b/www/autotest/pages/notification.html
@@ -0,0 +1,55 @@
+<!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/77ff9a37/www/autotest/pages/platform.html
----------------------------------------------------------------------
diff --git a/www/autotest/pages/platform.html b/www/autotest/pages/platform.html
new file mode 100644
index 0000000..3ddecd0
--- /dev/null
+++ b/www/autotest/pages/platform.html
@@ -0,0 +1,55 @@
+<!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: Platform 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/platform.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/77ff9a37/www/autotest/pages/run-tests.js
----------------------------------------------------------------------
diff --git a/www/autotest/pages/run-tests.js b/www/autotest/pages/run-tests.js
new file mode 100644
index 0000000..8e079ad
--- /dev/null
+++ b/www/autotest/pages/run-tests.js
@@ -0,0 +1,18 @@
+document.addEventListener('deviceready', function () {
+ 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();
+}, false);
+
+window.onload = function() {
+ addListenerToClass('backBtn', backHome);
+}
http://git-wip-us.apache.org/repos/asf/cordova-mobile-spec/blob/77ff9a37/www/autotest/pages/splashscreen.html
----------------------------------------------------------------------
diff --git a/www/autotest/pages/splashscreen.html b/www/autotest/pages/splashscreen.html
new file mode 100644
index 0000000..6ac1c4d
--- /dev/null
+++ b/www/autotest/pages/splashscreen.html
@@ -0,0 +1,55 @@
+<!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/77ff9a37/www/autotest/pages/storage.html
----------------------------------------------------------------------
diff --git a/www/autotest/pages/storage.html b/www/autotest/pages/storage.html
new file mode 100644
index 0000000..0f836e9
--- /dev/null
+++ b/www/autotest/pages/storage.html
@@ -0,0 +1,55 @@
+<!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: Storage 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/storage.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/77ff9a37/www/autotest/pages/vibration.html
----------------------------------------------------------------------
diff --git a/www/autotest/pages/vibration.html b/www/autotest/pages/vibration.html
new file mode 100644
index 0000000..04db2ec
--- /dev/null
+++ b/www/autotest/pages/vibration.html
@@ -0,0 +1,55 @@
+<!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/77ff9a37/www/autotest/pages/whitelist.html
----------------------------------------------------------------------
diff --git a/www/autotest/pages/whitelist.html b/www/autotest/pages/whitelist.html
new file mode 100644
index 0000000..ececfa2
--- /dev/null
+++ b/www/autotest/pages/whitelist.html
@@ -0,0 +1,55 @@
+<!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: Whitelist 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/whitelist.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/77ff9a37/www/autotest/test-runner.js
----------------------------------------------------------------------
diff --git a/www/autotest/test-runner.js b/www/autotest/test-runner.js
new file mode 100644
index 0000000..a744f81
--- /dev/null
+++ b/www/autotest/test-runner.js
@@ -0,0 +1,66 @@
+/*
+ *
+ * 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.
+ *
+*/
+
+if (window.sessionStorage != null) {
+ window.sessionStorage.clear();
+}
+
+// Timeout is 2 seconds to allow physical devices enough
+// time to query the response. This is important for some
+// Android devices.
+var Tests = function() {};
+Tests.TEST_TIMEOUT = 7500;
+
+// Creates a spy that will fail if called.
+function createDoNotCallSpy(name, opt_extraMessage) {
+ return jasmine.createSpy().andCallFake(function() {
+ var errorMessage = "" + name + ' should not have been called.';
+ try {
+ if (arguments.length) {
+ errorMessage += ' Got args: ' + JSON.stringify(arguments);
+ }
+ if (opt_extraMessage) {
+ errorMessage += '\n' + opt_extraMessage;
+ }
+ } catch(e) {
+ errorMessage += " (Cannot print details)";
+ }
+ expect(false).toBe(true, errorMessage);
+ });
+}
+
+// Waits for any of the given spys to be called.
+// Last param may be a custom timeout duration.
+function waitsForAny() {
+ var spys = [].slice.call(arguments);
+ var timeout = Tests.TEST_TIMEOUT;
+ if (typeof spys[spys.length - 1] == 'number') {
+ timeout = spys.pop();
+ }
+ waitsFor(function() {
+ for (var i = 0; i < spys.length; ++i) {
+ if (spys[i].wasCalled) {
+ return true;
+ }
+ }
+ return false;
+ }, "Expecting callbacks to be called.", timeout);
+}
http://git-wip-us.apache.org/repos/asf/cordova-mobile-spec/blob/77ff9a37/www/autotest/tests/accelerometer.tests.js
----------------------------------------------------------------------
diff --git a/www/autotest/tests/accelerometer.tests.js b/www/autotest/tests/accelerometer.tests.js
new file mode 100644
index 0000000..029db05
--- /dev/null
+++ b/www/autotest/tests/accelerometer.tests.js
@@ -0,0 +1,222 @@
+/*
+ *
+ * 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('Accelerometer (navigator.accelerometer)', function () {
+ it("accelerometer.spec.1 should exist", function () {
+ expect(navigator.accelerometer).toBeDefined();
+ });
+
+ describe("getCurrentAcceleration", function() {
+ afterEach(function(){
+ // wait between testcases to avoid interference
+ var flag=false;
+ runs(function() {
+ setTimeout(function() {flag = true;}, 500);
+ });
+
+ waitsFor(function() {return flag;}, "flag to be true", Tests.TEST_TIMEOUT);
+ });
+
+ 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() {
+ var win = jasmine.createSpy().andCallFake(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');
+ }),
+ fail = jasmine.createSpy();
+
+ runs(function () {
+ navigator.accelerometer.getCurrentAcceleration(win, fail);
+ });
+
+ waitsFor(function () { return win.wasCalled; }, "win never called", Tests.TEST_TIMEOUT);
+
+ runs(function () {
+ expect(fail).not.toHaveBeenCalled();
+ });
+ });
+
+ it("accelerometer.spec.4 success callback Acceleration object should have (reasonable) values for x, y and z expressed in m/s^2", function() {
+ var reasonableThreshold = 15;
+ var win = jasmine.createSpy().andCallFake(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);
+ }),
+ fail = jasmine.createSpy();
+
+ runs(function () {
+ navigator.accelerometer.getCurrentAcceleration(win, fail);
+ });
+
+ waitsFor(function () { return win.wasCalled; }, "win never called", Tests.TEST_TIMEOUT);
+
+ runs(function () {
+ expect(fail).not.toHaveBeenCalled();
+ });
+ });
+
+ it("accelerometer.spec.5 success callback Acceleration object should return a recent timestamp", function() {
+ // Check that timestamp returned is within a reasonable window.
+ var veryRecently = (new Date()).getTime()-1000; // lower bound - 1 second prior
+ var reasonableTimeLimit = veryRecently + 6000; // upper bound - 5 seconds from now
+ var win = jasmine.createSpy().andCallFake(function(a) {
+ expect(a.timestamp).toBeGreaterThan(veryRecently);
+ expect(a.timestamp).toBeLessThan(reasonableTimeLimit);
+ }),
+ fail = jasmine.createSpy();
+
+ runs(function () {
+ navigator.accelerometer.getCurrentAcceleration(win, fail);
+ });
+
+ waitsFor(function () { return win.wasCalled; }, "win never called", Tests.TEST_TIMEOUT);
+
+ runs(function () {
+ expect(fail).not.toHaveBeenCalled();
+ });
+ });
+ });
+
+ 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() {
+ var win = jasmine.createSpy().andCallFake(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');
+ }),
+ fail = jasmine.createSpy();
+
+ runs(function () {
+ id = navigator.accelerometer.watchAcceleration(win, fail, {frequency:500});
+ });
+
+ waitsFor(function () { return win.wasCalled; }, "win never called", Tests.TEST_TIMEOUT);
+
+ runs(function () {
+ expect(fail).not.toHaveBeenCalled();
+ });
+ });
+
+ it("accelerometer.spec.8 success callback Acceleration object should have (reasonable) values for x, y and z expressed in m/s^2", function() {
+ var reasonableThreshold = 15;
+ var win = jasmine.createSpy().andCallFake(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);
+ }),
+ fail = jasmine.createSpy();
+
+ runs(function () {
+ id = navigator.accelerometer.watchAcceleration(win, fail, {frequency:500});
+ });
+
+ waitsFor(function () { return win.wasCalled; }, "win never called", Tests.TEST_TIMEOUT);
+
+ runs(function () {
+ expect(fail).not.toHaveBeenCalled();
+ });
+ });
+
+ it("accelerometer.spec.9 success callback Acceleration object should return a recent timestamp", function() {
+ // Check that timestamp returned is within a reasonable window.
+ var veryRecently = (new Date()).getTime()-1000; // lower bound - 1 second prior
+ var reasonableTimeLimit = veryRecently + 6000; // upper bound - 5 seconds from now
+ var win = jasmine.createSpy().andCallFake(function(a) {
+ expect(a.timestamp).toBeGreaterThan(veryRecently);
+ expect(a.timestamp).toBeLessThan(reasonableTimeLimit);
+ }),
+ fail = jasmine.createSpy();
+
+ runs(function () {
+ id = navigator.accelerometer.watchAcceleration(win, fail, {frequency:500});
+ });
+
+ waitsFor(function () { return win.wasCalled; }, "win never called", Tests.TEST_TIMEOUT);
+
+ runs(function () {
+ expect(fail).not.toHaveBeenCalled();
+ });
+ });
+ });
+
+ 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() {
+ var id,
+ win = jasmine.createSpy();
+
+ runs(function() {
+ id = navigator.accelerometer.watchAcceleration(win, function() {}, {frequency:100});
+ });
+
+ waitsFor(function () { return win.wasCalled; }, "win never called", Tests.TEST_TIMEOUT);
+
+ runs(function() {
+ win.reset();
+ navigator.accelerometer.clearWatch(id);
+ });
+
+ waits(201);
+
+ runs(function() {
+ expect(win).not.toHaveBeenCalled();
+ });
+ });
+ });
+});
http://git-wip-us.apache.org/repos/asf/cordova-mobile-spec/blob/77ff9a37/www/autotest/tests/battery.tests.js
----------------------------------------------------------------------
diff --git a/www/autotest/tests/battery.tests.js b/www/autotest/tests/battery.tests.js
new file mode 100644
index 0000000..47a86d4
--- /dev/null
+++ b/www/autotest/tests/battery.tests.js
@@ -0,0 +1,187 @@
+/*
+ *
+ * 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/77ff9a37/www/autotest/tests/bridge.tests.js
----------------------------------------------------------------------
diff --git a/www/autotest/tests/bridge.tests.js b/www/autotest/tests/bridge.tests.js
new file mode 100644
index 0000000..28c44c2
--- /dev/null
+++ b/www/autotest/tests/bridge.tests.js
@@ -0,0 +1,37 @@
+/*
+ *
+ * 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('Bridge', function() {
+ if (cordova.platformId == 'android') {
+ it("bridge.spec.1 should reject bridge from iframe with data: URL", function() {
+ var ifr = document.createElement('iframe');
+ var done = false;
+ ifr.src = 'data:text/html,';
+ ifr.onload = function() {
+ var stolenSecret = ifr.contentWindow.prompt('', 'gap_init:');
+ done = true;
+ expect(stolenSecret).toBe(null);
+ };
+ document.body.appendChild(ifr);
+ waitsFor(function() { return done; });
+ });
+ }
+});
http://git-wip-us.apache.org/repos/asf/cordova-mobile-spec/blob/77ff9a37/www/autotest/tests/camera.tests.js
----------------------------------------------------------------------
diff --git a/www/autotest/tests/camera.tests.js b/www/autotest/tests/camera.tests.js
new file mode 100644
index 0000000..ee5bacd
--- /dev/null
+++ b/www/autotest/tests/camera.tests.js
@@ -0,0 +1,70 @@
+/*
+ *
+ * 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('Camera (navigator.camera)', function () {
+ it("should exist", function() {
+ expect(navigator.camera).toBeDefined();
+ });
+
+ it("should contain a getPicture function", function() {
+ expect(navigator.camera.getPicture).toBeDefined();
+ expect(typeof navigator.camera.getPicture == 'function').toBe(true);
+ });
+});
+
+describe('Camera Constants (window.Camera + navigator.camera)', function () {
+ it("camera.spec.1 window.Camera should exist", function() {
+ expect(window.Camera).toBeDefined();
+ });
+
+ it("camera.spec.2 should contain three DestinationType constants", function() {
+ expect(Camera.DestinationType.DATA_URL).toBe(0);
+ expect(Camera.DestinationType.FILE_URI).toBe(1);
+ expect(Camera.DestinationType.NATIVE_URI).toBe(2);
+ expect(navigator.camera.DestinationType.DATA_URL).toBe(0);
+ expect(navigator.camera.DestinationType.FILE_URI).toBe(1);
+ expect(navigator.camera.DestinationType.NATIVE_URI).toBe(2);
+ });
+
+ it("camera.spec.3 should contain two EncodingType constants", function() {
+ expect(Camera.EncodingType.JPEG).toBe(0);
+ expect(Camera.EncodingType.PNG).toBe(1);
+ expect(navigator.camera.EncodingType.JPEG).toBe(0);
+ expect(navigator.camera.EncodingType.PNG).toBe(1);
+ });
+
+ it("camera.spec.4 should contain three MediaType constants", function() {
+ expect(Camera.MediaType.PICTURE).toBe(0);
+ expect(Camera.MediaType.VIDEO).toBe(1);
+ expect(Camera.MediaType.ALLMEDIA).toBe(2);
+ expect(navigator.camera.MediaType.PICTURE).toBe(0);
+ expect(navigator.camera.MediaType.VIDEO).toBe(1);
+ expect(navigator.camera.MediaType.ALLMEDIA).toBe(2);
+ });
+ it("camera.spec.5 should contain three PictureSourceType constants", function() {
+ expect(Camera.PictureSourceType.PHOTOLIBRARY).toBe(0);
+ expect(Camera.PictureSourceType.CAMERA).toBe(1);
+ expect(Camera.PictureSourceType.SAVEDPHOTOALBUM).toBe(2);
+ expect(navigator.camera.PictureSourceType.PHOTOLIBRARY).toBe(0);
+ expect(navigator.camera.PictureSourceType.CAMERA).toBe(1);
+ expect(navigator.camera.PictureSourceType.SAVEDPHOTOALBUM).toBe(2);
+ });
+});
http://git-wip-us.apache.org/repos/asf/cordova-mobile-spec/blob/77ff9a37/www/autotest/tests/capture.tests.js
----------------------------------------------------------------------
diff --git a/www/autotest/tests/capture.tests.js b/www/autotest/tests/capture.tests.js
new file mode 100644
index 0000000..99ce438
--- /dev/null
+++ b/www/autotest/tests/capture.tests.js
@@ -0,0 +1,112 @@
+/*
+ *
+ * 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('Capture (navigator.device.capture)', function () {
+ it("capture.spec.1 should exist", function() {
+ expect(navigator.device).toBeDefined();
+ expect(navigator.device.capture).toBeDefined();
+ });
+
+ it("capture.spec.2 should have the correct properties ", function() {
+ expect(navigator.device.capture.supportedAudioModes).toBeDefined();
+ expect(navigator.device.capture.supportedImageModes).toBeDefined();
+ expect(navigator.device.capture.supportedVideoModes).toBeDefined();
+ });
+
+ it("capture.spec.3 should contain a captureAudio function", function() {
+ expect(navigator.device.capture.captureAudio).toBeDefined();
+ expect(typeof navigator.device.capture.captureAudio == 'function').toBe(true);
+ });
+
+ it("capture.spec.4 should contain a captureImage function", function() {
+ expect(navigator.device.capture.captureImage).toBeDefined();
+ expect(typeof navigator.device.capture.captureImage == 'function').toBe(true);
+ });
+
+ it("capture.spec.5 should contain a captureVideo function", function() {
+ expect(navigator.device.capture.captureVideo).toBeDefined();
+ expect(typeof navigator.device.capture.captureVideo == 'function').toBe(true);
+ });
+
+ describe('CaptureAudioOptions', function () {
+ it("capture.spec.6 CaptureAudioOptions constructor should exist", function() {
+ var options = new CaptureAudioOptions();
+ expect(options).toBeDefined();
+ expect(options.limit).toBeDefined();
+ expect(options.duration).toBeDefined();
+ });
+ });
+
+ describe('CaptureImageOptions', function () {
+ it("capture.spec.7 CaptureImageOptions constructor should exist", function() {
+ var options = new CaptureImageOptions();
+ expect(options).toBeDefined();
+ expect(options.limit).toBeDefined();
+ });
+ });
+
+ describe('CaptureVideoOptions', function () {
+ it("capture.spec.8 CaptureVideoOptions constructor should exist", function() {
+ var options = new CaptureVideoOptions();
+ expect(options).toBeDefined();
+ expect(options.limit).toBeDefined();
+ expect(options.duration).toBeDefined();
+ });
+ });
+
+ describe('CaptureError interface', function () {
+ it("capture.spec.9 CaptureError constants should be defined", function() {
+ expect(CaptureError.CAPTURE_INTERNAL_ERR).toBe(0);
+ expect(CaptureError.CAPTURE_APPLICATION_BUSY).toBe(1);
+ expect(CaptureError.CAPTURE_INVALID_ARGUMENT).toBe(2);
+ expect(CaptureError.CAPTURE_NO_MEDIA_FILES).toBe(3);
+ });
+
+ it("capture.spec.10 CaptureError properties should exist", function() {
+ var error = new CaptureError();
+ expect(error).toBeDefined();
+ expect(error.code).toBeDefined();
+ });
+ });
+
+ describe('MediaFileData', function () {
+ it("capture.spec.11 MediaFileData constructor should exist", function() {
+ var fileData = new MediaFileData();
+ expect(fileData).toBeDefined();
+ expect(fileData.bitrate).toBeDefined();
+ expect(fileData.codecs).toBeDefined();
+ expect(fileData.duration).toBeDefined();
+ expect(fileData.height).toBeDefined();
+ expect(fileData.width).toBeDefined();
+ });
+ });
+
+ describe('MediaFile', function () {
+ it("capture.spec.12 MediaFile constructor should exist", function() {
+ var fileData = new MediaFile();
+ expect(fileData).toBeDefined();
+ expect(fileData.name).toBeDefined();
+ expect(fileData.type).toBeDefined();
+ expect(fileData.lastModifiedDate).toBeDefined();
+ expect(fileData.size).toBeDefined();
+ });
+ });
+});
http://git-wip-us.apache.org/repos/asf/cordova-mobile-spec/blob/77ff9a37/www/autotest/tests/compass.tests.js
----------------------------------------------------------------------
diff --git a/www/autotest/tests/compass.tests.js b/www/autotest/tests/compass.tests.js
new file mode 100644
index 0000000..332daea
--- /dev/null
+++ b/www/autotest/tests/compass.tests.js
@@ -0,0 +1,136 @@
+/*
+ *
+ * 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);
+ });
+ });
+});