Skip to content

Commit

Permalink
Fixed code formatting
Browse files Browse the repository at this point in the history
  • Loading branch information
SebastianZ committed Feb 28, 2014
1 parent 61b04d5 commit f955daf
Show file tree
Hide file tree
Showing 17 changed files with 82 additions and 50 deletions.
3 changes: 2 additions & 1 deletion tests/content/bti/browser/getContext.js
Expand Up @@ -14,7 +14,8 @@ function runTest()
{
var contexts = browser.getBrowserContexts();
FBTest.ok(contexts.length > 0, "Should be at least one context");
for ( var i = 0; i < contexts.length; i++) {
for ( var i = 0; i < contexts.length; i++)
{
var context = contexts[i];
var candidate = browser.getContext(context.getId());
FBTest.ok(candidate == context, "Contexts should be identical");
Expand Down
5 changes: 2 additions & 3 deletions tests/content/bti/browser/getContexts.js
Expand Up @@ -17,11 +17,10 @@ function runTest()
var nextContexts = browser.getBrowserContexts();
FBTest.ok(nextContexts.length == (contexts.length + 1), "Should be a new browser context");
var context = nextContexts[nextContexts.length - 1];
if (context) {
if (context)
FBTest.compare(context.getURL(), url, "The URL should be " + url);
} else {
else
FBTest.ok(context, "missing new browser context");
}
FBTest.testDone("done test #getContexts()");
});
}
10 changes: 7 additions & 3 deletions tests/content/bti/browser/getFocusContext.js
Expand Up @@ -17,11 +17,15 @@ function runTest()
var nextContexts = browser.getBrowserContexts();
FBTest.ok(nextContexts.length == (contexts.length + 1), "Should be a new browser context");
var context = nextContexts[nextContexts.length - 1];
if (context) {
if (context)
{
FBTest.compare(context.getURL(), url, "The URL should be " + url);
var focus = browser.getFocusBrowserContext();
FBTest.compare(focus.getId(), context.getId(), "The focus context id should be " + context.getId());
} else {
FBTest.compare(focus.getId(), context.getId(), "The focus context id should be " +
context.getId());
}
else
{
FBTest.ok(context, "missing new browser context");
}
FBTest.testDone("done test #getFocusContext()");
Expand Down
7 changes: 5 additions & 2 deletions tests/content/bti/browser/isConnected.js
Expand Up @@ -8,10 +8,13 @@
function runTest()
{
var browser = new FW.Firebug.BTI.Browser(); // TODO
if (browser.isConnected()) {
if (browser.isConnected())
{
browser.disconnect();
FBTest.ok(!browser.isConnected(), "browser should be disconnected");
} else {
}
else
{
FBTest.ok(false, "browser should be connected");
}
FBTest.testDone("done test #getContexts()");
Expand Down
5 changes: 3 additions & 2 deletions tests/content/bti/browser/onContextCreated.js
Expand Up @@ -9,8 +9,9 @@ function runTest()
{
var browser = new FW.Firebug.BTI.Browser(); // TODO
var url = FBTest.getHTTPURLBase()+"bti/browser/testGetContexts.html";
browser.addEventListener("onContextCreated", function(context){
FBTest.compare(context.getURL(), url, "URL of newly created context should be " +url);
browser.addEventListener("onContextCreated", function(context)
{
FBTest.compare(context.getURL(), url, "URL of newly created context should be " + url);
FBTest.testDone("done test #onContextCreated()");
});
FBTest.progress("onContextCreated, open test page "+url);
Expand Down
5 changes: 3 additions & 2 deletions tests/content/bti/browser/onContextLoaded.js
Expand Up @@ -9,8 +9,9 @@ function runTest()
{
var browser = new FW.Firebug.BTI.Browser(); // TODO
var url = FBTest.getHTTPURLBase()+"bti/browser/testGetContexts.html";
browser.addEventListener("onContextLoaded", function(context){
FBTest.compare(context.getURL(), url, "URL of newly loaded context should be " +url);
browser.addEventListener("onContextLoaded", function(context)
{
FBTest.compare(context.getURL(), url, "URL of newly loaded context should be " + url);
FBTest.testDone("done test #onContextLoaded()");
});
FBTest.progress("onContextLoaded, open test page "+url);
Expand Down
3 changes: 2 additions & 1 deletion tests/content/bti/browser/onDisconnect.js
Expand Up @@ -8,7 +8,8 @@
function runTest()
{
var browser = new FW.Firebug.BTI.Browser(); // TODO
browser.addEventListener("onDisconnect", function(aBrowser){
browser.addEventListener("onDisconnect", function(aBrowser)
{
FBTest.ok(browser == aBrowser, "Disconnect call back is for wrong browser");
FBTest.testDone("done test #onDisconnect()");
});
Expand Down
5 changes: 3 additions & 2 deletions tests/content/bti/browser/onScriptEmbedded.js
Expand Up @@ -11,8 +11,9 @@ function runTest()
{
var browser = new FW.Firebug.BTI.Browser(); // TODO
var url = FBTest.getHTTPURLBase()+"bti/browser/testGetContexts.html";
browser.addEventListener("onScript", function(compilationUnit){
FBTest.compare(compilationUnit.getURL(), url, "URL of newly loaded script should be " +url);
browser.addEventListener("onScript", function(compilationUnit)
{
FBTest.compare(compilationUnit.getURL(), url, "URL of newly loaded script should be " + url);
FBTest.testDone("done test #onScriptEmbedded()");
});
FBTest.progress("onScriptEmbedded, open test page "+url);
Expand Down
6 changes: 4 additions & 2 deletions tests/content/bti/browser/onScriptExternal.js
Expand Up @@ -12,8 +12,10 @@ function runTest()
var browser = new FW.Firebug.BTI.Browser(); // TODO
var url = FBTest.getHTTPURLBase()+"bti/browser/testExternalScript.html";
var scriptUrl = FBTest.getHTTPURLBase()+"bti/browser/simpleExternal.js";
browser.addEventListener("onScript", function(compilationUnit){
FBTest.compare(compilationUnit.getURL(), scriptUrl, "URL of newly loaded script should be " +scriptUrl);
browser.addEventListener("onScript", function(compilationUnit)
{
FBTest.compare(compilationUnit.getURL(), scriptUrl,
"URL of newly loaded script should be " + scriptUrl);
FBTest.testDone("done test #onScriptExternal()");
});
FBTest.progress("onScriptExternal, open test page "+url);
Expand Down
3 changes: 2 additions & 1 deletion tests/content/bti/browsercontext/exists.js
Expand Up @@ -10,7 +10,8 @@ function runTest()
{
var browser = new FW.Firebug.BTI.Browser(); // TODO
var url = FBTest.getHTTPURLBase()+"bti/browsercontext/testScripts.html";
browser.addEventListener("onContextCreated", function(context) {
browser.addEventListener("onContextCreated", function(context)
{
FBTest.compare(context.getURL(), url, "URL of newly created context should be " +url);
FBTest.ok(context.exists(), "Context should exist when created");
browser.disconnect();
Expand Down
3 changes: 2 additions & 1 deletion tests/content/bti/browsercontext/getBrowser.js
Expand Up @@ -9,7 +9,8 @@ function runTest()
{
var browser = new FW.Firebug.BTI.Browser(); // TODO
var url = FBTest.getHTTPURLBase()+"bti/browsercontext/testScripts.html";
browser.addEventListener("onContextCreated", function(context) {
browser.addEventListener("onContextCreated", function(context)
{
FBTest.compare(context.getURL(), url, "URL of newly created context should be " +url);
FBTest.ok(context.getBrowser() == browser, "Context should refer to its browser");
FBTest.testDone("done test #getBrowser()");
Expand Down
12 changes: 8 additions & 4 deletions tests/content/bti/browsercontext/getCompilationUnits.js
Expand Up @@ -10,22 +10,26 @@ function runTest()
{
var browser = new FW.Firebug.BTI.Browser(); // TODO
var url = FBTest.getHTTPURLBase()+"bti/browsercontext/testScripts.html";
browser.addEventListener("onContextCreated", function(context) {
browser.addEventListener("onContextCreated", function(context)
{
FBTest.progress("getCompilationUnits, context created");
FBTest.compare(context.getURL(), url, "URL of newly created context should be " +url);
FBTest.progress("getCompilationUnits, retrieving compilation units");
context.getCompilationUnits(function(units){
context.getCompilationUnits(function(units)
{
FBTest.progress("getCompilationUnits, compilation units retrieved");
FBTest.compare(2, units.length, "Should be two compilation units");
var unit = context.getCompilationUnit(url);
FBTest.ok(unit, "compilation unit does not exist: " + url);
FBTest.compare(url, unit.getURL(), "compilation unit URL is not consistent");
FBTest.ok(unit.getBrowserContext() == context, "compilation unit browser context is not consistent");
FBTest.ok(unit.getBrowserContext() == context, "compilation unit browser context is " +
"not consistent");
var other = FBTest.getHTTPURLBase()+"bti/browsercontext/simpleExternal.js";
unit = context.getCompilationUnit(other);
FBTest.ok(unit, "compilation unit does not exist:" + other);
FBTest.compare(other, unit.getURL(), "compilation unit URL is not consistent");
FBTest.ok(unit.getBrowserContext() == context, "compilation unit browser context is not consistent");
FBTest.ok(unit.getBrowserContext() == context, "compilation unit browser context is " +
"not consistent");
FBTest.testDone("done test #getCompilationUnits()");
});

Expand Down
5 changes: 3 additions & 2 deletions tests/content/bti/browsercontext/getJavaScriptContext.js
Expand Up @@ -9,8 +9,9 @@ function runTest()
{
var browser = new FW.Firebug.BTI.Browser(); // TODO
var url = FBTest.getHTTPURLBase()+"bti/browsercontext/testScripts.html";
browser.addEventListener("onContextCreated", function(context) {
FBTest.compare(context.getURL(), url, "URL of newly created context should be " +url);
browser.addEventListener("onContextCreated", function(context)
{
FBTest.compare(context.getURL(), url, "URL of newly created context should be " + url);
FBTest.ok(context.getJavaScriptContext(), "JavaScriptContext should exist when created");
FBTest.testDone("done test #getJavaScriptContext()");
});
Expand Down
14 changes: 8 additions & 6 deletions tests/content/bti/browsercontext/isLoaded.js
Expand Up @@ -10,19 +10,21 @@ function runTest()
{
var browser = new FW.Firebug.BTI.Browser(); // TODO
var url = FBTest.getHTTPURLBase()+"bti/browsercontext/testScripts.html";
browser.addEventListener("onContextCreated", function(context) {
FBTest.compare(context.getURL(), url, "URL of newly created context should be " +url);
browser.addEventListener("onContextCreated", function(context)
{
FBTest.compare(context.getURL(), url, "URL of newly created context should be " + url);
FBTest.ok(!context.isLoaded(), "Context should no be loaded when created");
FBTest.testDone("done test #isLoaded()");
});
browser.addEventListener("onContextLoaded", function(context) {
FBTest.compare(context.getURL(), url, "URL of loaded context should be " +url);
browser.addEventListener("onContextLoaded", function(context)
{
FBTest.compare(context.getURL(), url, "URL of loaded context should be " + url);
FBTest.ok(context.isLoaded(), "Context should be loaded after load notification");
FBTest.testDone("done test #isLoaded()");
});
FBTest.progress("isLoaded, open test page "+url);
FBTest.progress("isLoaded, open test page "+ url);
FBTest.openNewTab(url, function(win)
{
FBTest.progress("isLoaded, new tab opened "+url);
FBTest.progress("isLoaded, new tab opened " + url);
});
}
15 changes: 10 additions & 5 deletions tests/content/bti/compilationunit/getExternalSource.js
Expand Up @@ -8,18 +8,23 @@ function runTest()
{
var browser = new FW.Firebug.BTI.Browser(); // TODO
var url = FBTest.getHTTPURLBase()+"bti/compilationunit/testScripts.html";
browser.addEventListener("onContextCreated", function(context) {
browser.addEventListener("onContextCreated", function(context)
{
FBTest.progress("getExternalSource, context created");
FBTest.compare(context.getURL(), url, "URL of newly created context should be " +url);
FBTest.compare(context.getURL(), url, "URL of newly created context should be " + url);
FBTest.progress("getExternalSource, retrieving compilation units");
context.getCompilationUnits(function(units){
context.getCompilationUnits(function(units)
{
FBTest.progress("getExternalSource, compilation units retrieved");
var cuURL = FBTest.getHTTPURLBase()+"bti/compilationunit/simpleExternal.js";
unit = context.getCompilationUnit(cuURL);
FBTest.ok(unit, "compilation unit does not exist:" + cuURL);
unti.getSource(function(source){
unti.getSource(function(source)
{
FBTest.progress("getExternalSource, source retrieved");
FBTest.compare(source, "document.write(\"<p>Browser Tools Interface (external source file)<br>\");\r\ndocument.write(\"Another line of text</p>\");", "incorrect source");
FBTest.compare(source, "document.write(\"<p>Browser Tools Interface " +
"(external source file)<br>\");\r\ndocument.write(\"Another line of " +
"text</p>\");", "incorrect source");
FBTest.testDone("done test #getExternalSource()");
});
});
Expand Down
16 changes: 9 additions & 7 deletions tests/content/bti/compilationunit/setBreakpoint.js
Expand Up @@ -9,17 +9,20 @@ function runTest()
var browser = new FW.Firebug.BTI.Browser(); // TODO
var url = FBTest.getHTTPURLBase()+"bti/compilationunit/testScripts.html";
var cuURL = FBTest.getHTTPURLBase()+"bti/compilationunit/simpleExternal.js";
browser.addEventListener("onToggleBreakpoint", function(breakpoint){
browser.addEventListener("onToggleBreakpoint", function(breakpoint)
{
// once the breakpoint is installed, this call back should be triggered
var cu = breakpoint.getCompilationUnit();
FBTest.compare(cuURL, cu.getURL(), "breakpoint's compilation unit incorrect");
FBTest.ok(FW.Firebug.BTI.Breakpoint.INSTALLED === breakpoint.getState(), "breakpoint should be installed");
FBTest.ok(FW.Firebug.BTI.Breakpoint.INSTALLED === breakpoint.getState(),
"breakpoint should be installed");
FBTest.ok(1 == breakpoint.getLineNumber(), "breakpoint should be on line 1");
FBTest.testDone("done test #setBreakpoint()");
});
browser.addEventListener("onContextCreated", function(context) {
browser.addEventListener("onContextCreated", function(context)
{
FBTest.progress("setBreakpoint, context created");
FBTest.compare(context.getURL(), url, "URL of newly created context should be " +url);
FBTest.compare(context.getURL(), url, "URL of newly created context should be " + url);
FBTest.progress("setBreakpoint, retrieving compilation units");
context.getCompilationUnits(function(units){
FBTest.progress("setBreakpoint, compilation units retrieved");
Expand All @@ -32,11 +35,10 @@ function runTest()
FBTest.compare(1, bps.length, "Should be 1 breakpoint now");
FBTest.ok(bp === bps[0], "Breakpoint retrieved should be the one just created");
});

});
FBTest.progress("setBreakpoint, open test page "+url);
FBTest.progress("setBreakpoint, open test page " + url);
FBTest.openNewTab(url, function(win)
{
FBTest.progress("setBreakpoint, new tab opened "+url);
FBTest.progress("setBreakpoint, new tab opened " + url);
});
}
15 changes: 9 additions & 6 deletions tests/content/chrome/1883/issue1883.js
Expand Up @@ -26,10 +26,12 @@ function runTest()

with (FBTest.FirebugWindow.FBL) { with (FBTest.FirebugWindow)
{
function ArrayIterator(array) {
function ArrayIterator(array)
{
var index = -1;

this.next = function() {
this.next = function()
{
if (++index >= array.length)
$break();
return array[index];
Expand All @@ -43,17 +45,18 @@ function runTest()
var iterTag = domplate({
tag: FOR("test", "$test|testIter", rowTag.tag),

testIter: function() {
testIter: function()
{
// Need a custom iterator here as we are in a different window
return new ArrayIterator([ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9 ]);
}
});

function checkResults(count) {
function checkResults(count)
{
FBTest.compare(count, rows.length, "Row Count");
for (var i = 0; i < rows.length; i++) {
for (var i = 0; i < rows.length; i++)
FBTest.compare(i%11, rows[i].firstChild.firstChild.testProp, "Row property");
}
}

var table = win.document.createElement("table");
Expand Down

0 comments on commit f955daf

Please sign in to comment.