Changeset 83138 in webkit
- Timestamp:
- Apr 6, 2011 8:55:19 PM (13 years ago)
- Location:
- trunk/Tools
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Tools/ChangeLog
r83137 r83138 1 2011-04-06 Chris Rogers <crogers@google.com> 2 3 Reviewed by Tony Chang. 4 5 Add web audio support to DumpRenderTree (mac port) 6 https://bugs.webkit.org/show_bug.cgi?id=57969 7 8 * DumpRenderTree/LayoutTestController.cpp: 9 (LayoutTestController::LayoutTestController): 10 (setEncodedAudioDataCallback): 11 (LayoutTestController::staticFunctions): 12 * DumpRenderTree/LayoutTestController.h: 13 (LayoutTestController::dumpAsAudio): 14 (LayoutTestController::setDumpAsAudio): 15 (LayoutTestController::encodedAudioData): 16 (LayoutTestController::setEncodedAudioData): 17 * DumpRenderTree/mac/DumpRenderTree.mm: 18 (dumpAudio): 19 (dump): 20 1 21 2011-04-06 Benjamin Poulain <benjamin.poulain@nokia.com> 2 22 -
trunk/Tools/DumpRenderTree/LayoutTestController.cpp
r82536 r83138 45 45 LayoutTestController::LayoutTestController(const std::string& testPathOrURL, const std::string& expectedPixelHash) 46 46 : m_dumpApplicationCacheDelegateCallbacks(false) 47 , m_dumpAsAudio(false) 47 48 , m_dumpAsPDF(false) 48 49 , m_dumpAsText(false) … … 313 314 LayoutTestController* controller = static_cast<LayoutTestController*>(JSObjectGetPrivate(thisObject)); 314 315 controller->setCloseRemainingWindowsWhenComplete(JSValueToBoolean(context, arguments[0])); 316 return JSValueMakeUndefined(context); 317 } 318 319 static JSValueRef setEncodedAudioDataCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception) 320 { 321 if (argumentCount < 1) 322 return JSValueMakeUndefined(context); 323 324 JSRetainPtr<JSStringRef> encodedAudioData(Adopt, JSValueToStringCopy(context, arguments[0], exception)); 325 ASSERT(!*exception); 326 327 size_t maxLength = JSStringGetMaximumUTF8CStringSize(encodedAudioData.get()); 328 OwnArrayPtr<char> encodedAudioDataBuffer = adoptArrayPtr(new char[maxLength + 1]); 329 JSStringGetUTF8CString(encodedAudioData.get(), encodedAudioDataBuffer.get(), maxLength + 1); 330 331 LayoutTestController* controller = static_cast<LayoutTestController*>(JSObjectGetPrivate(thisObject)); 332 controller->setEncodedAudioData(encodedAudioDataBuffer.get()); 333 controller->setDumpAsAudio(true); 334 315 335 return JSValueMakeUndefined(context); 316 336 } … … 2222 2242 { "setAppCacheMaximumSize", setAppCacheMaximumSizeCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete }, 2223 2243 { "setApplicationCacheOriginQuota", setApplicationCacheOriginQuotaCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete }, 2244 { "setEncodedAudioData", setEncodedAudioDataCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete }, 2224 2245 { "setAuthenticationPassword", setAuthenticationPasswordCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete }, 2225 2246 { "setAuthenticationUsername", setAuthenticationUsernameCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete }, -
trunk/Tools/DumpRenderTree/LayoutTestController.h
r82536 r83138 135 135 bool elementDoesAutoCompleteForElementWithId(JSStringRef id); 136 136 137 bool dumpAsAudio() const { return m_dumpAsAudio; } 138 void setDumpAsAudio(bool dumpAsAudio) { m_dumpAsAudio = dumpAsAudio; } 139 137 140 bool dumpAsPDF() const { return m_dumpAsPDF; } 138 141 void setDumpAsPDF(bool dumpAsPDF) { m_dumpAsPDF = dumpAsPDF; } … … 264 267 const std::string& testPathOrURL() const { return m_testPathOrURL; } 265 268 const std::string& expectedPixelHash() const { return m_expectedPixelHash; } 269 270 const std::string& encodedAudioData() const { return m_encodedAudioData; } 271 void setEncodedAudioData(const std::string& encodedAudioData) { m_encodedAudioData = encodedAudioData; } 266 272 267 273 bool pauseAnimationAtTimeOnElementWithId(JSStringRef animationName, double time, JSStringRef elementId); … … 335 341 336 342 bool m_dumpApplicationCacheDelegateCallbacks; 343 bool m_dumpAsAudio; 337 344 bool m_dumpAsPDF; 338 345 bool m_dumpAsText; … … 384 391 std::set<std::string> m_willSendRequestClearHeaders; 385 392 393 // base64 encoded WAV audio data is stored here. 394 std::string m_encodedAudioData; 395 386 396 // origins which have been granted desktop notification access 387 397 std::vector<JSStringRef> m_desktopNotificationAllowedOrigins; -
trunk/Tools/DumpRenderTree/mac/DumpRenderTree.mm
r82784 r83138 735 735 } 736 736 737 static NSData *dumpAudio() 738 { 739 const char *encodedAudioData = gLayoutTestController->encodedAudioData().c_str(); 740 741 NSData *data = [NSData dataWithBytes:encodedAudioData length:gLayoutTestController->encodedAudioData().length()]; 742 return data; 743 } 744 737 745 static void dumpHistoryItem(WebHistoryItem *item, int indent, BOOL current) 738 746 { … … 938 946 gLayoutTestController->setGeneratePixelResults(false); 939 947 } 940 if (gLayoutTestController->dumpAsText()) { 948 if (gLayoutTestController->dumpAsAudio()) { 949 resultData = dumpAudio(); 950 resultMimeType = @"audio/wav"; 951 } else if (gLayoutTestController->dumpAsText()) { 941 952 resultString = dumpFramesAsText(mainFrame); 942 953 } else if (gLayoutTestController->dumpAsPDF()) { … … 961 972 printf("Content-Type: %s\n", [resultMimeType UTF8String]); 962 973 974 if (gLayoutTestController->dumpAsAudio()) 975 printf("Content-Transfer-Encoding: base64\n"); 976 963 977 if (resultData) { 964 978 fwrite([resultData bytes], 1, [resultData length], stdout);
Note: See TracChangeset
for help on using the changeset viewer.