wiki:Layout Test Protocol

Version 5 (modified by dfarler@apple.com, 7 years ago) (diff)

--

The Layout Test Protocol (LTP) is a line-based protocol for requesting layout tests from DumpRenderTree (DRT) or WebKitTestRunner (WKTR). Requests come into DRT/WKTR from standard input or into a socket. Responses leave DRT/WKTR via standard output/error or into a socket. The protocol works similarly to HTTP, where a content type and length are sent before blocks of data. A response consists of multiple chunks, all of which are optional:

  • RenderTree: The textual representation of the render tree
  • Image: An image capture of the web view
  • Audio: An audio capture during the test
  • Error: Other textual output corresponding to standard error
  • DumpMalloc: Number of committed virtual memory bytes

Requests

Request -> Path Newline
Path -> [^\n]+

Responses

Response -> RenderTree Image Audio Error Leaks EOF
ContentLength: -> 'Content-Length: %lu' Newline
EOF -> '#EOF' Newline
Newline -> '\n'

RenderTree -> ContentTypeText DumpMalloc Lines EOF
ContentTypeText -> 'Content-type: text/plain' Newline
Lines -> Any text lines not solely containing '#EOF'

Image -> ContentTypePNG ContentLength Data
ContentTypePNG -> 'Content-type: image/png' Newline

Audio -> ContentTypeAudio ContentLength Data
ContentTypeAudio -> 'Content-type: audio/wav' Newline

Leaks -> Leak RestLeaks
Leak -> 'LEAK: ' \d+ LeakType
RestLeaks -> Leaks | empty

Example response

Standard out

Content-Type: text/plain
DumpMalloc: 0
layer at (0,0) size 800x600
  RenderView at (0,0) size 800x600
layer at (0,0) size 800x89
  RenderBlock {HTML} at (0,0) size 800x89
    RenderBody {BODY} at (8,8) size 784x73
      RenderBlock (anonymous) at (0,0) size 784x36
        RenderText {#text} at (0,0) size 775x36
          text run at (0,0) width 775: "No red text should be visible in any of the sections below. same-as-base isolate containing <br> surrounded by opposite-to-"
          text run at (0,18) width 55: "base text"
        RenderText {#text} at (0,0) size 0x0
      RenderBlock {DIV} at (0,36) size 784x37
        RenderBlock {DIV} at (0,0) size 784x37
          RenderText {#text} at (680,1) size 104x18
            text run at (680,1) width 9 RTL: ") "
            text run at (689,1) width 95: "things to do: (1"
          RenderInline {SPAN} at (0,0) size 11x18
            RenderText {#text} at (669,1) size 11x18
              text run at (669,1) width 11 RTL: "\x{5D0}"
            RenderBR {BR} at (669,1) size 1x18
          RenderText {#text} at (730,19) size 54x18
            text run at (730,19) width 32: "sleep"
            text run at (762,19) width 9 RTL: ") "
            text run at (771,19) width 8: "2"
            text run at (779,19) width 5 RTL: "("
#EOF
#EOF

Standard error

#EOF