Changeset 93355 in webkit
- Timestamp:
- Aug 18, 2011 3:08:28 PM (13 years ago)
- Location:
- trunk/Tools
- Files:
-
- 2 added
- 7 edited
- 2 copied
Legend:
- Unmodified
- Added
- Removed
-
trunk/Tools/ChangeLog
r93345 r93355 1 2011-08-18 Tony Chang <tony@chromium.org> 2 3 add embedded png checksums to WebKitTestRunner 4 https://bugs.webkit.org/show_bug.cgi?id=66494 5 6 Looks like WebKitTestRunner has never supported embedded checksums. This copies 7 some code from DRT and adds it to the WebKitTestRunner. 8 9 Reviewed by Darin Adler. 10 11 * WebKitTestRunner/CyclicRedundancyCheck.cpp: Copied from Tools/DumpRenderTree 12 * WebKitTestRunner/CyclicRedundancyCheck.h: Copied from Tools/DumpRenderTree 13 * WebKitTestRunner/GNUmakefile.am: Add new files 14 * WebKitTestRunner/PixelDumpSupport.cpp: Copied from Tools/DumpRenderTree 15 * WebKitTestRunner/PixelDumpSupport.h: Copied from Tools/DumpRenderTree 16 * WebKitTestRunner/WebKitTestRunner.xcodeproj/project.pbxproj: Add new files 17 * WebKitTestRunner/cairo/TestInvocationCairo.cpp: 18 (WTR::dumpBitmap): Refactor to use PixelDumpSupport. 19 (WTR::TestInvocation::dumpPixelsAndCompareWithExpected): 20 * WebKitTestRunner/cg/TestInvocationCG.cpp: 21 (WTR::dumpBitmap): Refactor to use PixelDumpSupport. 22 (WTR::TestInvocation::dumpPixelsAndCompareWithExpected): 23 * WebKitTestRunner/win/WebKitTestRunner.vcproj: Add new files 24 1 25 2011-08-18 Shawn Singh <shawnsingh@chromium.org> 2 26 -
trunk/Tools/DumpRenderTree/CyclicRedundancyCheck.cpp
r83461 r93355 57 57 } 58 58 59 unsigned crc = 0xffffffff L;59 unsigned crc = 0xffffffffU; 60 60 for (size_t i = 0; i < buffer.size(); ++i) 61 crc = crcTable[(crc ^ buffer[i]) & 0xff] ^ ((crc >> 8) & 0x00ffffff L);62 return crc ^ 0xffffffff L;61 crc = crcTable[(crc ^ buffer[i]) & 0xff] ^ ((crc >> 8) & 0x00ffffffU); 62 return crc ^ 0xffffffffU; 63 63 } 64 64 -
trunk/Tools/WebKitTestRunner/CyclicRedundancyCheck.cpp
r93354 r93355 57 57 } 58 58 59 unsigned crc = 0xffffffff L;59 unsigned crc = 0xffffffffU; 60 60 for (size_t i = 0; i < buffer.size(); ++i) 61 crc = crcTable[(crc ^ buffer[i]) & 0xff] ^ ((crc >> 8) & 0x00ffffff L);62 return crc ^ 0xffffffff L;61 crc = crcTable[(crc ^ buffer[i]) & 0xff] ^ ((crc >> 8) & 0x00ffffffU); 62 return crc ^ 0xffffffffU; 63 63 } 64 64 -
trunk/Tools/WebKitTestRunner/CyclicRedundancyCheck.h
r93354 r93355 1 1 /* 2 * Copyright (C) 201 0, Robert Eisele <robert@xarg.org>All rights reserved.2 * Copyright (C) 2011 Google Inc. All rights reserved. 3 3 * 4 4 * Redistribution and use in source and binary forms, with or without … … 29 29 */ 30 30 31 #i nclude "config.h"32 # include "CyclicRedundancyCheck.h"31 #ifndef CyclicRedundancyCheck_h 32 #define CyclicRedundancyCheck_h 33 33 34 34 #include <wtf/Vector.h> 35 35 36 static void makeCrcTable(unsigned crcTable[256]) 37 { 38 for (unsigned i = 0; i < 256; i++) { 39 unsigned c = i; 40 for (int k = 0; k < 8; k++) { 41 if (c & 1) 42 c = -306674912 ^ ((c >> 1) & 0x7fffffff); 43 else 44 c = c >> 1; 45 } 46 crcTable[i] = c; 47 } 48 } 36 unsigned computeCrc(const Vector<unsigned char>&); 49 37 50 unsigned computeCrc(const Vector<unsigned char>& buffer) 51 { 52 static unsigned crcTable[256]; 53 static bool crcTableComputed = false; 54 if (!crcTableComputed) { 55 makeCrcTable(crcTable); 56 crcTableComputed = true; 57 } 58 59 unsigned crc = 0xffffffffL; 60 for (size_t i = 0; i < buffer.size(); ++i) 61 crc = crcTable[(crc ^ buffer[i]) & 0xff] ^ ((crc >> 8) & 0x00ffffffL); 62 return crc ^ 0xffffffffL; 63 } 64 38 #endif -
trunk/Tools/WebKitTestRunner/GNUmakefile.am
r92274 r93355 14 14 Tools/WebKitTestRunner/gtk/TestControllerGtk.cpp \ 15 15 Tools/WebKitTestRunner/cairo/TestInvocationCairo.cpp \ 16 Tools/WebKitTestRunner/CyclicRedundancyCheck.cpp \ 17 Tools/WebKitTestRunner/CyclicRedundancyCheck.h \ 18 Tools/WebKitTestRunner/PixelDumpSupport.cpp \ 19 Tools/WebKitTestRunner/PixelDumpSupport.h \ 16 20 Tools/WebKitTestRunner/PlatformWebView.h \ 17 21 Tools/WebKitTestRunner/StringFunctions.h \ -
trunk/Tools/WebKitTestRunner/WebKitTestRunner.xcodeproj/project.pbxproj
r89530 r93355 22 22 23 23 /* Begin PBXBuildFile section */ 24 5322FB4313FDA0CD0041ABCC /* CyclicRedundancyCheck.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 5322FB4113FDA0CD0041ABCC /* CyclicRedundancyCheck.cpp */; }; 25 5322FB4613FDA0EA0041ABCC /* PixelDumpSupport.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 5322FB4413FDA0EA0041ABCC /* PixelDumpSupport.cpp */; }; 24 26 6510A78211EC643800410867 /* AHEM____.TTF in Resources */ = {isa = PBXBuildFile; fileRef = 6510A77711EC643800410867 /* AHEM____.TTF */; }; 25 27 6510A78311EC643800410867 /* ColorBits.ttf in Resources */ = {isa = PBXBuildFile; fileRef = 6510A77811EC643800410867 /* ColorBits.ttf */; }; … … 82 84 41230E16138C78BF00BCCFCA /* libWebCoreTestSupport.dylib */ = {isa = PBXFileReference; lastKnownFileType = "compiled.mach-o.dylib"; path = libWebCoreTestSupport.dylib; sourceTree = BUILT_PRODUCTS_DIR; }; 83 85 4181731B138AD39D0057AAA4 /* WebCoreTestSupport.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = WebCoreTestSupport.h; path = WebCoreTestSupport/WebCoreTestSupport.h; sourceTree = BUILT_PRODUCTS_DIR; }; 86 5322FB4113FDA0CD0041ABCC /* CyclicRedundancyCheck.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = CyclicRedundancyCheck.cpp; sourceTree = "<group>"; }; 87 5322FB4213FDA0CD0041ABCC /* CyclicRedundancyCheck.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CyclicRedundancyCheck.h; sourceTree = "<group>"; }; 88 5322FB4413FDA0EA0041ABCC /* PixelDumpSupport.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = PixelDumpSupport.cpp; sourceTree = "<group>"; }; 89 5322FB4513FDA0EA0041ABCC /* PixelDumpSupport.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PixelDumpSupport.h; sourceTree = "<group>"; }; 84 90 6510A77711EC643800410867 /* AHEM____.TTF */ = {isa = PBXFileReference; lastKnownFileType = file; name = "AHEM____.TTF"; path = "fonts/AHEM____.TTF"; sourceTree = "<group>"; }; 85 91 6510A77811EC643800410867 /* ColorBits.ttf */ = {isa = PBXFileReference; lastKnownFileType = file; name = ColorBits.ttf; path = fonts/ColorBits.ttf; sourceTree = "<group>"; }; … … 190 196 BC9192021333E4CD003011DC /* cg */, 191 197 BC7933FE118F7C74005EA8E2 /* mac */, 192 BC251A1711D16774002EBC01 /* WebKitTestRunnerPrefix.h */, 198 5322FB4113FDA0CD0041ABCC /* CyclicRedundancyCheck.cpp */, 199 5322FB4213FDA0CD0041ABCC /* CyclicRedundancyCheck.h */, 200 5322FB4413FDA0EA0041ABCC /* PixelDumpSupport.cpp */, 201 5322FB4513FDA0EA0041ABCC /* PixelDumpSupport.h */, 193 202 BC7934DD119066EC005EA8E2 /* PlatformWebView.h */, 194 203 BC79342F118F7F19005EA8E2 /* TestController.h */, … … 196 205 BCD7D2F611921278006DB7EE /* TestInvocation.h */, 197 206 BCD7D2F711921278006DB7EE /* TestInvocation.cpp */, 207 BC251A1711D16774002EBC01 /* WebKitTestRunnerPrefix.h */, 198 208 ); 199 209 name = TestRunner; … … 454 464 files = ( 455 465 BC793400118F7C84005EA8E2 /* main.mm in Sources */, 466 5322FB4313FDA0CD0041ABCC /* CyclicRedundancyCheck.cpp in Sources */, 467 5322FB4613FDA0EA0041ABCC /* PixelDumpSupport.cpp in Sources */, 468 BC7934E811906846005EA8E2 /* PlatformWebViewMac.mm in Sources */, 456 469 BC793431118F7F19005EA8E2 /* TestController.cpp in Sources */, 457 BC 7934E811906846005EA8E2 /* PlatformWebViewMac.mm in Sources */,470 BC8C795C11D2785D004535A1 /* TestControllerMac.mm in Sources */, 458 471 BCD7D2F811921278006DB7EE /* TestInvocation.cpp in Sources */, 459 BC8C795C11D2785D004535A1 /* TestControllerMac.mm in Sources */,460 472 BC9192051333E4F8003011DC /* TestInvocationCG.cpp in Sources */, 461 473 ); -
trunk/Tools/WebKitTestRunner/cairo/TestInvocationCairo.cpp
r89759 r93355 29 29 #include "TestInvocation.h" 30 30 31 #include "PixelDumpSupport.h" 31 32 #include <WebKit2/WKImageCairo.h> 32 33 #include <cairo/cairo.h> … … 67 68 } 68 69 69 static void dumpBitmap(cairo_surface_t* surface )70 static void dumpBitmap(cairo_surface_t* surface, const char* checksum) 70 71 { 71 72 Vector<unsigned char> pixelData; … … 74 75 const unsigned char* data = pixelData.data(); 75 76 76 printf("Content-Type: %s\n", "image/png"); 77 printf("Content-Length: %lu\n", static_cast<unsigned long>(dataLength)); 78 79 const size_t bytesToWriteInOneChunk = 1 << 15; 80 size_t dataRemainingToWrite = dataLength; 81 while (dataRemainingToWrite) { 82 size_t bytesToWriteInThisChunk = std::min(dataRemainingToWrite, bytesToWriteInOneChunk); 83 size_t bytesWritten = fwrite(data, 1, bytesToWriteInThisChunk, stdout); 84 if (bytesWritten != bytesToWriteInThisChunk) 85 break; 86 dataRemainingToWrite -= bytesWritten; 87 data += bytesWritten; 88 } 77 printPNG(data, dataLength, checksum); 89 78 } 90 79 … … 96 85 computeMD5HashStringForCairoSurface(surface, actualHash); 97 86 if (!compareActualHashToExpectedAndDumpResults(actualHash)) 98 dumpBitmap(surface );87 dumpBitmap(surface, actualHash); 99 88 100 89 cairo_surface_destroy(surface); -
trunk/Tools/WebKitTestRunner/cg/TestInvocationCG.cpp
r89426 r93355 27 27 #include "TestInvocation.h" 28 28 29 #include "PixelDumpSupport.h" 29 30 #include "PlatformWebView.h" 30 31 #include "TestController.h" … … 100 101 } 101 102 102 static void dumpBitmap(CGContextRef bitmapContext )103 static void dumpBitmap(CGContextRef bitmapContext, const char* checksum) 103 104 { 104 105 RetainPtr<CGImageRef> image(AdoptCF, CGBitmapContextCreateImage(bitmapContext)); … … 111 112 const size_t dataLength = CFDataGetLength(imageData.get()); 112 113 113 114 fprintf(stdout, "Content-Type: %s\n", "image/png"); 115 fprintf(stdout, "Content-Length: %lu\n", static_cast<unsigned long>(dataLength)); 116 117 const size_t bytesToWriteInOneChunk = 1 << 15; 118 size_t dataRemainingToWrite = dataLength; 119 while (dataRemainingToWrite) { 120 size_t bytesToWriteInThisChunk = std::min(dataRemainingToWrite, bytesToWriteInOneChunk); 121 size_t bytesWritten = fwrite(data, 1, bytesToWriteInThisChunk, stdout); 122 if (bytesWritten != bytesToWriteInThisChunk) 123 break; 124 dataRemainingToWrite -= bytesWritten; 125 data += bytesWritten; 126 } 114 printPNG(data, dataLength, checksum); 127 115 } 128 116 … … 134 122 computeMD5HashStringForContext(context, actualHash); 135 123 if (!compareActualHashToExpectedAndDumpResults(actualHash)) 136 dumpBitmap(context );124 dumpBitmap(context, actualHash); 137 125 } 138 126 -
trunk/Tools/WebKitTestRunner/win/WebKitTestRunner.vcproj
r82477 r93355 472 472 </Filter> 473 473 <File 474 RelativePath="..\CyclicRedundancyCheck.cpp" 475 > 476 </File> 477 <File 478 RelativePath="..\CyclicRedundancyCheck.h" 479 > 480 </File> 481 <File 482 RelativePath="..\PixelDumpSupport.cpp" 483 > 484 </File> 485 <File 486 RelativePath="..\PixelDumpSupport.h" 487 > 488 </File> 489 <File 474 490 RelativePath="..\PlatformWebView.h" 475 491 >
Note: See TracChangeset
for help on using the changeset viewer.