gabrielg-xultestrunner 0.1.2 → 0.2.2
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitmodules +3 -0
- data/README +5 -0
- data/VERSION +1 -1
- data/xulapp/application.ini +2 -2
- data/xulapp/chrome/content/lib/xultestcase.js +2 -2
- data/xulapp/chrome/content/lib/xultestrunner.js +1 -1
- data/xulapp/chrome/content/vendor/scriptaculous/testharness.html +9 -4
- data/xulapp/chrome/content/xul/boot.xul +1 -1
- data/xulapp/components/bootstrap.js +21 -6
- data/xultestrunner.gemspec +3 -3
- metadata +4 -5
- data/xulapp/chrome/content/lib/shortcuts.js +0 -24
data/.gitmodules
ADDED
data/README
CHANGED
@@ -5,6 +5,11 @@ This is a XUL based test runner for running the quasi-scriptaculous-unittest.js-
|
|
5
5
|
|
6
6
|
Yes, it is a XUL app in a RubyGem, yes I am in touch with this.
|
7
7
|
|
8
|
+
NOTE
|
9
|
+
====
|
10
|
+
|
11
|
+
This project uses git submodules. Remember to 'git submodule init' and 'git submodule update'.
|
12
|
+
|
8
13
|
TODO
|
9
14
|
====
|
10
15
|
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.
|
1
|
+
0.2.2
|
data/xulapp/application.ini
CHANGED
@@ -37,8 +37,8 @@ Object.extend(XULTestCase, {
|
|
37
37
|
}
|
38
38
|
},
|
39
39
|
|
40
|
-
_handleTestLoadError: function(e) {
|
41
|
-
puts("There was a problem loading the test case from '" + fileURI + "'");
|
40
|
+
_handleTestLoadError: function(fileURI, e) {
|
41
|
+
puts("There was a problem loading the test case from '" + fileURI + "': " + e);
|
42
42
|
}
|
43
43
|
|
44
44
|
});
|
@@ -44,7 +44,7 @@ var XULTestRunner = Class.create({
|
|
44
44
|
},
|
45
45
|
|
46
46
|
_runTest: function(testFile) {
|
47
|
-
var qs = Object.toQueryString({testFile:
|
47
|
+
var qs = Object.toQueryString({testFile: encodeURI(testFile.path)});
|
48
48
|
var harnessWithPath = this.options.harnessURI + "?" + qs;
|
49
49
|
this.options.browser.loadURI(harnessWithPath);
|
50
50
|
},
|
@@ -2,20 +2,25 @@
|
|
2
2
|
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
|
3
3
|
<head>
|
4
4
|
<title>Unit Test Harness</title>
|
5
|
+
<script type="text/javascript" src="resource://xpcomcore/loader.js"></script>
|
5
6
|
<script type="text/javascript" src="resource://xultestrunner/vendor/prototype/prototype.js"></script>
|
6
7
|
<script type="text/javascript" src="resource://xultestrunner/vendor/scriptaculous/unittest.js"></script>
|
7
8
|
<link rel="stylesheet" href="resource://xultestrunner/vendor/scriptaculous/test.css" type="text/css" />
|
8
9
|
<script type="text/javascript">
|
9
10
|
$(document).observe('dom:loaded', function(){
|
10
|
-
|
11
11
|
// FIXME - Because we're in crazy HTML/resource URL land we need to grant ourselves some magical privileges
|
12
12
|
// since I clearly don't "get" XULRunner security
|
13
13
|
var privileges = 'UniversalXPConnect UniversalBrowserRead UniversalBrowserWrite ' +
|
14
14
|
'UniversalPreferencesRead UniversalPreferencesWrite CapabilityPreferencesAccess UniversalFileRead';
|
15
15
|
netscape.security.PrivilegeManager.enablePrivilege(privileges);
|
16
|
-
|
17
|
-
|
18
|
-
|
16
|
+
|
17
|
+
// FIXME - add stuff to xpcomcore for doing this jacked up crap
|
18
|
+
var ioService = Cc["@mozilla.org/network/io-service;1"].getService(Ci.nsIIOService);
|
19
|
+
var resProt = ioService.getProtocolHandler("resource").QueryInterface(Ci.nsIResProtocolHandler);
|
20
|
+
var libPath = ioService.newURI(resProt.resolveURI(ioService.newURI("resource://xultestrunner/lib", null, null)), null, null).QueryInterface(Components.interfaces.nsIURL).path;
|
21
|
+
|
22
|
+
$LOAD_PATH.push(libPath);
|
23
|
+
require("xultestcase");
|
19
24
|
|
20
25
|
var qp = window.location.search.toQueryParams();
|
21
26
|
var testCase = XULTestCase.loadFromFile(qp.testFile);
|
@@ -2,7 +2,7 @@
|
|
2
2
|
<?xml-stylesheet href="chrome://global/skin/" type="text/css"?>
|
3
3
|
|
4
4
|
<window id="main" title="XULTestRunner Console" width="800" height="600" xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
|
5
|
-
<script type="text/javascript" src="resource://
|
5
|
+
<script type="text/javascript" src="resource://xpcomcore/loader.js" />
|
6
6
|
<script type="text/javascript" src="resource://xultestrunner/vendor/prototype/prototype.js" />
|
7
7
|
<script type="text/javascript" src="resource://xultestrunner/lib/xultestrunner.js" />
|
8
8
|
<script type="text/javascript">
|
@@ -1,10 +1,24 @@
|
|
1
1
|
(function(outerScope){
|
2
|
+
COMPONENTS = [];
|
3
|
+
|
2
4
|
var loader = Components.classes["@mozilla.org/moz/jssubscript-loader;1"].getService(Components.interfaces.mozIJSSubScriptLoader);
|
3
|
-
|
4
|
-
//
|
5
|
-
|
5
|
+
|
6
|
+
// So XPCOMCore can use XULTest to test itself.
|
7
|
+
var env = Components.classes["@mozilla.org/process/environment;1"].getService(Components.interfaces.nsIEnvironment);
|
8
|
+
var alternateXPCOMCoreLocation = env.get('XPCOMCORE');
|
9
|
+
if (alternateXPCOMCoreLocation) {
|
10
|
+
// FIXME - this will break if the full path isnt specified in the XPCOMCORE environment var
|
11
|
+
loader.loadSubScript("file://" + encodeURI(alternateXPCOMCoreLocation));
|
12
|
+
} else {
|
13
|
+
// We use the /app resource here because of yet another weird firefox issue where the /xultestrunner resource
|
14
|
+
// isn't working as the XPCOM component gets registered.
|
15
|
+
loader.loadSubScript("resource://app/chrome/content/vendor/xpcomcore/bootstrap.js");
|
16
|
+
}
|
17
|
+
loader.loadSubScript("resource://xpcomcore/loader.js");
|
18
|
+
|
19
|
+
// Meat and potatoes begins here.
|
6
20
|
Cu.import("resource://gre/modules/XPCOMUtils.jsm");
|
7
|
-
|
21
|
+
|
8
22
|
// Singleton time
|
9
23
|
var xtrCommandLineHandlerInstance = null;
|
10
24
|
var xtrCommandLineHandler = function() {
|
@@ -85,8 +99,9 @@
|
|
85
99
|
|
86
100
|
};
|
87
101
|
|
102
|
+
COMPONENTS.push(xtrCommandLineHandler);
|
88
103
|
outerScope.NSGetModule = function(compMgr, fileSpec) {
|
89
|
-
return XPCOMUtils.generateModule(
|
104
|
+
return XPCOMUtils.generateModule(COMPONENTS);
|
90
105
|
};
|
91
|
-
|
106
|
+
|
92
107
|
})(this);
|
data/xultestrunner.gemspec
CHANGED
@@ -5,11 +5,11 @@
|
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
7
|
s.name = %q{xultestrunner}
|
8
|
-
s.version = "0.
|
8
|
+
s.version = "0.2.2"
|
9
9
|
|
10
10
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
11
|
s.authors = ["Gabriel Gironda"]
|
12
|
-
s.date = %q{2009-09-
|
12
|
+
s.date = %q{2009-09-08}
|
13
13
|
s.default_executable = %q{xultest}
|
14
14
|
s.description = %q{XUL based test runner for running your JS unit tests.}
|
15
15
|
s.email = %q{contact@gironda.org}
|
@@ -20,6 +20,7 @@ Gem::Specification.new do |s|
|
|
20
20
|
]
|
21
21
|
s.files = [
|
22
22
|
".gitignore",
|
23
|
+
".gitmodules",
|
23
24
|
"LICENSE",
|
24
25
|
"README",
|
25
26
|
"Rakefile",
|
@@ -28,7 +29,6 @@ Gem::Specification.new do |s|
|
|
28
29
|
"lib/xultestrunner.rb",
|
29
30
|
"xulapp/application.ini",
|
30
31
|
"xulapp/chrome/chrome.manifest",
|
31
|
-
"xulapp/chrome/content/lib/shortcuts.js",
|
32
32
|
"xulapp/chrome/content/lib/xultestcase.js",
|
33
33
|
"xulapp/chrome/content/lib/xultestrunner.js",
|
34
34
|
"xulapp/chrome/content/vendor/prototype/LICENSE",
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: gabrielg-xultestrunner
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.2.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Gabriel Gironda
|
@@ -9,7 +9,7 @@ autorequire:
|
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
11
|
|
12
|
-
date: 2009-09-
|
12
|
+
date: 2009-09-08 00:00:00 -07:00
|
13
13
|
default_executable: xultest
|
14
14
|
dependencies: []
|
15
15
|
|
@@ -24,6 +24,7 @@ extra_rdoc_files:
|
|
24
24
|
- README
|
25
25
|
files:
|
26
26
|
- .gitignore
|
27
|
+
- .gitmodules
|
27
28
|
- LICENSE
|
28
29
|
- README
|
29
30
|
- Rakefile
|
@@ -32,7 +33,6 @@ files:
|
|
32
33
|
- lib/xultestrunner.rb
|
33
34
|
- xulapp/application.ini
|
34
35
|
- xulapp/chrome/chrome.manifest
|
35
|
-
- xulapp/chrome/content/lib/shortcuts.js
|
36
36
|
- xulapp/chrome/content/lib/xultestcase.js
|
37
37
|
- xulapp/chrome/content/lib/xultestrunner.js
|
38
38
|
- xulapp/chrome/content/vendor/prototype/LICENSE
|
@@ -47,7 +47,6 @@ files:
|
|
47
47
|
- xultestrunner.gemspec
|
48
48
|
has_rdoc: false
|
49
49
|
homepage: http://github.com/gabrielg/xultestrunner
|
50
|
-
licenses:
|
51
50
|
post_install_message:
|
52
51
|
rdoc_options:
|
53
52
|
- --charset=UTF-8
|
@@ -68,7 +67,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
68
67
|
requirements: []
|
69
68
|
|
70
69
|
rubyforge_project:
|
71
|
-
rubygems_version: 1.
|
70
|
+
rubygems_version: 1.2.0
|
72
71
|
signing_key:
|
73
72
|
specification_version: 3
|
74
73
|
summary: XUL based test runner for running your JS unit tests.
|
@@ -1,24 +0,0 @@
|
|
1
|
-
Cc = Components.classes;
|
2
|
-
Ci = Components.interfaces;
|
3
|
-
Cr = Components.results;
|
4
|
-
Cu = Components.utils;
|
5
|
-
loader = Cc["@mozilla.org/moz/jssubscript-loader;1"].getService(Ci.mozIJSSubScriptLoader);
|
6
|
-
load = function(fileURI, moduleScope) {
|
7
|
-
try {
|
8
|
-
loader.loadSubScript(fileURI, moduleScope);
|
9
|
-
} catch (e) {
|
10
|
-
throw({name: "LoadError", message: "Failed to load " + fileURI + ": " + e.message});
|
11
|
-
}
|
12
|
-
};
|
13
|
-
|
14
|
-
print = dump;
|
15
|
-
puts = function(str) { print(str + "\n"); };
|
16
|
-
|
17
|
-
// Much love to http://ejohn.org/blog/__file__-in-javascript/
|
18
|
-
this.__defineGetter__("__FILE__", function() {
|
19
|
-
var stack = (new Error).stack;
|
20
|
-
// FIXME - Great. All this is a dance around the fact line #289 of mozJSSubScriptLoader.cpp in mozilla 1.9.1
|
21
|
-
// thinks that the best way to delimit script files is with a fucking ASCII arrow YOU FUCKS
|
22
|
-
var fileURI = stack.split("\n")[2].split("@")[1].split(" -> ").slice(-1)[0].split(/:[0-9]/)[0];
|
23
|
-
return fileURI;
|
24
|
-
});
|