I could have the text of the two xml files literally in the test suite
and modify the index-webjump to parse that text.  Is that what you
mean?  Maybe that's the best solution, but it will mean a little less
of the code is exercised by the test.

You suggested chrome://conkeror-contrib elsewhere.  How about also
having a chrome://conkeror-test something like the following.  Then I
don't need conkeror_source_code_path.  (I'd chop this into 2 or 3
commits to push.)


Subject: [PATCH] Make chrome URLs for contrib and tests. Use in index-webjump test.

---
 chrome/chrome.manifest        |    3 +++
 modules/utils.js              |    5 +++++
 tests/simple/index-webjump.js |   11 ++---------
 3 files changed, 10 insertions(+), 9 deletions(-)

diff --git a/chrome/chrome.manifest b/chrome/chrome.manifest
index 2b49211..db7a844 100644
--- a/chrome/chrome.manifest
+++ b/chrome/chrome.manifest
@@ -6,6 +6,9 @@ locale   conkeror-gui   en-US    file:../locale/en-US/

 content  conkeror-help           file:../help/

+content  conkeror-contrib        file:../contrib/modules/
+content  conkeror-test           file:../tests/
+
 locale   branding       en-US    file:../branding/

override chrome://global/locale/netErrorApp.dtd chrome://conkeror-gui/locale/netError.dtd
diff --git a/modules/utils.js b/modules/utils.js
index e2dd6d3..3d724f3 100644
--- a/modules/utils.js
+++ b/modules/utils.js
@@ -144,6 +144,11 @@ function make_uri (uri, charset, base_uri) {
     return io_service.newURI(uri, charset, base_uri);
 }

+function make_file_from_chrome (url) {
+    var crs = Cc['@mozilla.org/chrome/chrome-registry;1']
+        .getService(Ci.nsIChromeRegistry);
+    return crs.convertChromeURL(make_uri(url));
+}

 function get_document_content_disposition (document_o) {
     var content_disposition = null;
diff --git a/tests/simple/index-webjump.js b/tests/simple/index-webjump.js
index 8df10fe..aff8a76 100644
--- a/tests/simple/index-webjump.js
+++ b/tests/simple/index-webjump.js
@@ -12,7 +12,7 @@ require('index-webjump.js');
           conkeror.webjumps = this.real_webjumps;
           conkeror.index_webjumps = this.real_index_webjumps;
       },
-      path: conkeror_source_code_path + "/tests/simple",
+ path: make_file_from_chrome("chrome://conkeror-test/content/simple").path,
       test_xpath_webjump: function () {
           define_xpath_webjump(
               "xpath", "http://dummy/xpath";, '//xhtml:a...@class="index"]',
@@ -41,12 +41,5 @@ require('index-webjump.js');
           assert_equals(w.completions[1][0], "foo");
       },
   };
-  if (conkeror_source_code_path)
-      walnut_run(suite);
-  else
-      dumpln('Suite setup failed; conkeror_source_code_path not set.' +
-             '  Try:\n' +
-             '  conkeror -q -batch' +
-             ' -e "conkeror_source_code_path=\\"$PWD\\";"' +
-             ' -l tests/simple/index-webjump.js');
+  walnut_run(suite);
 }
--
1.6.5
_______________________________________________
Conkeror mailing list
[email protected]
https://www.mozdev.org/mailman/listinfo/conkeror

Reply via email to