Diff
Modified: trunk/Tools/ChangeLog (88725 => 88726)
--- trunk/Tools/ChangeLog 2011-06-13 22:47:37 UTC (rev 88725)
+++ trunk/Tools/ChangeLog 2011-06-13 22:50:53 UTC (rev 88726)
@@ -1,3 +1,26 @@
+2011-06-13 Chris Rogers <[email protected]>
+
+ Reviewed by Dirk Pranke.
+
+ Add Web Audio support to chromium DRT
+ https://bugs.webkit.org/show_bug.cgi?id=62306
+
+ * DumpRenderTree/chromium/LayoutTestController.cpp:
+ (LayoutTestController::LayoutTestController):
+ (LayoutTestController::reset):
+ (LayoutTestController::setEncodedAudioData):
+ * DumpRenderTree/chromium/LayoutTestController.h:
+ (LayoutTestController::encodedAudioData):
+ (LayoutTestController::shouldDumpAsAudio):
+ (LayoutTestController::setShouldDumpAsAudio):
+ * DumpRenderTree/chromium/TestEventPrinter.cpp:
+ (DRTPrinter::handleAudioHeader):
+ (TestShellPrinter::handleAudioHeader):
+ * DumpRenderTree/chromium/TestEventPrinter.h:
+ * DumpRenderTree/chromium/TestShell.cpp:
+ (TestShell::TestShell):
+ (TestShell::dump):
+
2011-06-13 Jaehun Lim <[email protected]>
Reviewed by Eric Seidel.
Modified: trunk/Tools/DumpRenderTree/chromium/LayoutTestController.cpp (88725 => 88726)
--- trunk/Tools/DumpRenderTree/chromium/LayoutTestController.cpp 2011-06-13 22:47:37 UTC (rev 88725)
+++ trunk/Tools/DumpRenderTree/chromium/LayoutTestController.cpp 2011-06-13 22:50:53 UTC (rev 88726)
@@ -156,6 +156,7 @@
bindMethod("setDeferMainResourceDataLoad", &LayoutTestController::setDeferMainResourceDataLoad);
bindMethod("setDomainRelaxationForbiddenForURLScheme", &LayoutTestController::setDomainRelaxationForbiddenForURLScheme);
bindMethod("setEditingBehavior", &LayoutTestController::setEditingBehavior);
+ bindMethod("setEncodedAudioData", &LayoutTestController::setEncodedAudioData);
bindMethod("setGeolocationPermission", &LayoutTestController::setGeolocationPermission);
bindMethod("setIconDatabaseEnabled", &LayoutTestController::setIconDatabaseEnabled);
bindMethod("setJavaScriptCanAccessClipboard", &LayoutTestController::setJavaScriptCanAccessClipboard);
@@ -573,6 +574,7 @@
m_shell->webView()->removeAllUserContent();
}
m_dumpAsText = false;
+ m_dumpAsAudio = false;
m_dumpEditingCallbacks = false;
m_dumpFrameLoadCallbacks = false;
m_dumpUserGestureInFrameLoadCallbacks = false;
@@ -1922,3 +1924,13 @@
m_shell->webView()->setTextDirection(direction);
}
+
+void LayoutTestController::setEncodedAudioData(const CppArgumentList& arguments, CppVariant* result)
+{
+ result->setNull();
+ if (arguments.size() < 1 || !arguments[0].isString())
+ return;
+
+ m_encodedAudioData = arguments[0].toString();
+ setShouldDumpAsAudio(true);
+}
Modified: trunk/Tools/DumpRenderTree/chromium/LayoutTestController.h (88725 => 88726)
--- trunk/Tools/DumpRenderTree/chromium/LayoutTestController.h 2011-06-13 22:47:37 UTC (rev 88725)
+++ trunk/Tools/DumpRenderTree/chromium/LayoutTestController.h 2011-06-13 22:50:53 UTC (rev 88726)
@@ -249,6 +249,10 @@
void setDeferMainResourceDataLoad(const CppArgumentList&, CppVariant*);
void setEditingBehavior(const CppArgumentList&, CppVariant*);
+ // Deals with Web Audio base64 encoded WAVE file data.
+ void setEncodedAudioData(const CppArgumentList&, CppVariant*);
+ const std::string& encodedAudioData() const { return m_encodedAudioData; }
+
// The following are only stubs.
// FIXME: Implement any of these that are needed to pass the layout tests.
void dumpAsWebArchive(const CppArgumentList&, CppVariant*);
@@ -398,6 +402,8 @@
void setWorkQueueFrozen(bool frozen) { m_workQueue.setFrozen(frozen); }
WebKit::WebSpeechInputController* speechInputController(WebKit::WebSpeechInputListener*);
+ bool shouldDumpAsAudio() const { return m_dumpAsAudio; }
+ void setShouldDumpAsAudio(bool dumpAsAudio) { m_dumpAsAudio = dumpAsAudio; }
bool shouldDumpAsText() { return m_dumpAsText; }
void setShouldDumpAsText(bool value) { m_dumpAsText = value; }
bool shouldDumpEditingCallbacks() { return m_dumpEditingCallbacks; }
@@ -518,6 +524,9 @@
// text representation of the renderer.
bool m_dumpAsText;
+ // If true, the test_shell will output a base64 encoded WAVE file.
+ bool m_dumpAsAudio;
+
// If true, the test_shell will write a descriptive line for each editing
// command.
bool m_dumpEditingCallbacks;
@@ -617,6 +626,9 @@
WebKit::WebURL m_userStyleSheetLocation;
OwnPtr<WebKit::WebSpeechInputControllerMock> m_speechInputControllerMock;
+
+ // base64 encoded WAV audio data is stored here.
+ std::string m_encodedAudioData;
};
#endif // LayoutTestController_h
Modified: trunk/Tools/DumpRenderTree/chromium/TestEventPrinter.cpp (88725 => 88726)
--- trunk/Tools/DumpRenderTree/chromium/TestEventPrinter.cpp 2011-06-13 22:47:37 UTC (rev 88725)
+++ trunk/Tools/DumpRenderTree/chromium/TestEventPrinter.cpp 2011-06-13 22:50:53 UTC (rev 88726)
@@ -42,6 +42,7 @@
void handleTimedOut() const;
void handleTextHeader() const;
void handleTextFooter() const;
+ void handleAudioHeader() const;
void handleImage(const char* actualHash, const char* expectedHash, const unsigned char* imageData, size_t imageSize, const char* fileName) const;
void handleImageFooter() const;
void handleTestFooter(bool dumpedAnything) const;
@@ -54,6 +55,7 @@
void handleTimedOut() const;
void handleTextHeader() const;
void handleTextFooter() const;
+ void handleAudioHeader() const;
void handleImage(const char* actualHash, const char* expectedHash, const unsigned char* imageData, size_t imageSize, const char* fileName) const;
void handleImageFooter() const;
void handleTestFooter(bool dumpedAnything) const;
@@ -95,6 +97,12 @@
printf("#EOF\n");
}
+void DRTPrinter::handleAudioHeader() const
+{
+ printf("Content-Type: audio/wav\n");
+ printf("Content-Transfer-Encoding: base64\n");
+}
+
void DRTPrinter::handleImage(const char* actualHash, const char* expectedHash, const unsigned char* imageData, size_t imageSize, const char*) const
{
ASSERT(actualHash);
@@ -141,6 +149,12 @@
{
}
+void TestShellPrinter::handleAudioHeader() const
+{
+ printf("Content-Type: audio/wav\n");
+ printf("Content-Transfer-Encoding: base64\n");
+}
+
void TestShellPrinter::handleImage(const char* actualHash, const char*, const unsigned char* imageData, size_t imageSize, const char* fileName) const
{
ASSERT(actualHash);
Modified: trunk/Tools/DumpRenderTree/chromium/TestEventPrinter.h (88725 => 88726)
--- trunk/Tools/DumpRenderTree/chromium/TestEventPrinter.h 2011-06-13 22:47:37 UTC (rev 88725)
+++ trunk/Tools/DumpRenderTree/chromium/TestEventPrinter.h 2011-06-13 22:50:53 UTC (rev 88726)
@@ -43,6 +43,7 @@
virtual void handleTimedOut() const = 0;
virtual void handleTextHeader() const = 0;
virtual void handleTextFooter() const = 0;
+ virtual void handleAudioHeader() const = 0;
virtual void handleImage(const char* actualHash, const char* expectedHash, const unsigned char* imageData, size_t imageSize, const char* fileName) const = 0;
virtual void handleImageFooter() const = 0;
virtual void handleTestFooter(bool dumpedAnything) const = 0;
Modified: trunk/Tools/DumpRenderTree/chromium/TestShell.cpp (88725 => 88726)
--- trunk/Tools/DumpRenderTree/chromium/TestShell.cpp 2011-06-13 22:47:37 UTC (rev 88725)
+++ trunk/Tools/DumpRenderTree/chromium/TestShell.cpp 2011-06-13 22:50:53 UTC (rev 88726)
@@ -115,6 +115,8 @@
WebRuntimeFeatures::enableIndexedDatabase(true);
WebRuntimeFeatures::enableFileSystem(true);
WebRuntimeFeatures::enableJavaScriptI18NAPI(true);
+ WebRuntimeFeatures::enableWebAudio(true);
+
m_webPermissions = adoptPtr(new WebPermissions());
m_accessibilityController = adoptPtr(new AccessibilityController(this));
m_layoutTestController = adoptPtr(new LayoutTestController(this));
@@ -461,8 +463,24 @@
if (!frame)
return;
bool shouldDumpAsText = m_layoutTestController->shouldDumpAsText();
+ bool shouldDumpAsAudio = m_layoutTestController->shouldDumpAsAudio();
bool shouldGeneratePixelResults = m_layoutTestController->shouldGeneratePixelResults();
bool dumpedAnything = false;
+
+ if (shouldDumpAsAudio) {
+ m_printer->handleAudioHeader();
+
+ const string& encodedAudioData = m_layoutTestController->encodedAudioData();
+ if (fwrite(encodedAudioData.c_str(), 1, encodedAudioData.size(), stdout) != encodedAudioData.size())
+ FATAL("Short write to stdout, disk full?\n");
+ printf("\n");
+
+ m_printer->handleTestFooter(true);
+ fflush(stdout);
+ fflush(stderr);
+ return;
+ }
+
if (m_params.dumpTree) {
dumpedAnything = true;
m_printer->handleTextHeader();