Title: [138993] trunk/Tools
Revision
138993
Author
joc...@chromium.org
Date
2013-01-07 14:52:17 -0800 (Mon, 07 Jan 2013)

Log Message

[chromium] move web audio related methods to testrunner library
https://bugs.webkit.org/show_bug.cgi?id=106211

Reviewed by Adam Barth.

* DumpRenderTree/chromium/DRTTestRunner.cpp:
(DRTTestRunner::DRTTestRunner):
(DRTTestRunner::reset):
* DumpRenderTree/chromium/DRTTestRunner.h:
(DRTTestRunner):
* DumpRenderTree/chromium/TestRunner/public/WebTestRunner.h:
(WebKit):
(WebTestRunner::WebTestRunner::shouldDumpAsAudio):
(WebTestRunner::WebTestRunner::audioData):
* DumpRenderTree/chromium/TestRunner/src/TestRunner.cpp:
(WebTestRunner::TestRunner::TestRunner):
(WebTestRunner::TestRunner::reset):
(WebTestRunner::TestRunner::shouldDumpAsAudio):
(WebTestRunner):
(WebTestRunner::TestRunner::audioData):
(WebTestRunner::TestRunner::setAudioData):
* DumpRenderTree/chromium/TestRunner/src/TestRunner.h:
(TestRunner):
* DumpRenderTree/chromium/TestShell.cpp:
(TestShell::dump):

Modified Paths

Diff

Modified: trunk/Tools/ChangeLog (138992 => 138993)


--- trunk/Tools/ChangeLog	2013-01-07 22:24:54 UTC (rev 138992)
+++ trunk/Tools/ChangeLog	2013-01-07 22:52:17 UTC (rev 138993)
@@ -1,3 +1,31 @@
+2013-01-07  Jochen Eisinger  <joc...@chromium.org>
+
+        [chromium] move web audio related methods to testrunner library
+        https://bugs.webkit.org/show_bug.cgi?id=106211
+
+        Reviewed by Adam Barth.
+
+        * DumpRenderTree/chromium/DRTTestRunner.cpp:
+        (DRTTestRunner::DRTTestRunner):
+        (DRTTestRunner::reset):
+        * DumpRenderTree/chromium/DRTTestRunner.h:
+        (DRTTestRunner):
+        * DumpRenderTree/chromium/TestRunner/public/WebTestRunner.h:
+        (WebKit):
+        (WebTestRunner::WebTestRunner::shouldDumpAsAudio):
+        (WebTestRunner::WebTestRunner::audioData):
+        * DumpRenderTree/chromium/TestRunner/src/TestRunner.cpp:
+        (WebTestRunner::TestRunner::TestRunner):
+        (WebTestRunner::TestRunner::reset):
+        (WebTestRunner::TestRunner::shouldDumpAsAudio):
+        (WebTestRunner):
+        (WebTestRunner::TestRunner::audioData):
+        (WebTestRunner::TestRunner::setAudioData):
+        * DumpRenderTree/chromium/TestRunner/src/TestRunner.h:
+        (TestRunner):
+        * DumpRenderTree/chromium/TestShell.cpp:
+        (TestShell::dump):
+
 2013-01-07  Mike West  <mk...@chromium.org>
 
         Make the IFRAME_SEAMLESS flag runtime-enabled.

Modified: trunk/Tools/DumpRenderTree/chromium/DRTTestRunner.cpp (138992 => 138993)


--- trunk/Tools/DumpRenderTree/chromium/DRTTestRunner.cpp	2013-01-07 22:24:54 UTC (rev 138992)
+++ trunk/Tools/DumpRenderTree/chromium/DRTTestRunner.cpp	2013-01-07 22:52:17 UTC (rev 138993)
@@ -153,7 +153,6 @@
     bindMethod("setCustomPolicyDelegate", &DRTTestRunner::setCustomPolicyDelegate);
     bindMethod("setDatabaseQuota", &DRTTestRunner::setDatabaseQuota);
     bindMethod("setDeferMainResourceDataLoad", &DRTTestRunner::setDeferMainResourceDataLoad);
-    bindMethod("setAudioData", &DRTTestRunner::setAudioData);
     bindMethod("setGeolocationPermission", &DRTTestRunner::setGeolocationPermission);
     bindMethod("setMockDeviceOrientation", &DRTTestRunner::setMockDeviceOrientation);
     bindMethod("setMockGeolocationPositionUnavailableError", &DRTTestRunner::setMockGeolocationPositionUnavailableError);
@@ -496,7 +495,6 @@
     TestRunner::reset();
     if (m_shell)
         m_shell->webViewHost()->setDeviceScaleFactor(1);
-    m_dumpAsAudio = false;
     m_dumpCreateView = false;
     m_dumpFrameLoadCallbacks = false;
     m_dumpProgressFinishedCallback = false;
@@ -1039,23 +1037,6 @@
     postTask(new InvokeCallbackTask(this, callbackArguments.release(), 1));
 }
 
-void DRTTestRunner::setAudioData(const CppArgumentList& arguments, CppVariant* result)
-{
-    result->setNull();
-
-    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;
-
-    setShouldDumpAsAudio(true);
-}
-
 #if ENABLE(POINTER_LOCK)
 void DRTTestRunner::didAcquirePointerLock(const CppArgumentList&, CppVariant* result)
 {

Modified: trunk/Tools/DumpRenderTree/chromium/DRTTestRunner.h (138992 => 138993)


--- trunk/Tools/DumpRenderTree/chromium/DRTTestRunner.h	2013-01-07 22:24:54 UTC (rev 138992)
+++ trunk/Tools/DumpRenderTree/chromium/DRTTestRunner.h	2013-01-07 22:52:17 UTC (rev 138993)
@@ -192,10 +192,6 @@
 
     void setDeferMainResourceDataLoad(const CppArgumentList&, CppVariant*);
 
-    // Deals with Web Audio WAV file data.
-    void setAudioData(const CppArgumentList&, CppVariant*);
-    const WebKit::WebArrayBufferView& audioData() const { return m_audioData; } 
-
     void dumpTitleChanges(const CppArgumentList&, CppVariant*);
     void display(const CppArgumentList&, CppVariant*);
     void displayInvalidatedRegion(const CppArgumentList&, CppVariant*);
@@ -266,8 +262,6 @@
     // The following methods are not exposed to _javascript_.
     void setWorkQueueFrozen(bool frozen) { m_workQueue.setFrozen(frozen); }
 
-    bool shouldDumpAsAudio() const { return m_dumpAsAudio; } 
-    void setShouldDumpAsAudio(bool dumpAsAudio) { m_dumpAsAudio = dumpAsAudio; } 
     bool shouldDumpFrameLoadCallbacks() { return m_dumpFrameLoadCallbacks; }
     void setShouldDumpFrameLoadCallbacks(bool value) { m_dumpFrameLoadCallbacks = value; }
     bool shouldDumpProgressFinishedCallback() { return m_dumpProgressFinishedCallback; }
@@ -376,9 +370,6 @@
     // Non-owning pointer. The DRTTestRunner is owned by the host.
     TestShell* m_shell;
 
-    // If true, the test_shell will output a base64 encoded WAVE file.
-    bool m_dumpAsAudio;
-
     // If true, the test_shell will draw the bounds of the current selection rect
     // taking possible transforms of the selection rect into account.
     bool m_dumpSelectionRect;
@@ -469,9 +460,6 @@
     // Bound variable to set whether postMessages should be intercepted or not
     CppVariant m_interceptPostMessage;
 
-    // WAV audio data is stored here.
-    WebKit::WebArrayBufferView m_audioData;
-
     bool m_shouldStayOnPageAfterHandlingBeforeUnload;
 };
 

Modified: trunk/Tools/DumpRenderTree/chromium/TestRunner/public/WebTestRunner.h (138992 => 138993)


--- trunk/Tools/DumpRenderTree/chromium/TestRunner/public/WebTestRunner.h	2013-01-07 22:24:54 UTC (rev 138992)
+++ trunk/Tools/DumpRenderTree/chromium/TestRunner/public/WebTestRunner.h	2013-01-07 22:52:17 UTC (rev 138993)
@@ -31,6 +31,10 @@
 #ifndef WebTestRunner_h
 #define WebTestRunner_h
 
+namespace WebKit {
+class WebArrayBufferView;
+}
+
 namespace WebTestRunner {
 
 // FIXME: Once the TestRunner class is complete, this class should take a
@@ -44,6 +48,8 @@
     virtual void setShouldGeneratePixelResults(bool) { }
     virtual bool shouldDumpChildFrameScrollPositions() const { return false; }
     virtual bool shouldDumpChildFramesAsText() const { return false; }
+    virtual bool shouldDumpAsAudio() const { return false; }
+    virtual const WebKit::WebArrayBufferView* audioData() const { return 0; }
 };
 
 }

Modified: trunk/Tools/DumpRenderTree/chromium/TestRunner/src/TestRunner.cpp (138992 => 138993)


--- trunk/Tools/DumpRenderTree/chromium/TestRunner/src/TestRunner.cpp	2013-01-07 22:24:54 UTC (rev 138992)
+++ trunk/Tools/DumpRenderTree/chromium/TestRunner/src/TestRunner.cpp	2013-01-07 22:52:17 UTC (rev 138993)
@@ -136,6 +136,7 @@
     bindMethod("dumpAsText", &TestRunner::dumpAsText);
     bindMethod("dumpChildFramesAsText", &TestRunner::dumpChildFramesAsText);
     bindMethod("dumpChildFrameScrollPositions", &TestRunner::dumpChildFrameScrollPositions);
