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 2012/05/01 22:57:38 UTC
[1/6] wp7 commit: updated test project for jasmine tests
Updated Branches:
refs/heads/master e8818c89a -> e92305939
updated test project for jasmine tests
Project: http://git-wip-us.apache.org/repos/asf/incubator-cordova-wp7/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-cordova-wp7/commit/e9230593
Tree: http://git-wip-us.apache.org/repos/asf/incubator-cordova-wp7/tree/e9230593
Diff: http://git-wip-us.apache.org/repos/asf/incubator-cordova-wp7/diff/e9230593
Branch: refs/heads/master
Commit: e92305939e9c9c38dbe738d217df280cd31d6c9c
Parents: e8818c8
Author: Jesse MacFadyen <pu...@gmail.com>
Authored: Tue May 1 13:56:55 2012 -0700
Committer: Jesse MacFadyen <pu...@gmail.com>
Committed: Tue May 1 13:56:55 2012 -0700
----------------------------------------------------------------------
tests/MobileSpecUnitTests/Calculator.cs | 35 -
.../MobileSpecUnitTests/MobileSpecUnitTests.csproj | 13 +-
.../Properties/WMAppManifest.xml | 1 +
.../www/accelerometer/index.html | 2 +-
tests/MobileSpecUnitTests/www/audio/index.html | 2 +-
tests/MobileSpecUnitTests/www/autotest/index.html | 3 +-
.../www/autotest/pages/accelerometer.html | 2 +-
.../www/autotest/pages/all.html | 5 +-
.../www/autotest/pages/battery.html | 2 +-
.../www/autotest/pages/camera.html | 2 +-
.../www/autotest/pages/capture.html | 2 +-
.../www/autotest/pages/compass.html | 2 +-
.../www/autotest/pages/contacts.html | 2 +-
.../www/autotest/pages/device.html | 2 +-
.../www/autotest/pages/file.html | 4 +-
.../www/autotest/pages/filetransfer.html | 69 +
.../www/autotest/pages/geolocation.html | 2 +-
.../www/autotest/pages/media.html | 2 +-
.../www/autotest/pages/network.html | 2 +-
.../www/autotest/pages/notification.html | 2 +-
.../www/autotest/pages/platform.html | 2 +-
.../www/autotest/pages/storage.html | 2 +-
.../www/autotest/tests/contacts.tests.js | 6 +
.../www/autotest/tests/file.tests.js | 33 +-
.../www/autotest/tests/filetransfer.tests.js | 72 +-
.../www/autotest/tests/platform.tests.js | 4 +-
tests/MobileSpecUnitTests/www/battery/index.html | 2 +-
tests/MobileSpecUnitTests/www/camera/index.html | 2 +-
tests/MobileSpecUnitTests/www/compass/index.html | 2 +-
tests/MobileSpecUnitTests/www/contacts/index.html | 2 +-
tests/MobileSpecUnitTests/www/cordova-1.6.1.js | 4981 ---------------
tests/MobileSpecUnitTests/www/cordova-1.7.0.js | 4810 ++++++++++++++
tests/MobileSpecUnitTests/www/cordova.js | 13 +
tests/MobileSpecUnitTests/www/cordova.wp7.js | 4815 ++++++++++++++
tests/MobileSpecUnitTests/www/events/index.html | 30 +-
tests/MobileSpecUnitTests/www/index.html | 3 +-
tests/MobileSpecUnitTests/www/location/index.html | 2 +-
tests/MobileSpecUnitTests/www/misc/index.html | 8 +-
tests/MobileSpecUnitTests/www/misc/page2.html | 6 +-
tests/MobileSpecUnitTests/www/network/index.html | 59 +
.../www/notification/index.html | 4 +-
tests/MobileSpecUnitTests/www/phonegap.js | 13 -
tests/MobileSpecUnitTests/www/sql/index.html | 2 +-
tests/MobileSpecUnitTests/www/storage/index.html | 2 +-
44 files changed, 9901 insertions(+), 5130 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-cordova-wp7/blob/e9230593/tests/MobileSpecUnitTests/Calculator.cs
----------------------------------------------------------------------
diff --git a/tests/MobileSpecUnitTests/Calculator.cs b/tests/MobileSpecUnitTests/Calculator.cs
deleted file mode 100644
index 11e3187..0000000
--- a/tests/MobileSpecUnitTests/Calculator.cs
+++ /dev/null
@@ -1,35 +0,0 @@
-/*
- * PhoneGap is available under *either* the terms of the modified BSD license *or* the
- * MIT License (2008). See http://opensource.org/licenses/alphabetical for full text.
- *
- * Copyright (c) 2005-2011, Nitobi Software Inc.
- * Copyright (c) 2011, Microsoft Corporation
- */
-
-using System.Runtime.Serialization;
-using WP7CordovaClassLib.Cordova;
-using WP7CordovaClassLib.Cordova.Commands;
-using WP7CordovaClassLib.Cordova.JSON;
-
-namespace Cordova.Extension.Commands
-{
- public class Calculator : BaseCommand
- {
-
- [DataContract]
- public class CalculateParameters
- {
- [DataMember]
- public double x { get; set; }
- [DataMember]
- public double y { get; set; }
- }
-
- public void sum(string args)
- {
- CalculateParameters calcParam = JsonHelper.Deserialize<CalculateParameters> (args);
-
- this.DispatchCommandResult(new PluginResult(PluginResult.Status.OK, calcParam.x + calcParam.y));
- }
- }
-}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-cordova-wp7/blob/e9230593/tests/MobileSpecUnitTests/MobileSpecUnitTests.csproj
----------------------------------------------------------------------
diff --git a/tests/MobileSpecUnitTests/MobileSpecUnitTests.csproj b/tests/MobileSpecUnitTests/MobileSpecUnitTests.csproj
index 6aa0a41..016b4e8 100644
--- a/tests/MobileSpecUnitTests/MobileSpecUnitTests.csproj
+++ b/tests/MobileSpecUnitTests/MobileSpecUnitTests.csproj
@@ -61,7 +61,6 @@
<Compile Include="App.xaml.cs">
<DependentUpon>App.xaml</DependentUpon>
</Compile>
- <Compile Include="Calculator.cs" />
<Compile Include="MainPage.xaml.cs">
<DependentUpon>MainPage.xaml</DependentUpon>
</Compile>
@@ -90,6 +89,7 @@
<Content Include="Background.png">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
+ <Content Include="BuildManifestProcessor.js" />
<Content Include="CordovaSourceDictionary.xml" />
<Content Include="www\accelerometer\index.html" />
<Content Include="www\audio\index.html" />
@@ -102,7 +102,9 @@
<Content Include="www\autotest\index.html" />
<Content Include="www\autotest\jasmine.css" />
<Content Include="www\autotest\jasmine.js" />
- <Content Include="www\autotest\pages\accelerometer.html" />
+ <Content Include="www\autotest\pages\accelerometer.html">
+ <SubType>Designer</SubType>
+ </Content>
<Content Include="www\autotest\pages\all.html" />
<Content Include="www\autotest\pages\battery.html" />
<Content Include="www\autotest\pages\camera.html" />
@@ -111,6 +113,7 @@
<Content Include="www\autotest\pages\contacts.html" />
<Content Include="www\autotest\pages\device.html" />
<Content Include="www\autotest\pages\file.html" />
+ <Content Include="www\autotest\pages\filetransfer.html" />
<Content Include="www\autotest\pages\geolocation.html" />
<Content Include="www\autotest\pages\media.html" />
<Content Include="www\autotest\pages\network.html" />
@@ -141,7 +144,9 @@
<Content Include="www\camera\index.html" />
<Content Include="www\compass\index.html" />
<Content Include="www\contacts\index.html" />
- <Content Include="www\cordova-1.6.1.js" />
+ <Content Include="www\cordova-1.7.0.js" />
+ <Content Include="www\cordova.js" />
+ <Content Include="www\cordova.wp7.js" />
<Content Include="www\events\index.html" />
<Content Include="www\index.html" />
<Content Include="www\location\index.html" />
@@ -149,8 +154,8 @@
<Content Include="www\master.css" />
<Content Include="www\misc\index.html" />
<Content Include="www\misc\page2.html" />
+ <Content Include="www\network\index.html" />
<Content Include="www\notification\index.html" />
- <Content Include="www\phonegap.js" />
<Content Include="www\sql\index.html" />
<Content Include="www\storage\index.html" />
<Content Include="SplashScreenImage.jpg" />
http://git-wip-us.apache.org/repos/asf/incubator-cordova-wp7/blob/e9230593/tests/MobileSpecUnitTests/Properties/WMAppManifest.xml
----------------------------------------------------------------------
diff --git a/tests/MobileSpecUnitTests/Properties/WMAppManifest.xml b/tests/MobileSpecUnitTests/Properties/WMAppManifest.xml
index 341c399..30eadfc 100644
--- a/tests/MobileSpecUnitTests/Properties/WMAppManifest.xml
+++ b/tests/MobileSpecUnitTests/Properties/WMAppManifest.xml
@@ -15,6 +15,7 @@
<Capability Name="ID_CAP_SENSORS" />
<Capability Name="ID_CAP_WEBBROWSERCOMPONENT" />
<Capability Name="ID_CAP_CONTACTS"/>
+ <Capability Name="ID_CAP_SENSORS"/>
<Capability Name="ID_CAP_ISV_CAMERA"/>
</Capabilities>
http://git-wip-us.apache.org/repos/asf/incubator-cordova-wp7/blob/e9230593/tests/MobileSpecUnitTests/www/accelerometer/index.html
----------------------------------------------------------------------
diff --git a/tests/MobileSpecUnitTests/www/accelerometer/index.html b/tests/MobileSpecUnitTests/www/accelerometer/index.html
index b5f9ae4..efa043b 100644
--- a/tests/MobileSpecUnitTests/www/accelerometer/index.html
+++ b/tests/MobileSpecUnitTests/www/accelerometer/index.html
@@ -5,7 +5,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="../phonegap.js"></script>
+ <script type="text/javascript" charset="utf-8" src="../cordova.js"></script>
<script type="text/javascript" charset="utf-8">
http://git-wip-us.apache.org/repos/asf/incubator-cordova-wp7/blob/e9230593/tests/MobileSpecUnitTests/www/audio/index.html
----------------------------------------------------------------------
diff --git a/tests/MobileSpecUnitTests/www/audio/index.html b/tests/MobileSpecUnitTests/www/audio/index.html
index ba2f8e0..93cd5bb 100644
--- a/tests/MobileSpecUnitTests/www/audio/index.html
+++ b/tests/MobileSpecUnitTests/www/audio/index.html
@@ -5,7 +5,7 @@
<meta http-equiv="Content-type" content="text/html; charset=utf-8"> <!-- ISO-8859-1 -->
<title>Cordova Audio Tests</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="../phonegap.js"></script>
+ <script type="text/javascript" charset="utf-8" src="../cordova.js"></script>
<script type="text/javascript" charset="utf-8">
http://git-wip-us.apache.org/repos/asf/incubator-cordova-wp7/blob/e9230593/tests/MobileSpecUnitTests/www/autotest/index.html
----------------------------------------------------------------------
diff --git a/tests/MobileSpecUnitTests/www/autotest/index.html b/tests/MobileSpecUnitTests/www/autotest/index.html
index 5f6401a..4507e6d 100644
--- a/tests/MobileSpecUnitTests/www/autotest/index.html
+++ b/tests/MobileSpecUnitTests/www/autotest/index.html
@@ -7,7 +7,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="../phonegap.js"></script>
+ <script type="text/javascript" src="../cordova.js"></script>
</head>
<body id="stage" class="theme">
<h1>Cordova API Specs</h1>
@@ -21,6 +21,7 @@
<a href="pages/contacts.html" class="btn large" style="width:100%;">Run Contacts Tests</a>
<a href="pages/device.html" class="btn large" style="width:100%;">Run Device Tests</a>
<a href="pages/file.html" class="btn large" style="width:100%;">Run File Tests</a>
+ <a href="pages/filetransfer.html" class="btn large" style="width:100%;">Run FileTransfer Tests</a>
<a href="pages/geolocation.html" class="btn large" style="width:100%;">Run Geolocation Tests</a>
<a href="pages/media.html" class="btn large" style="width:100%;">Run Media Tests</a>
<a href="pages/network.html" class="btn large" style="width:100%;">Run Network Tests</a>
http://git-wip-us.apache.org/repos/asf/incubator-cordova-wp7/blob/e9230593/tests/MobileSpecUnitTests/www/autotest/pages/accelerometer.html
----------------------------------------------------------------------
diff --git a/tests/MobileSpecUnitTests/www/autotest/pages/accelerometer.html b/tests/MobileSpecUnitTests/www/autotest/pages/accelerometer.html
index a3dbff8..bac1836 100644
--- a/tests/MobileSpecUnitTests/www/autotest/pages/accelerometer.html
+++ b/tests/MobileSpecUnitTests/www/autotest/pages/accelerometer.html
@@ -16,7 +16,7 @@
<script type="text/javascript" src="../html/TrivialReporter.js"></script>
<!-- Source -->
- <script type="text/javascript" src="../../phonegap.js"></script>
+ <script type="text/javascript" src="../../cordova.js"></script>
<!-- Load Test Runner -->
<script type="text/javascript" src="../test-runner.js"></script>
http://git-wip-us.apache.org/repos/asf/incubator-cordova-wp7/blob/e9230593/tests/MobileSpecUnitTests/www/autotest/pages/all.html
----------------------------------------------------------------------
diff --git a/tests/MobileSpecUnitTests/www/autotest/pages/all.html b/tests/MobileSpecUnitTests/www/autotest/pages/all.html
index cbc2b93..f5ed40a 100644
--- a/tests/MobileSpecUnitTests/www/autotest/pages/all.html
+++ b/tests/MobileSpecUnitTests/www/autotest/pages/all.html
@@ -16,7 +16,7 @@
<script type="text/javascript" src="../html/TrivialReporter.js"></script>
<!-- Source -->
- <script type="text/javascript" src="../../phonegap.js"></script>
+ <script type="text/javascript" src="../../cordova.js"></script>
<!-- Load Test Runner -->
<script type="text/javascript" src="../test-runner.js"></script>
@@ -30,6 +30,7 @@
<script type="text/javascript" src="../tests/camera.tests.js"></script>
<script type="text/javascript" src="../tests/device.tests.js"></script>
<script type="text/javascript" src="../tests/file.tests.js"></script>
+ <script type="text/javascript" src="../tests/filetransfer.tests.js"></script>
<script type="text/javascript" src="../tests/geolocation.tests.js"></script>
<script type="text/javascript" src="../tests/media.tests.js"></script>
<script type="text/javascript" src="../tests/network.tests.js"></script>
@@ -38,6 +39,8 @@
<script type="text/javascript" src="../tests/storage.tests.js"></script>
<script type="text/javascript">
+ var root, temp_root, persistent_root;
+
document.addEventListener('deviceready', function () {
// one-time retrieval of the root file system entry
var onError = function(e) {
http://git-wip-us.apache.org/repos/asf/incubator-cordova-wp7/blob/e9230593/tests/MobileSpecUnitTests/www/autotest/pages/battery.html
----------------------------------------------------------------------
diff --git a/tests/MobileSpecUnitTests/www/autotest/pages/battery.html b/tests/MobileSpecUnitTests/www/autotest/pages/battery.html
index 9bf3431..8441950 100644
--- a/tests/MobileSpecUnitTests/www/autotest/pages/battery.html
+++ b/tests/MobileSpecUnitTests/www/autotest/pages/battery.html
@@ -13,7 +13,7 @@
<script type="text/javascript" src="../html/SpecView.js"></script>
<script type="text/javascript" src="../html/SuiteView.js"></script>
<script type="text/javascript" src="../html/TrivialReporter.js"></script>
- <script type="text/javascript" src="../../phonegap.js"></script>
+ <script type="text/javascript" src="../../cordova.js"></script>
<!-- Load Test Runner -->
<script type="text/javascript" src="../test-runner.js"></script>
http://git-wip-us.apache.org/repos/asf/incubator-cordova-wp7/blob/e9230593/tests/MobileSpecUnitTests/www/autotest/pages/camera.html
----------------------------------------------------------------------
diff --git a/tests/MobileSpecUnitTests/www/autotest/pages/camera.html b/tests/MobileSpecUnitTests/www/autotest/pages/camera.html
index 8a2f2f4..e136f27 100644
--- a/tests/MobileSpecUnitTests/www/autotest/pages/camera.html
+++ b/tests/MobileSpecUnitTests/www/autotest/pages/camera.html
@@ -17,7 +17,7 @@
<script type="text/javascript" src="../html/TrivialReporter.js"></script>
<!-- Source -->
- <script type="text/javascript" src="../../phonegap.js"></script>
+ <script type="text/javascript" src="../../cordova.js"></script>
<!-- Load Test Runner -->
<script type="text/javascript" src="../test-runner.js"></script>
http://git-wip-us.apache.org/repos/asf/incubator-cordova-wp7/blob/e9230593/tests/MobileSpecUnitTests/www/autotest/pages/capture.html
----------------------------------------------------------------------
diff --git a/tests/MobileSpecUnitTests/www/autotest/pages/capture.html b/tests/MobileSpecUnitTests/www/autotest/pages/capture.html
index e65b427..0cb2baf 100644
--- a/tests/MobileSpecUnitTests/www/autotest/pages/capture.html
+++ b/tests/MobileSpecUnitTests/www/autotest/pages/capture.html
@@ -16,7 +16,7 @@
<script type="text/javascript" src="../html/TrivialReporter.js"></script>
<!-- Source -->
- <script type="text/javascript" src="../../phonegap.js"></script>
+ <script type="text/javascript" src="../../cordova.js"></script>
<!-- Load Test Runner -->
<script type="text/javascript" src="../test-runner.js"></script>
http://git-wip-us.apache.org/repos/asf/incubator-cordova-wp7/blob/e9230593/tests/MobileSpecUnitTests/www/autotest/pages/compass.html
----------------------------------------------------------------------
diff --git a/tests/MobileSpecUnitTests/www/autotest/pages/compass.html b/tests/MobileSpecUnitTests/www/autotest/pages/compass.html
index 75f119b..dfd9975 100644
--- a/tests/MobileSpecUnitTests/www/autotest/pages/compass.html
+++ b/tests/MobileSpecUnitTests/www/autotest/pages/compass.html
@@ -16,7 +16,7 @@
<script type="text/javascript" src="../html/TrivialReporter.js"></script>
<!-- Source -->
- <script type="text/javascript" src="../../phonegap.js"></script>
+ <script type="text/javascript" src="../../cordova.js"></script>
<!-- Load Test Runner -->
<script type="text/javascript" src="../test-runner.js"></script>
http://git-wip-us.apache.org/repos/asf/incubator-cordova-wp7/blob/e9230593/tests/MobileSpecUnitTests/www/autotest/pages/contacts.html
----------------------------------------------------------------------
diff --git a/tests/MobileSpecUnitTests/www/autotest/pages/contacts.html b/tests/MobileSpecUnitTests/www/autotest/pages/contacts.html
index 8be8891..2575e13 100644
--- a/tests/MobileSpecUnitTests/www/autotest/pages/contacts.html
+++ b/tests/MobileSpecUnitTests/www/autotest/pages/contacts.html
@@ -16,7 +16,7 @@
<script type="text/javascript" src="../html/TrivialReporter.js"></script>
<!-- Source -->
- <script type="text/javascript" src="../../phonegap.js"></script>
+ <script type="text/javascript" src="../../cordova.js"></script>
<!-- Load Test Runner -->
<script type="text/javascript" src="../test-runner.js"></script>
http://git-wip-us.apache.org/repos/asf/incubator-cordova-wp7/blob/e9230593/tests/MobileSpecUnitTests/www/autotest/pages/device.html
----------------------------------------------------------------------
diff --git a/tests/MobileSpecUnitTests/www/autotest/pages/device.html b/tests/MobileSpecUnitTests/www/autotest/pages/device.html
index 00b2e9f..ed25d81 100644
--- a/tests/MobileSpecUnitTests/www/autotest/pages/device.html
+++ b/tests/MobileSpecUnitTests/www/autotest/pages/device.html
@@ -16,7 +16,7 @@
<script type="text/javascript" src="../html/TrivialReporter.js"></script>
<!-- Source -->
- <script type="text/javascript" src="../../phonegap.js"></script>
+ <script type="text/javascript" src="../../cordova.js"></script>
<!-- Load Test Runner -->
<script type="text/javascript" src="../test-runner.js"></script>
http://git-wip-us.apache.org/repos/asf/incubator-cordova-wp7/blob/e9230593/tests/MobileSpecUnitTests/www/autotest/pages/file.html
----------------------------------------------------------------------
diff --git a/tests/MobileSpecUnitTests/www/autotest/pages/file.html b/tests/MobileSpecUnitTests/www/autotest/pages/file.html
index 0317e42..d9e21ca 100644
--- a/tests/MobileSpecUnitTests/www/autotest/pages/file.html
+++ b/tests/MobileSpecUnitTests/www/autotest/pages/file.html
@@ -15,7 +15,7 @@
<script type="text/javascript" src="../html/TrivialReporter.js"></script>
<!-- Source -->
- <script type="text/javascript" src="../../phonegap.js"></script>
+ <script type="text/javascript" src="../../cordova.js"></script>
<!-- Load Test Runner -->
<script type="text/javascript" src="../test-runner.js"></script>
@@ -24,6 +24,8 @@
<script type="text/javascript" src="../tests/file.tests.js"></script>
<script type="text/javascript">
+ var root, temp_root, persistent_root;
+
document.addEventListener('deviceready', function () {
// one-time retrieval of the root file system entry
var onError = function(e) {
http://git-wip-us.apache.org/repos/asf/incubator-cordova-wp7/blob/e9230593/tests/MobileSpecUnitTests/www/autotest/pages/filetransfer.html
----------------------------------------------------------------------
diff --git a/tests/MobileSpecUnitTests/www/autotest/pages/filetransfer.html b/tests/MobileSpecUnitTests/www/autotest/pages/filetransfer.html
new file mode 100644
index 0000000..0fde591
--- /dev/null
+++ b/tests/MobileSpecUnitTests/www/autotest/pages/filetransfer.html
@@ -0,0 +1,69 @@
+<!DOCTYPE html>
+<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.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">
+ 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);
+ </script>
+</head>
+
+<body>
+ <a href="javascript:" class="backBtn" onclick="backHome();">Back</a>
+</body>
+</html>
+
http://git-wip-us.apache.org/repos/asf/incubator-cordova-wp7/blob/e9230593/tests/MobileSpecUnitTests/www/autotest/pages/geolocation.html
----------------------------------------------------------------------
diff --git a/tests/MobileSpecUnitTests/www/autotest/pages/geolocation.html b/tests/MobileSpecUnitTests/www/autotest/pages/geolocation.html
index 57271c7..578c6f4 100644
--- a/tests/MobileSpecUnitTests/www/autotest/pages/geolocation.html
+++ b/tests/MobileSpecUnitTests/www/autotest/pages/geolocation.html
@@ -16,7 +16,7 @@
<script type="text/javascript" src="../html/TrivialReporter.js"></script>
<!-- Source -->
- <script type="text/javascript" src="../../phonegap.js"></script>
+ <script type="text/javascript" src="../../cordova.js"></script>
<!-- Load Test Runner -->
<script type="text/javascript" src="../test-runner.js"></script>
http://git-wip-us.apache.org/repos/asf/incubator-cordova-wp7/blob/e9230593/tests/MobileSpecUnitTests/www/autotest/pages/media.html
----------------------------------------------------------------------
diff --git a/tests/MobileSpecUnitTests/www/autotest/pages/media.html b/tests/MobileSpecUnitTests/www/autotest/pages/media.html
index 90b22b6..48d9e2d 100644
--- a/tests/MobileSpecUnitTests/www/autotest/pages/media.html
+++ b/tests/MobileSpecUnitTests/www/autotest/pages/media.html
@@ -16,7 +16,7 @@
<script type="text/javascript" src="../html/TrivialReporter.js"></script>
<!-- Source -->
- <script type="text/javascript" src="../../phonegap.js"></script>
+ <script type="text/javascript" src="../../cordova.js"></script>
<!-- Load Test Runner -->
<script type="text/javascript" src="../test-runner.js"></script>
http://git-wip-us.apache.org/repos/asf/incubator-cordova-wp7/blob/e9230593/tests/MobileSpecUnitTests/www/autotest/pages/network.html
----------------------------------------------------------------------
diff --git a/tests/MobileSpecUnitTests/www/autotest/pages/network.html b/tests/MobileSpecUnitTests/www/autotest/pages/network.html
index db1e41b..627320c 100644
--- a/tests/MobileSpecUnitTests/www/autotest/pages/network.html
+++ b/tests/MobileSpecUnitTests/www/autotest/pages/network.html
@@ -16,7 +16,7 @@
<script type="text/javascript" src="../html/TrivialReporter.js"></script>
<!-- Source -->
- <script type="text/javascript" src="../../phonegap.js"></script>
+ <script type="text/javascript" src="../../cordova.js"></script>
<!-- Load Test Runner -->
<script type="text/javascript" src="../test-runner.js"></script>
http://git-wip-us.apache.org/repos/asf/incubator-cordova-wp7/blob/e9230593/tests/MobileSpecUnitTests/www/autotest/pages/notification.html
----------------------------------------------------------------------
diff --git a/tests/MobileSpecUnitTests/www/autotest/pages/notification.html b/tests/MobileSpecUnitTests/www/autotest/pages/notification.html
index 2de9275..ef9d4a2 100644
--- a/tests/MobileSpecUnitTests/www/autotest/pages/notification.html
+++ b/tests/MobileSpecUnitTests/www/autotest/pages/notification.html
@@ -16,7 +16,7 @@
<script type="text/javascript" src="../html/TrivialReporter.js"></script>
<!-- Source -->
- <script type="text/javascript" src="../../phonegap.js"></script>
+ <script type="text/javascript" src="../../cordova.js"></script>
<!-- Load Test Runner -->
<script type="text/javascript" src="../test-runner.js"></script>
http://git-wip-us.apache.org/repos/asf/incubator-cordova-wp7/blob/e9230593/tests/MobileSpecUnitTests/www/autotest/pages/platform.html
----------------------------------------------------------------------
diff --git a/tests/MobileSpecUnitTests/www/autotest/pages/platform.html b/tests/MobileSpecUnitTests/www/autotest/pages/platform.html
index 4c5b0a5..884ba45 100644
--- a/tests/MobileSpecUnitTests/www/autotest/pages/platform.html
+++ b/tests/MobileSpecUnitTests/www/autotest/pages/platform.html
@@ -16,7 +16,7 @@
<script type="text/javascript" src="../html/TrivialReporter.js"></script>
<!-- Source -->
- <script type="text/javascript" src="../../phonegap.js"></script>
+ <script type="text/javascript" src="../../cordova.js"></script>
<!-- Load Test Runner -->
<script type="text/javascript" src="../test-runner.js"></script>
http://git-wip-us.apache.org/repos/asf/incubator-cordova-wp7/blob/e9230593/tests/MobileSpecUnitTests/www/autotest/pages/storage.html
----------------------------------------------------------------------
diff --git a/tests/MobileSpecUnitTests/www/autotest/pages/storage.html b/tests/MobileSpecUnitTests/www/autotest/pages/storage.html
index 8512dd3..eb0703b 100644
--- a/tests/MobileSpecUnitTests/www/autotest/pages/storage.html
+++ b/tests/MobileSpecUnitTests/www/autotest/pages/storage.html
@@ -16,7 +16,7 @@
<script type="text/javascript" src="../html/TrivialReporter.js"></script>
<!-- Source -->
- <script type="text/javascript" src="../../phonegap.js"></script>
+ <script type="text/javascript" src="../../cordova.js"></script>
<!-- Load Test Runner -->
<script type="text/javascript" src="../test-runner.js"></script>
http://git-wip-us.apache.org/repos/asf/incubator-cordova-wp7/blob/e9230593/tests/MobileSpecUnitTests/www/autotest/tests/contacts.tests.js
----------------------------------------------------------------------
diff --git a/tests/MobileSpecUnitTests/www/autotest/tests/contacts.tests.js b/tests/MobileSpecUnitTests/www/autotest/tests/contacts.tests.js
index 959125e..e4344bd 100644
--- a/tests/MobileSpecUnitTests/www/autotest/tests/contacts.tests.js
+++ b/tests/MobileSpecUnitTests/www/autotest/tests/contacts.tests.js
@@ -203,6 +203,12 @@ describe("Contacts (navigator.contacts)", function () {
expect(contactField.pref).toBe(true);
});
+ it("ContactField object should coerce type and value properties to strings", function() {
+ var contactField = new ContactField(12345678, 12345678, true);
+ expect(contactField.type).toBe("12345678");
+ expect(contactField.value).toBe("12345678");
+ });
+
it("should be able to define a ContactAddress object", function() {
var contactAddress = new ContactAddress(true, "home", "a","b","c","d","e","f");
expect(contactAddress).toBeDefined();
http://git-wip-us.apache.org/repos/asf/incubator-cordova-wp7/blob/e9230593/tests/MobileSpecUnitTests/www/autotest/tests/file.tests.js
----------------------------------------------------------------------
diff --git a/tests/MobileSpecUnitTests/www/autotest/tests/file.tests.js b/tests/MobileSpecUnitTests/www/autotest/tests/file.tests.js
index e46e51c..04931e6 100644
--- a/tests/MobileSpecUnitTests/www/autotest/tests/file.tests.js
+++ b/tests/MobileSpecUnitTests/www/autotest/tests/file.tests.js
@@ -1,6 +1,3 @@
-// Used by tests, set in file.html
-var root, temp_root, persistent_root;
-
describe('File API', function() {
// HELPER FUNCTIONS
@@ -50,7 +47,7 @@ describe('File API', function() {
console.log('[ERROR ' + module + '] Unexpected success callback');
});
};
-
+
describe('FileError object', function() {
it("should define FileError constants", function() {
expect(FileError.NOT_FOUND_ERR).toBe(1);
@@ -351,7 +348,7 @@ describe('File API', function() {
expect(entry.isFile).toBe(true);
expect(entry.isDirectory).toBe(false);
expect(entry.name).toBe(fileName);
- expect(entry.fullPath).toBe(filePath);
+ expect(entry.fullPath.split("//").join("/")).toBe(filePath.split("//").join("/"));
// cleanup
entry.remove(null, null);
}),
@@ -371,13 +368,13 @@ describe('File API', function() {
});
it("getFile: create new file (exclusive)", function() {
var fileName = "de.create.exclusive.file",
- filePath = root.fullPath + '/' + fileName,
+ filePath = root.fullPath + "/" + fileName,
win = jasmine.createSpy().andCallFake(function(entry) {
expect(entry).toBeDefined();
expect(entry.isFile).toBe(true);
expect(entry.isDirectory).toBe(false);
expect(entry.name).toBe(fileName);
- expect(entry.fullPath).toBe(filePath);
+ expect(entry.fullPath.split("//").join("/")).toBe(filePath.split("//").join("/"));
// cleanup
entry.remove(null, null);
@@ -418,7 +415,7 @@ describe('File API', function() {
expect(entry.isFile).toBe(true);
expect(entry.isDirectory).toBe(false);
expect(entry.name).toBe(fileName);
- expect(entry.fullPath).toBe(filePath);
+ expect(entry.fullPath.split("//").join("/")).toBe(filePath.split("//").join("/"));
// cleanup
entry.remove(null, fail);
@@ -472,7 +469,7 @@ describe('File API', function() {
expect(entry.isFile).toBe(true);
expect(entry.isDirectory).toBe(false);
expect(entry.name).toBe(fileName);
- expect(entry.fullPath).toBe(filePath);
+ expect(entry.fullPath.split("//").join("/")).toBe(filePath.split("//").join("/"));
entry.remove(null, fail); //clean up
}),
@@ -562,7 +559,7 @@ describe('File API', function() {
expect(directory.isFile).toBe(false);
expect(directory.isDirectory).toBe(true);
expect(directory.name).toBe(dirName);
- expect(directory.fullPath).toBe(dirPath);
+ expect(directory.fullPath.split("//").join("/")).toBe(dirPath.split("//").join("/"));
// cleanup
directory.remove(null, fail);
@@ -598,7 +595,7 @@ describe('File API', function() {
expect(directory.isFile).toBe(false);
expect(directory.isDirectory).toBe(true);
expect(directory.name).toBe(dirName);
- expect(directory.fullPath).toBe(dirPath);
+ expect(directory.fullPath.split("//").join("/")).toBe(dirPath.split("//").join("/"));
// cleanup
directory.remove(null, fail);
}),
@@ -620,7 +617,7 @@ describe('File API', function() {
expect(directory.isFile).toBe(false);
expect(directory.isDirectory).toBe(true);
expect(directory.name).toBe(dirName);
- expect(directory.fullPath).toBe(dirPath);
+ expect(directory.fullPath.split("//").join("/")).toBe(dirPath.split("//").join("/"));
// cleanup
directory.remove(null, fail);
@@ -648,7 +645,7 @@ describe('File API', function() {
expect(directory.isFile).toBe(false);
expect(directory.isDirectory).toBe(true);
expect(directory.name).toBe(dirName);
- expect(directory.fullPath).toBe(dirPath);
+ expect(directory.fullPath.split("//").join("/")).toBe(dirPath.split("//").join("/"));
// cleanup
directory.remove(null, fail);
@@ -687,7 +684,7 @@ describe('File API', function() {
expect(directory.isFile).toBe(false);
expect(directory.isDirectory).toBe(true);
expect(directory.name).toBe(dirName);
- expect(directory.fullPath).toBe(dirPath);
+ expect(directory.fullPath.split("//").join("/")).toBe(dirPath.split("//").join("/"));
// cleanup
directory.remove(null, fail);
@@ -755,9 +752,9 @@ describe('File API', function() {
expect(directory).toBeDefined();
expect(directory.isFile).toBe(false);
expect(directory.isDirectory).toBe(true);
- expect(directory.name).toBe(dirName);
+ expect(directory.name.split("//").join("/")).toBe(dirName.split("//").join("/"));
- expect(directory.fullPath).toBe(dirPath);
+ expect(directory.fullPath.split("//").join("/")).toBe(dirPath.split("//").join("/"));
// cleanup
directory.remove(null, fail);
@@ -931,6 +928,8 @@ describe('File API', function() {
});
});
+
+
describe('DirectoryReader interface', function() {
describe("readEntries", function() {
it("should read contents of existing directory", function() {
@@ -2998,6 +2997,7 @@ describe('File API', function() {
});
});
+
describe('FileWriter', function(){
it("should have correct methods", function() {
// retrieve a FileWriter object
@@ -3424,4 +3424,5 @@ describe('File API', function() {
});
});
});
+
});
http://git-wip-us.apache.org/repos/asf/incubator-cordova-wp7/blob/e9230593/tests/MobileSpecUnitTests/www/autotest/tests/filetransfer.tests.js
----------------------------------------------------------------------
diff --git a/tests/MobileSpecUnitTests/www/autotest/tests/filetransfer.tests.js b/tests/MobileSpecUnitTests/www/autotest/tests/filetransfer.tests.js
index 2c9f323..822e7da 100644
--- a/tests/MobileSpecUnitTests/www/autotest/tests/filetransfer.tests.js
+++ b/tests/MobileSpecUnitTests/www/autotest/tests/filetransfer.tests.js
@@ -1,37 +1,45 @@
-Tests.prototype.FileTransferTests = function () {
- module('FileTransfer');
- var fileTransfer = new FileTransfer();
- test("FileTransfer constructor should exist", function () {
- expect(1);
- ok(fileTransfer != null, "fileTransfer should not be null.");
+describe('FileTransfer', function() {
+ it("should exist and be constructable", function() {
+ var ft = new FileTransfer();
+ expect(ft).toBeDefined();
});
- test("should contain an upload function", function () {
- expect(2);
- ok(typeof fileTransfer.upload != 'undefined' && fileTransfer.upload != null, "fileTransfer.upload should not be null.");
- ok(typeof fileTransfer.upload == 'function', "fileTransfer.upload should be a function.");
+ it("should contain proper functions", function() {
+ var ft = new FileTransfer();
+ expect(typeof ft.upload).toBe('function');
+ expect(typeof ft.download).toBe('function');
});
- test("Upload a file to wrong Url", function () {
- QUnit.stop(Tests.TEST_TIMEOUT);
- expect(2);
-
- var fail = function (error) {
- ok(error !== null, "error should not be null.");
- equal(error.code, FileTransferError.INVALID_URL_ERR, "Should receive error code FileTransferError.INVALID_URL_ERR");
- QUnit.start();
- }
-
- fileTransfer.upload("somefile.txt", "WrongUri", null, fail, null);
+ describe('FileTransferError', function() {
+ it("FileTransferError constants should be defined", function() {
+ expect(FileTransferError.FILE_NOT_FOUND_ERR).toBe(1);
+ expect(FileTransferError.INVALID_URL_ERR).toBe(2);
+ expect(FileTransferError.CONNECTION_ERR).toBe(3);
+ });
});
- test("Upload a file that doesn't exist", function () {
- QUnit.stop(Tests.TEST_TIMEOUT);
- expect(2);
+ describe('download method', function() {
+ it("should be able to download a file", function() {
+ var fail = jasmine.createSpy();
+ var remoteFile = "https://ajax.googleapis.com/ajax/libs/dojo/1.7.2/dojo/dojo.js";
+ var localFileName = remoteFile.substring(remoteFile.lastIndexOf('/')+1);
+ var downloadWin = jasmine.createSpy().andCallFake(function(entry) {
+ console.log("got download callback");
+ expect(entry.name).toBe(localFileName);
+ });
+ var fileWin = function(fileEntry) {
+ var ft = new FileTransfer();
+ ft.download(remoteFile, fileEntry.fullPath, downloadWin,fail);
+ };
+
+ // root is defined in the html page containing these tests
+ runs(function() {
+ root.getFile(localFileName, {create: true, exclusive: false}, fileWin, fail);
+ });
- var fail = function (error) {
- ok(error !== null, "error should not be null.");
- equal(error.code, FileTransferError.FILE_NOT_FOUND_ERR, "Should receive error code FileTransferError.FILE_NOT_FOUND_ERR");
- QUnit.start();
- }
- fileTransfer.upload("somefile.txt", "http://google.com", null, fail, null);
- });
+ waitsFor(function() { return downloadWin.wasCalled; }, "downloadWin", Tests.TEST_TIMEOUT);
-};
\ No newline at end of file
+ runs(function() {
+ expect(downloadWin).toHaveBeenCalled();
+ expect(fail).not.toHaveBeenCalled();
+ });
+ });
+ });
+});
http://git-wip-us.apache.org/repos/asf/incubator-cordova-wp7/blob/e9230593/tests/MobileSpecUnitTests/www/autotest/tests/platform.tests.js
----------------------------------------------------------------------
diff --git a/tests/MobileSpecUnitTests/www/autotest/tests/platform.tests.js b/tests/MobileSpecUnitTests/www/autotest/tests/platform.tests.js
index 6b1a0ed..cf05356 100644
--- a/tests/MobileSpecUnitTests/www/autotest/tests/platform.tests.js
+++ b/tests/MobileSpecUnitTests/www/autotest/tests/platform.tests.js
@@ -3,8 +3,8 @@ describe('Platform (cordova)', function () {
expect(cordova).toBeDefined();
});
describe('Platform (Cordova)', function () {
- it("should not exist", function() {
- expect(window.Cordova).not.toBeDefined();
+ it("should exist", function() {
+ expect(window.Cordova).toBeDefined();
});
});
describe('Platform (PhoneGap)', function () {
http://git-wip-us.apache.org/repos/asf/incubator-cordova-wp7/blob/e9230593/tests/MobileSpecUnitTests/www/battery/index.html
----------------------------------------------------------------------
diff --git a/tests/MobileSpecUnitTests/www/battery/index.html b/tests/MobileSpecUnitTests/www/battery/index.html
index 593104a..394988c 100644
--- a/tests/MobileSpecUnitTests/www/battery/index.html
+++ b/tests/MobileSpecUnitTests/www/battery/index.html
@@ -5,7 +5,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="../phonegap.js"></script>
+ <script type="text/javascript" charset="utf-8" src="../cordova.js"></script>
<script type="text/javascript" charset="utf-8">
http://git-wip-us.apache.org/repos/asf/incubator-cordova-wp7/blob/e9230593/tests/MobileSpecUnitTests/www/camera/index.html
----------------------------------------------------------------------
diff --git a/tests/MobileSpecUnitTests/www/camera/index.html b/tests/MobileSpecUnitTests/www/camera/index.html
index 2e27da5..bc3b554 100644
--- a/tests/MobileSpecUnitTests/www/camera/index.html
+++ b/tests/MobileSpecUnitTests/www/camera/index.html
@@ -5,7 +5,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="../phonegap.js"></script>
+ <script type="text/javascript" charset="utf-8" src="../cordova.js"></script>
<script type="text/javascript" charset="utf-8">
http://git-wip-us.apache.org/repos/asf/incubator-cordova-wp7/blob/e9230593/tests/MobileSpecUnitTests/www/compass/index.html
----------------------------------------------------------------------
diff --git a/tests/MobileSpecUnitTests/www/compass/index.html b/tests/MobileSpecUnitTests/www/compass/index.html
index 3bc4d9b..8dbf99a 100644
--- a/tests/MobileSpecUnitTests/www/compass/index.html
+++ b/tests/MobileSpecUnitTests/www/compass/index.html
@@ -5,7 +5,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="../phonegap.js"></script>
+ <script type="text/javascript" charset="utf-8" src="../cordova.js"></script>
<script type="text/javascript" charset="utf-8">
http://git-wip-us.apache.org/repos/asf/incubator-cordova-wp7/blob/e9230593/tests/MobileSpecUnitTests/www/contacts/index.html
----------------------------------------------------------------------
diff --git a/tests/MobileSpecUnitTests/www/contacts/index.html b/tests/MobileSpecUnitTests/www/contacts/index.html
index c646db1..950e1cc 100644
--- a/tests/MobileSpecUnitTests/www/contacts/index.html
+++ b/tests/MobileSpecUnitTests/www/contacts/index.html
@@ -5,7 +5,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="../phonegap.js"></script>
+ <script type="text/javascript" charset="utf-8" src="../cordova.js"></script>
<script type="text/javascript" charset="utf-8">