[content shell] enable audio dumps

This will make webaudio tests pass.

Before, the text header was printed way before the actual text dump happened.
This change moves the header printing to just before the dumping to match DRT.

BUG=111316
[email protected]
TEST=webaudio/ passes

Review URL: https://codereview.chromium.org/12300010

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@183113 0039d316-1c4b-4281-b951-d872f2087c98
diff --git a/content/shell/webkit_test_runner.cc b/content/shell/webkit_test_runner.cc
index a0bf098f..b6c1f3ab 100644
--- a/content/shell/webkit_test_runner.cc
+++ b/content/shell/webkit_test_runner.cc
@@ -31,6 +31,7 @@
 #include "third_party/WebKit/Source/Platform/chromium/public/WebURL.h"
 #include "third_party/WebKit/Source/Platform/chromium/public/WebURLError.h"
 #include "third_party/WebKit/Source/Platform/chromium/public/WebURLResponse.h"
+#include "third_party/WebKit/Source/WebKit/chromium/public/WebArrayBufferView.h"
 #include "third_party/WebKit/Source/WebKit/chromium/public/WebContextMenuData.h"
 #include "third_party/WebKit/Source/WebKit/chromium/public/WebDataSource.h"
 #include "third_party/WebKit/Source/WebKit/chromium/public/WebDevToolsAgent.h"
@@ -49,6 +50,7 @@
 #include "webkit/glue/webpreferences.h"
 
 using WebKit::Platform;
+using WebKit::WebArrayBufferView;
 using WebKit::WebContextMenuData;
 using WebKit::WebDevToolsAgent;
 using WebKit::WebDeviceOrientation;
@@ -509,6 +511,18 @@
   WebTestInterfaces* interfaces =
       ShellRenderProcessObserver::GetInstance()->test_interfaces();
 
+  if (interfaces->testRunner()->shouldDumpAsAudio()) {
+    const WebArrayBufferView* audio_data =
+        interfaces->testRunner()->audioData();
+    std::vector<unsigned char> vector_data(
+        static_cast<const unsigned char*>(audio_data->baseAddress()),
+        static_cast<const unsigned char*>(audio_data->baseAddress()) +
+            audio_data->byteLength());
+    Send(new ShellViewHostMsg_AudioDump(routing_id(), vector_data));
+    Send(new ShellViewHostMsg_TestFinished(routing_id(), false));
+    return;
+  }
+
   Send(
       new ShellViewHostMsg_TextDump(routing_id(), proxy()->captureTree(false)));