Update Chromium DRT to output binary (instead of base64-encoded) data for web audio...
[WebKit-https.git] / Tools / DumpRenderTree / chromium / LayoutTestController.cpp
index 8576d53..f66aefc 100644 (file)
@@ -155,7 +155,7 @@ LayoutTestController::LayoutTestController(TestShell* shell)
     bindMethod("setDeferMainResourceDataLoad", &LayoutTestController::setDeferMainResourceDataLoad);
     bindMethod("setDomainRelaxationForbiddenForURLScheme", &LayoutTestController::setDomainRelaxationForbiddenForURLScheme);
     bindMethod("setEditingBehavior", &LayoutTestController::setEditingBehavior);
-    bindMethod("setEncodedAudioData", &LayoutTestController::setEncodedAudioData);
+    bindMethod("setAudioData", &LayoutTestController::setAudioData);
     bindMethod("setGeolocationPermission", &LayoutTestController::setGeolocationPermission);
     bindMethod("setIconDatabaseEnabled", &LayoutTestController::setIconDatabaseEnabled);
     bindMethod("setJavaScriptCanAccessClipboard", &LayoutTestController::setJavaScriptCanAccessClipboard);
@@ -1846,12 +1846,19 @@ void LayoutTestController::setTextDirection(const CppArgumentList& arguments, Cp
     m_shell->webView()->setTextDirection(direction);
 }
 
-void LayoutTestController::setEncodedAudioData(const CppArgumentList& arguments, CppVariant* result)
+void LayoutTestController::setAudioData(const CppArgumentList& arguments, CppVariant* result)
 {
     result->setNull();
-    if (arguments.size() < 1 || !arguments[0].isString())
+
+    if (arguments.size() < 1 || !arguments[0].isObject())
+        return;
+
+    // Check that passed-in object is, in fact, an ArrayBufferView.
+    NPObject* npobject = NPVARIANT_TO_OBJECT(arguments[0]);
+    if (!npobject)
+        return;
+    if (!WebBindings::getArrayBufferView(npobject, &m_audioData))
         return;
 
-    m_encodedAudioData = arguments[0].toString();
     setShouldDumpAsAudio(true);
 }