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 ADDED
@@ -0,0 +1,3 @@
1
+ [submodule "xulapp/chrome/content/vendor/xpcomcore"]
2
+ path = xulapp/chrome/content/vendor/xpcomcore
3
+ url = git://github.com/gabrielg/xpcomcore.git
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.2
1
+ 0.2.2
@@ -1,7 +1,7 @@
1
1
  [App]
2
2
  Name=XULTestRunner
3
- Version=0.1.2
4
- BuildID=f01e29f6-709e-4522-b77e-c3b2f22566ff
3
+ Version=0.2.2
4
+ BuildID=859ab1e7-bc8e-42bf-83d0-d84abcba0d48
5
5
  ID=XULTestRunner@conflagrationjs.org
6
6
  Vendor=Conflagration JS
7
7
 
@@ -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: "file://" + encodeURI(testFile.path)});
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
- var loader = Components.classes["@mozilla.org/moz/jssubscript-loader;1"].getService(Components.interfaces.mozIJSSubScriptLoader);
17
- loader.loadSubScript("resource://xultestrunner/lib/shortcuts.js");
18
- loader.loadSubScript("resource://xultestrunner/lib/xultestcase.js");
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://xultestrunner/lib/shortcuts.js" />
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
- // We use the /app resource here because of yet another weird firefox issue where the /xultestrunner resource
4
- // isn't working as the XPCOM component gets registered.
5
- loader.loadSubScript("resource://app/chrome/content/lib/shortcuts.js");
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([xtrCommandLineHandler]);
104
+ return XPCOMUtils.generateModule(COMPONENTS);
90
105
  };
91
-
106
+
92
107
  })(this);
@@ -5,11 +5,11 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{xultestrunner}
8
- s.version = "0.1.2"
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-07}
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.1.2
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-07 00:00:00 -07:00
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.3.5
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
- });