Changeset 88726 in webkit


Ignore:
Timestamp:
Jun 13, 2011 3:50:53 PM (13 years ago)
Author:
crogers@google.com
Message:

2011-06-13 Chris Rogers <crogers@google.com>

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):
Location:
trunk/Tools
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • trunk/Tools/ChangeLog

    r88714 r88726  
     12011-06-13  Chris Rogers  <crogers@google.com>
     2
     3        Reviewed by Dirk Pranke.
     4
     5        Add Web Audio support to chromium DRT
     6        https://bugs.webkit.org/show_bug.cgi?id=62306
     7
     8        * DumpRenderTree/chromium/LayoutTestController.cpp:
     9        (LayoutTestController::LayoutTestController):
     10        (LayoutTestController::reset):
     11        (LayoutTestController::setEncodedAudioData):
     12        * DumpRenderTree/chromium/LayoutTestController.h:
     13        (LayoutTestController::encodedAudioData):
     14        (LayoutTestController::shouldDumpAsAudio):
     15        (LayoutTestController::setShouldDumpAsAudio):
     16        * DumpRenderTree/chromium/TestEventPrinter.cpp:
     17        (DRTPrinter::handleAudioHeader):
     18        (TestShellPrinter::handleAudioHeader):
     19        * DumpRenderTree/chromium/TestEventPrinter.h:
     20        * DumpRenderTree/chromium/TestShell.cpp:
     21        (TestShell::TestShell):
     22        (TestShell::dump):
     23
    1242011-06-13  Jaehun Lim  <ljaehun.lim@samsung.com>
    225
  • trunk/Tools/DumpRenderTree/chromium/LayoutTestController.cpp

    r88377 r88726  
    157157    bindMethod("setDomainRelaxationForbiddenForURLScheme", &LayoutTestController::setDomainRelaxationForbiddenForURLScheme);
    158158    bindMethod("setEditingBehavior", &LayoutTestController::setEditingBehavior);
     159    bindMethod("setEncodedAudioData", &LayoutTestController::setEncodedAudioData);
    159160    bindMethod("setGeolocationPermission", &LayoutTestController::setGeolocationPermission);
    160161    bindMethod("setIconDatabaseEnabled", &LayoutTestController::setIconDatabaseEnabled);
     
    574575    }
    575576    m_dumpAsText = false;
     577    m_dumpAsAudio = false;
    576578    m_dumpEditingCallbacks = false;
    577579    m_dumpFrameLoadCallbacks = false;
     
    19231925    m_shell->webView()->setTextDirection(direction);
    19241926}
     1927
     1928void LayoutTestController::setEncodedAudioData(const CppArgumentList& arguments, CppVariant* result)
     1929{
     1930    result->setNull();
     1931    if (arguments.size() < 1 || !arguments[0].isString())
     1932        return;
     1933
     1934    m_encodedAudioData = arguments[0].toString();
     1935    setShouldDumpAsAudio(true);
     1936}
  • trunk/Tools/DumpRenderTree/chromium/LayoutTestController.h

    r88358 r88726  
    250250    void setEditingBehavior(const CppArgumentList&, CppVariant*);
    251251
     252    // Deals with Web Audio base64 encoded WAVE file data.
     253    void setEncodedAudioData(const CppArgumentList&, CppVariant*);
     254    const std::string& encodedAudioData() const { return m_encodedAudioData; }
     255
    252256    // The following are only stubs.
    253257    // FIXME: Implement any of these that are needed to pass the layout tests.
     
    399403
    400404    WebKit::WebSpeechInputController* speechInputController(WebKit::WebSpeechInputListener*);
     405    bool shouldDumpAsAudio() const { return m_dumpAsAudio; }
     406    void setShouldDumpAsAudio(bool dumpAsAudio) { m_dumpAsAudio = dumpAsAudio; }
    401407    bool shouldDumpAsText() { return m_dumpAsText; }
    402408    void setShouldDumpAsText(bool value) { m_dumpAsText = value; }
     
    519525    bool m_dumpAsText;
    520526
     527    // If true, the test_shell will output a base64 encoded WAVE file.
     528    bool m_dumpAsAudio;
     529
    521530    // If true, the test_shell will write a descriptive line for each editing
    522531    // command.
     
    618627
    619628    OwnPtr<WebKit::WebSpeechInputControllerMock> m_speechInputControllerMock;
     629
     630    // base64 encoded WAV audio data is stored here.
     631    std::string m_encodedAudioData;
    620632};
    621633
  • trunk/Tools/DumpRenderTree/chromium/TestEventPrinter.cpp

    r88246 r88726  
    4343    void handleTextHeader() const;
    4444    void handleTextFooter() const;
     45    void handleAudioHeader() const;
    4546    void handleImage(const char* actualHash, const char* expectedHash, const unsigned char* imageData, size_t imageSize, const char* fileName) const;
    4647    void handleImageFooter() const;
     
    5556    void handleTextHeader() const;
    5657    void handleTextFooter() const;
     58    void handleAudioHeader() const;
    5759    void handleImage(const char* actualHash, const char* expectedHash, const unsigned char* imageData, size_t imageSize, const char* fileName) const;
    5860    void handleImageFooter() const;
     
    9496{
    9597    printf("#EOF\n");
     98}
     99
     100void DRTPrinter::handleAudioHeader() const
     101{
     102    printf("Content-Type: audio/wav\n");
     103    printf("Content-Transfer-Encoding: base64\n");           
    96104}
    97105
     
    142150}
    143151
     152void TestShellPrinter::handleAudioHeader() const
     153{
     154    printf("Content-Type: audio/wav\n");
     155    printf("Content-Transfer-Encoding: base64\n");
     156}
     157
    144158void TestShellPrinter::handleImage(const char* actualHash, const char*, const unsigned char* imageData, size_t imageSize, const char* fileName) const
    145159{
  • trunk/Tools/DumpRenderTree/chromium/TestEventPrinter.h

    r88246 r88726  
    4444    virtual void handleTextHeader() const = 0;
    4545    virtual void handleTextFooter() const = 0;
     46    virtual void handleAudioHeader() const = 0;
    4647    virtual void handleImage(const char* actualHash, const char* expectedHash, const unsigned char* imageData, size_t imageSize, const char* fileName) const = 0;
    4748    virtual void handleImageFooter() const = 0;
  • trunk/Tools/DumpRenderTree/chromium/TestShell.cpp

    r87948 r88726  
    116116    WebRuntimeFeatures::enableFileSystem(true);
    117117    WebRuntimeFeatures::enableJavaScriptI18NAPI(true);
     118    WebRuntimeFeatures::enableWebAudio(true);
     119
    118120    m_webPermissions = adoptPtr(new WebPermissions());
    119121    m_accessibilityController = adoptPtr(new AccessibilityController(this));
     
    462464        return;
    463465    bool shouldDumpAsText = m_layoutTestController->shouldDumpAsText();
     466    bool shouldDumpAsAudio = m_layoutTestController->shouldDumpAsAudio();
    464467    bool shouldGeneratePixelResults = m_layoutTestController->shouldGeneratePixelResults();
    465468    bool dumpedAnything = false;
     469
     470    if (shouldDumpAsAudio) {
     471        m_printer->handleAudioHeader();
     472
     473        const string& encodedAudioData = m_layoutTestController->encodedAudioData();
     474        if (fwrite(encodedAudioData.c_str(), 1, encodedAudioData.size(), stdout) != encodedAudioData.size())
     475            FATAL("Short write to stdout, disk full?\n");
     476        printf("\n");
     477
     478        m_printer->handleTestFooter(true);
     479        fflush(stdout);
     480        fflush(stderr);
     481        return;
     482    }
     483
    466484    if (m_params.dumpTree) {
    467485        dumpedAnything = true;
Note: See TracChangeset for help on using the changeset viewer.