Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code

Side by Side Diff: chrome/content/index.html

Issue 10964120: Made Synchronizer tests work again (Closed)
Patch Set: Created July 12, 2013, 1:43 p.m.
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View unified diff | Download patch
« no previous file with comments | « chrome/content/common.js ('k') | chrome/content/tests/synchronizer.js » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 <!DOCTYPE html> 1 <!DOCTYPE html>
2 <html> 2 <html>
3 <head> 3 <head>
4 <link rel="stylesheet" href="qunit.css"/> 4 <link rel="stylesheet" href="qunit.css"/>
5 <script src="jquery-1.7.1.min.js"></script> 5 <script src="jquery-1.7.1.min.js"></script>
6 <script src="qunit.js"></script> 6 <script src="qunit.js"></script>
7 <script src="common.js" type="text/javascript;version=1.7"></script> 7 <script src="common.js" type="text/javascript;version=1.7"></script>
8 <script src="httpd.js" type="text/javascript;version=1.7"></script> 8 <script src="httpd.js" type="text/javascript;version=1.7"></script>
9 <script type="text/javascript;version=1.7"> 9 <script type="text/javascript;version=1.7">
10 Cu.import("resource://gre/modules/Services.jsm"); 10 Cu.import("resource://gre/modules/Services.jsm");
11 11
12 function getTestFiles() 12 function getTestFiles()
13 { 13 {
14 let module = {}; 14 let module = {};
15 module.wrappedJSObject = module; 15 module.wrappedJSObject = module;
16 Services.obs.notifyObservers(module, "adblockplustests-require", "info") ; 16 Services.obs.notifyObservers(module, "adblockplustests-require", "info") ;
17 17
18 let {addonRoot} = module.exports; 18 let {addonRoot} = module.exports;
19 let uri = Services.io.newURI(addonRoot, null, null).QueryInterface(Compo nents.interfaces.nsIJARURI); 19 let uri = Services.io.newURI(addonRoot, null, null).QueryInterface(Compo nents.interfaces.nsIJARURI);
20 20
21 let zipReader = Cc["@mozilla.org/libjar/zip-reader;1"].createInstance(Ci .nsIZipReader); 21 let result = [];
22 zipReader.open(uri.JARFile.QueryInterface(Ci.nsIFileURL).file); 22 if ("test" in QUnit.urlParams)
23 result.push("tests/" + QUnit.urlParams.test + ".js");
24 else
25 {
26 let zipReader = Cc["@mozilla.org/libjar/zip-reader;1"].createInstance( Ci.nsIZipReader);
27 zipReader.open(uri.JARFile.QueryInterface(Ci.nsIFileURL).file);
23 28
24 let result = []; 29 let enumerator = zipReader.findEntries(null);
25 let enumerator = zipReader.findEntries(null); 30 let prefix = "chrome/content/tests/";
26 let prefix = "chrome/content/tests/"; 31 while (enumerator.hasMore())
27 while (enumerator.hasMore()) 32 {
28 { 33 let name = enumerator.getNext();
29 let name = enumerator.getNext(); 34 if (name.indexOf(prefix) == 0 && /\.js$/.test(name))
30 if (name.indexOf(prefix) == 0 && /\.js$/.test(name)) 35 result.push("tests/" + name.replace(prefix, ""));
31 result.push("tests/" + name.replace(prefix, "")); 36 }
37
38 zipReader.close();
32 } 39 }
33 40
34 zipReader.close();
35
36 result.sort(); 41 result.sort();
37 return result; 42 return result;
38 } 43 }
39 44
40 let files = getTestFiles(); 45 let files = getTestFiles();
41 for each (let file in files) 46 for each (let file in files)
42 { 47 {
43 let script = document.createElement("script"); 48 let script = document.createElement("script");
44 script.setAttribute("src", file); 49 script.setAttribute("src", file);
45 script.setAttribute("type", "text/javascript;version=1.7"); 50 script.setAttribute("type", "text/javascript;version=1.7");
46 document.documentElement.appendChild(script); 51 document.documentElement.appendChild(script);
47 } 52 }
48 </script> 53 </script>
49 </head> 54 </head>
50 <body> 55 <body>
51 <h1 id="qunit-header">Adblock Plus unit tests</h1> 56 <h1 id="qunit-header">Adblock Plus unit tests</h1>
52 <h2 id="qunit-banner"></h2> 57 <h2 id="qunit-banner"></h2>
53 <div id="qunit-testrunner-toolbar"></div> 58 <div id="qunit-testrunner-toolbar"></div>
54 <h2 id="qunit-userAgent"></h2> 59 <h2 id="qunit-userAgent"></h2>
55 <ol id="qunit-tests"></ol> 60 <ol id="qunit-tests"></ol>
56 </body> 61 </body>
57 </html> 62 </html>
OLDNEW
« no previous file with comments | « chrome/content/common.js ('k') | chrome/content/tests/synchronizer.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld