@Test(expected=IOException.class) public void testEvil() throws Exception { // Metadata length is too long causes OutOfMemory HttpResponse resp = createResponse("org/apache/shindig/gadgets/rewrite/image/evil.png", "image/png"); rewrite(resp); fail("Should have failed to read image"); }
@Test public void testRewriteInefficientPNG() throws Exception { HttpResponse resp = createResponse("org/apache/shindig/gadgets/rewrite/image/inefficient.png", "image/png"); HttpResponse httpResponse = rewrite(resp); assertTrue(httpResponse.getContentLength() <= resp.getContentLength()); assertEquals("image/png", httpResponse.getHeader("Content-Type")); }
@Test public void testRewriteInefficientPNG() throws Exception { HttpResponse resp = createResponse("org/apache/shindig/gadgets/rewrite/image/inefficient.png", "image/png"); HttpResponse httpResponse = rewrite(resp); assertTrue(httpResponse.getContentLength() <= resp.getContentLength()); assertEquals("image/png", httpResponse.getHeader("Content-Type")); }
@Test public void testStripAlpha() throws Exception { HttpResponse resp = createResponse("org/apache/shindig/gadgets/rewrite/image/rgbawithnoalpha.png", "image/png"); HttpResponse httpResponse = rewrite(resp); assertTrue(httpResponse.getContentLength() <= resp.getContentLength()); assertEquals("image/png", httpResponse.getHeader("Content-Type")); }
@Test(expected=IOException.class) public void testEvil() throws Exception { // Metadata length is too long causes OutOfMemory HttpResponse resp = createResponse("org/apache/shindig/gadgets/rewrite/image/evil.png", "image/png"); rewrite(resp); fail("Should have failed to read image"); }
@Test public void testStripAlpha() throws Exception { HttpResponse resp = createResponse("org/apache/shindig/gadgets/rewrite/image/rgbawithnoalpha.png", "image/png"); HttpResponse httpResponse = rewrite(resp); assertTrue(httpResponse.getContentLength() <= resp.getContentLength()); assertEquals("image/png", httpResponse.getHeader("Content-Type")); }
@Test(expected=IOException.class) public void testEvil() throws Exception { // Metadata length is too long causes OutOfMemory HttpResponse resp = createResponse("org/apache/shindig/gadgets/rewrite/image/evil.png", "image/png"); rewrite(resp); fail("Should have failed to read image"); }
@Test public void testStripAlpha() throws Exception { HttpResponse resp = createResponse("org/apache/shindig/gadgets/rewrite/image/rgbawithnoalpha.png", "image/png"); HttpResponse httpResponse = rewrite(resp); assertTrue(httpResponse.getContentLength() <= resp.getContentLength()); assertEquals("image/png", httpResponse.getHeader("Content-Type")); }
@Test public void testRewriteInefficientPNG() throws Exception { HttpResponse resp = createResponse("org/apache/shindig/gadgets/rewrite/image/inefficient.png", "image/png"); HttpResponse httpResponse = rewrite(resp); assertTrue(httpResponse.getContentLength() <= resp.getContentLength()); assertEquals("image/png", httpResponse.getHeader("Content-Type")); }