+    bindMethod("setAudioData", &TestRunner::setAudioData);
 
     // The following methods interact with the WebTestProxy.
     bindMethod("sendWebIntentResponse", &TestRunner::sendWebIntentResponse);
@@ -205,6 +206,7 @@
     m_generatePixelResults = true;
     m_dumpChildFrameScrollPositions = false;
     m_dumpChildFramesAsText = false;
+    m_dumpAsAudio = false;
 
     m_globalFlag.set(false);
     m_platformName.set("chromium");
@@ -247,6 +249,16 @@
     return m_dumpChildFramesAsText;
 }
 
+bool TestRunner::shouldDumpAsAudio() const
+{
+    return m_dumpAsAudio;
+}
+
+const WebArrayBufferView* TestRunner::audioData() const
+{
+    return &m_audioData;
+}
+
 void TestRunner::setTabKeyCyclesThroughElements(const CppArgumentList& arguments, CppVariant* result)
 {
     if (arguments.size() > 0 && arguments[0].isBool())
@@ -971,6 +983,23 @@
     result->setNull();
 }
 
+void TestRunner::setAudioData(const CppArgumentList& arguments, CppVariant* result)
+{
+    result->setNull();
+
+    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_dumpAsAudio = true;
+}
+
 void TestRunner::workerThreadCount(CppVariant* result)
 {
     result->set(static_cast<int>(WebWorkerInfo::dedicatedWorkerCount()));

Modified: trunk/Tools/DumpRenderTree/chromium/TestRunner/src/TestRunner.h (138992 => 138993)


--- trunk/Tools/DumpRenderTree/chromium/TestRunner/src/TestRunner.h	2013-01-07 22:24:54 UTC (rev 138992)
+++ trunk/Tools/DumpRenderTree/chromium/TestRunner/src/TestRunner.h	2013-01-07 22:52:17 UTC (rev 138993)
@@ -35,6 +35,7 @@
 #include "CppBoundClass.h"
 #include "WebDeliveredIntentClient.h"
 #include "WebTestRunner.h"
+#include "platform/WebArrayBufferView.h"
 #include "platform/WebURL.h"
 
 namespace WebKit {
@@ -65,6 +66,8 @@
     virtual void setShouldGeneratePixelResults(bool) OVERRIDE;
     virtual bool shouldDumpChildFrameScrollPositions() const OVERRIDE;
     virtual bool shouldDumpChildFramesAsText() const OVERRIDE;
+    virtual bool shouldDumpAsAudio() const OVERRIDE;
+    virtual const WebKit::WebArrayBufferView* audioData() const OVERRIDE;
 
 protected:
     // FIXME: make these private once the move from DRTTestRunner to TestRunner
@@ -204,6 +207,9 @@
     // It takes no arguments, and ignores any that may be present.
     void dumpChildFramesAsText(const CppArgumentList&, CppVariant*);
 
+    // Deals with Web Audio WAV file data.
+    void setAudioData(const CppArgumentList&, CppVariant*);
+
     ///////////////////////////////////////////////////////////////////////////
     // Methods interacting with the WebTestProxy
 
@@ -265,6 +271,12 @@
     // well.
     bool m_dumpChildFrameScrollPositions;
 
+    // If true, the test_shell will output a base64 encoded WAVE file.
+    bool m_dumpAsAudio;
+
+    // WAV audio data is stored here.
+    WebKit::WebArrayBufferView m_audioData;
+
     WebTestDelegate* m_delegate;
     WebKit::WebView* m_webView;
 

Modified: trunk/Tools/DumpRenderTree/chromium/TestShell.cpp (138992 => 138993)


--- trunk/Tools/DumpRenderTree/chromium/TestShell.cpp	2013-01-07 22:24:54 UTC (rev 138992)
+++ trunk/Tools/DumpRenderTree/chromium/TestShell.cpp	2013-01-07 22:52:17 UTC (rev 138993)
@@ -579,8 +579,8 @@
     bool dumpedAnything = false;
 
     if (shouldDumpAsAudio) {
-        const WebKit::WebArrayBufferView& webArrayBufferView = m_testRunner->audioData();
-        m_printer.handleAudio(webArrayBufferView.baseAddress(), webArrayBufferView.byteLength());
+        const WebKit::WebArrayBufferView* webArrayBufferView = m_testRunner->audioData();
+        m_printer.handleAudio(webArrayBufferView->baseAddress(), webArrayBufferView->byteLength());
         m_printer.handleAudioFooter();
         m_printer.handleTestFooter(true);
 
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
http://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to