You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cordova.apache.org by st...@apache.org on 2013/05/16 22:39:08 UTC
git commit: updated tests
Updated Branches:
refs/heads/master d33583f64 -> afaa07f22
updated 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/afaa07f2
Tree: http://git-wip-us.apache.org/repos/asf/cordova-plugin-device-motion/tree/afaa07f2
Diff: http://git-wip-us.apache.org/repos/asf/cordova-plugin-device-motion/diff/afaa07f2
Branch: refs/heads/master
Commit: afaa07f22d17e67d4e84ce03035c12256cd660ae
Parents: d33583f
Author: Steven Gill <st...@gmail.com>
Authored: Thu May 16 13:39:04 2013 -0700
Committer: Steven Gill <st...@gmail.com>
Committed: Thu May 16 13:39:04 2013 -0700
----------------------------------------------------------------------
test/accelerometer/index.html | 2 +-
test/autotest/html/SpecView.js | 2 +-
test/autotest/index.html | 2 +-
test/autotest/pages/accelerometer.html | 2 +-
test/cordova-incl.js | 70 ++++++++++++++++++++++++++
test/cordova.js | 71 ---------------------------
test/index.html | 4 +-
7 files changed, 76 insertions(+), 77 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cordova-plugin-device-motion/blob/afaa07f2/test/accelerometer/index.html
----------------------------------------------------------------------
diff --git a/test/accelerometer/index.html b/test/accelerometer/index.html
index e0be68d..bbec57f 100644
--- a/test/accelerometer/index.html
+++ b/test/accelerometer/index.html
@@ -26,7 +26,7 @@
<meta http-equiv="Content-type" content="text/html; charset=utf-8"> <!-- ISO-8859-1 -->
<title>Cordova Mobile Spec</title>
<link rel="stylesheet" href="../master.css" type="text/css" media="screen" title="no title" charset="utf-8">
- <script type="text/javascript" charset="utf-8" src="../cordova.js"></script>
+ <script type="text/javascript" charset="utf-8" src="../cordova-incl.js"></script>
<script type="text/javascript" charset="utf-8">
http://git-wip-us.apache.org/repos/asf/cordova-plugin-device-motion/blob/afaa07f2/test/autotest/html/SpecView.js
----------------------------------------------------------------------
diff --git a/test/autotest/html/SpecView.js b/test/autotest/html/SpecView.js
index 8769bb8..e8a3c23 100644
--- a/test/autotest/html/SpecView.js
+++ b/test/autotest/html/SpecView.js
@@ -76,4 +76,4 @@ jasmine.HtmlReporter.SpecView.prototype.appendFailureDetail = function() {
}
};
-jasmine.HtmlReporterHelpers.addHelpers(jasmine.HtmlReporter.SpecView);
\ No newline at end of file
+jasmine.HtmlReporterHelpers.addHelpers(jasmine.HtmlReporter.SpecView);
http://git-wip-us.apache.org/repos/asf/cordova-plugin-device-motion/blob/afaa07f2/test/autotest/index.html
----------------------------------------------------------------------
diff --git a/test/autotest/index.html b/test/autotest/index.html
index e73fd58..6ebccbd 100644
--- a/test/autotest/index.html
+++ b/test/autotest/index.html
@@ -29,7 +29,7 @@
<title>Cordova API Specs</title>
<link rel="stylesheet" href="../master.css" type="text/css" media="screen" title="no title" charset="utf-8">
- <script type="text/javascript" src="../cordova.js"></script>
+ <script type="text/javascript" src="../cordova-incl.js"></script>
</head>
<body id="stage" class="theme">
<h1>Cordova API Specs</h1>
http://git-wip-us.apache.org/repos/asf/cordova-plugin-device-motion/blob/afaa07f2/test/autotest/pages/accelerometer.html
----------------------------------------------------------------------
diff --git a/test/autotest/pages/accelerometer.html b/test/autotest/pages/accelerometer.html
index 4af4cf5..856dc70 100644
--- a/test/autotest/pages/accelerometer.html
+++ b/test/autotest/pages/accelerometer.html
@@ -38,7 +38,7 @@
<script type="text/javascript" src="../html/TrivialReporter.js"></script>
<!-- Source -->
- <script type="text/javascript" src="../../cordova.js"></script>
+ <script type="text/javascript" src="../../cordova-incl.js"></script>
<!-- Load Test Runner -->
<script type="text/javascript" src="../test-runner.js"></script>
http://git-wip-us.apache.org/repos/asf/cordova-plugin-device-motion/blob/afaa07f2/test/cordova-incl.js
----------------------------------------------------------------------
diff --git a/test/cordova-incl.js b/test/cordova-incl.js
new file mode 100644
index 0000000..dbcd1a6
--- /dev/null
+++ b/test/cordova-incl.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.
+ *
+*/
+
+var PLAT;
+if (/Android/.exec(navigator.userAgent)) {
+ PLAT = 'android';
+} else if (/(iPad)|(iPhone)|(iPod)/.exec(navigator.userAgent)) {
+ PLAT = 'ios';
+} else if (/(BB10)|(PlayBook)|(BlackBerry)/.exec(navigator.userAgent)) {
+ PLAT = 'blackberry';
+}
+
+var scripts = document.getElementsByTagName('script');
+var currentPath = scripts[scripts.length - 1].src;
+var platformCordovaPath = currentPath.replace("cordova-incl.js", "cordova." + PLAT + ".js");
+var normalCordovaPath = currentPath.replace("cordova-incl.js", "cordova.js");
+var cordovaPath = normalCordovaPath;
+
+if (PLAT) {
+ // XHR to local file is an error on some platforms, windowsphone for one
+ try {
+ var xhr = new XMLHttpRequest();
+ xhr.open("GET", platformCordovaPath, false);
+ xhr.onreadystatechange = function() {
+
+ if (this.readyState == this.DONE && this.responseText.length > 0) {
+ if(parseInt(this.status) >= 400){
+ cordovaPath = normalCordovaPath;
+ }else{
+ cordovaPath = platformCordovaPath;
+ }
+ }
+ };
+ xhr.send(null);
+ }
+ catch(e){
+ cordovaPath = normalCordovaPath;
+ } // access denied!
+}
+
+if (!window._doNotWriteCordovaScript) {
+ document.write('<script type="text/javascript" charset="utf-8" src="' + cordovaPath + '"></script>');
+}
+
+function backHome() {
+ if (window.device && device.platform && device.platform.toLowerCase() == 'android') {
+ navigator.app.backHistory();
+ }
+ else {
+ window.history.go(-1);
+ }
+}
http://git-wip-us.apache.org/repos/asf/cordova-plugin-device-motion/blob/afaa07f2/test/cordova.js
----------------------------------------------------------------------
diff --git a/test/cordova.js b/test/cordova.js
deleted file mode 100644
index 91486a6..0000000
--- a/test/cordova.js
+++ /dev/null
@@ -1,71 +0,0 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
-*/
-
-var VERSION='dev';
-var PLAT;
-if (/Android/.exec(navigator.userAgent)) {
- PLAT = 'android';
-} else if (/(iPad)|(iPhone)|(iPod)/.exec(navigator.userAgent)) {
- PLAT = 'ios';
-} else if (/(BB10)|(PlayBook)|(BlackBerry)/.exec(navigator.userAgent)) {
- PLAT = 'blackberry';
-}
-
-var scripts = document.getElementsByTagName('script');
-var currentPath = scripts[scripts.length - 1].src;
-var platformCordovaPath = currentPath.replace("cordova.js", "cordova." + PLAT + ".js");
-var versionCordovaPath = currentPath.replace("cordova.js", "cordova-" + VERSION + ".js");
-var cordovaPath = versionCordovaPath;
-
-if (PLAT) {
- // XHR to local file is an error on some platforms, windowsphone for one
- try {
- var xhr = new XMLHttpRequest();
- xhr.open("GET", platformCordovaPath, false);
- xhr.onreadystatechange = function() {
-
- if (this.readyState == this.DONE && this.responseText.length > 0) {
- if(parseInt(this.status) >= 400){
- cordovaPath = versionCordovaPath;
- }else{
- cordovaPath = platformCordovaPath;
- }
- }
- };
- xhr.send(null);
- }
- catch(e){
- cordovaPath = versionCordovaPath;
- } // access denied!
-}
-
-if (!window._doNotWriteCordovaScript) {
- document.write('<script type="text/javascript" charset="utf-8" src="' + cordovaPath + '"></script>');
-}
-
-function backHome() {
- if (window.device && device.platform && device.platform.toLowerCase() == 'android') {
- navigator.app.backHistory();
- }
- else {
- window.history.go(-1);
- }
-}
http://git-wip-us.apache.org/repos/asf/cordova-plugin-device-motion/blob/afaa07f2/test/index.html
----------------------------------------------------------------------
diff --git a/test/index.html b/test/index.html
index da8f319..2c5447b 100644
--- a/test/index.html
+++ b/test/index.html
@@ -27,7 +27,7 @@
<meta http-equiv="Content-type" content="text/html; charset=utf-8">
<title>Cordova Mobile Spec</title>
<link rel="stylesheet" href="master.css" type="text/css" media="screen" title="no title" charset="utf-8">
- <script type="text/javascript" charset="utf-8" src="cordova.js"></script>
+ <script type="text/javascript" charset="utf-8" src="cordova-incl.js"></script>
<script type="text/javascript" charset="utf-8" src="main.js"></script>
</head>
@@ -52,7 +52,7 @@
<a href="contacts/index.html" class="btn large">Contacts</a>
<a href="events/index.html" class="btn large">Events</a>
<a href="location/index.html" class="btn large">Location</a>
- <a href="lazyloadjs/index.html" class="btn large">Lazy Loading of cordova.js</a>
+ <a href="lazyloadjs/index.html" class="btn large">Lazy Loading of cordova-incl.js</a>
<a href="misc/index.html" class="btn large">Misc Content</a>
<a href="network/index.html" class="btn large">Network</a>
<a href="notification/index.html" class="btn large">Notification</a>