From beb04f57e42284cc05c7ae2f8e3f170c2de6ac3a Mon Sep 17 00:00:00 2001 From: Joe Drew Date: Thu, 12 Nov 2009 18:00:31 -0500 Subject: [PATCH] Bug 497665 and Bug 514605 - Tests. --- modules/libpr0n/test/mochitest/Makefile.in | 3 + .../test/mochitest/bug497665-iframe.html | 8 ++ modules/libpr0n/test/mochitest/bug497665.sjs | 35 ++++++++ .../test/mochitest/test_bug497665.html | 85 +++++++++++++++++++ 4 files changed, 131 insertions(+) create mode 100644 modules/libpr0n/test/mochitest/bug497665-iframe.html create mode 100644 modules/libpr0n/test/mochitest/bug497665.sjs create mode 100644 modules/libpr0n/test/mochitest/test_bug497665.html diff --git a/modules/libpr0n/test/mochitest/Makefile.in b/modules/libpr0n/test/mochitest/Makefile.in index 4bfebe1f17d..3ef9b2f60e1 100644 --- a/modules/libpr0n/test/mochitest/Makefile.in +++ b/modules/libpr0n/test/mochitest/Makefile.in @@ -66,6 +66,9 @@ _TEST_FILES = imgutils.js \ test_bug512435.html \ damon.jpg \ shaver.png \ + test_bug497665.html \ + bug497665-iframe.html \ + bug497665.sjs \ $(NULL) #test_bug435296.html disabled until we re-enable decode-on-draw diff --git a/modules/libpr0n/test/mochitest/bug497665-iframe.html b/modules/libpr0n/test/mochitest/bug497665-iframe.html new file mode 100644 index 00000000000..a2b098e31b8 --- /dev/null +++ b/modules/libpr0n/test/mochitest/bug497665-iframe.html @@ -0,0 +1,8 @@ + + +Bug 497665 iframe + + + + + diff --git a/modules/libpr0n/test/mochitest/bug497665.sjs b/modules/libpr0n/test/mochitest/bug497665.sjs new file mode 100644 index 00000000000..848cc15181b --- /dev/null +++ b/modules/libpr0n/test/mochitest/bug497665.sjs @@ -0,0 +1,35 @@ +function handleRequest(request, response) +{ + var file = Components.classes["@mozilla.org/file/directory_service;1"] + .getService(Components.interfaces.nsIProperties) + .get("CurWorkD", Components.interfaces.nsIFile); + + file.append("tests"); + file.append("modules"); + file.append("libpr0n"); + file.append("test"); + file.append("mochitest"); + + var redirectstate = "/modules/libpr0n/test/mochitest/bug497665.sjs"; + if (getState(redirectstate) == "") { + file.append('blue.png'); + setState(redirectstate, "red"); + } else { + file.append('red.png'); + setState(redirectstate, ""); + } + + response.setHeader("Cache-Control", "max-age=3600", false); + + var fileStream = Components.classes['@mozilla.org/network/file-input-stream;1'] + .createInstance(Components.interfaces.nsIFileInputStream); + fileStream.init(file, 1, 0, false); + var binaryStream = Components.classes['@mozilla.org/binaryinputstream;1'] + .createInstance(Components.interfaces.nsIBinaryInputStream); + binaryStream.setInputStream(fileStream); + + response.bodyOutputStream.writeFrom(binaryStream, binaryStream.available()); + + binaryStream.close(); + fileStream.close(); +} diff --git a/modules/libpr0n/test/mochitest/test_bug497665.html b/modules/libpr0n/test/mochitest/test_bug497665.html new file mode 100644 index 00000000000..589a307effc --- /dev/null +++ b/modules/libpr0n/test/mochitest/test_bug497665.html @@ -0,0 +1,85 @@ + + + + + Test for Bug 497665 + + + + + +Mozilla Bug 497665 +

+
+ + +
+
+
+
+ +