Blink: Shadow DOMのLayoutTestを実行する

はじめに

BlinkでShadow DOMのLayoutTestを実行する手順のメモです。

仕様

今回は以下の仕様のLayoutTestをピンポイントで実行します。
http://www.w3.org/TR/shadow-dom/

Invoking the cloneNode() method on a ShadowRoot instance must always throw a DATA_CLONE_ERR exception.

テストコード

以下のようなテストコードが用意されています。Shadow Rootに対してcloneNode()すると25番のExceptionが投げられるという単純なテストです。25番は仕様のDATA_CLONE_ERRに対応していて、core/dom/ExceptionCode.hで25と定義されています。


LayoutTest/fast/dom/shadow/shadowroot-clonenode.html

<!DOCTYPE>
<html>
<script src="../../js/resources/js-test-pre.js"></script>

<pre id="console"></pre>

<script>
description('Calling ShadowRoot.cloneNode() should throw a DATA_CLONE_ERR exception.');

var host = document.createElement('div');
var shadowRoot = host.webkitCreateShadowRoot();
shouldThrow('shadowRoot.cloneNode()', '"Error: DataCloneError: DOM Exception 25"');
</script>
<script src="../../js/resources/js-test-post.js"></script>
</html>

core/dom/ExceptionCode.h

        // Others introduced in HTML5:
        NETWORK_ERR = 19,
        ABORT_ERR = 20,
        URL_MISMATCH_ERR = 21,
        QUOTA_EXCEEDED_ERR = 22,
        TIMEOUT_ERR = 23,
        INVALID_NODE_TYPE_ERR = 24,
        DATA_CLONE_ERR = 25,

LayoutTestの実行

LayoutTestを実行しています。成功します。

> cd src\webkit\tools\layout_tests
> python.exe run_webkit_tests.py --nocheck-sys-deps --debug fast\dom\shadow\shadowroot-clonenode.html
Using port 'chromium-win-win7'
Test configuration: <win7, x86, debug>
Placing test results in F:\ssdcygwin\home\fixme\chrome\src\webkit\Debug\layout-t
est-results
Baseline search path: chromium-win -> generic
Using Debug build
Pixel tests enabled
Regular timeout: 12000, slow test timeout: 60000
Command line: F:\ssdcygwin\home\fixme\chrome\src\build\Debug\DumpRenderTree.exe
-

Found 0 tests; running 0, skipping 0.
No tests to run.

失敗させてみる

shadowroot-clonenode.htmlを適当にいじって、再度実行すると、失敗しました。

> python.exe run_webkit_tests.py --nocheck-sys-deps --debug fast\dom\shadow\shadowroot-conenode.html
Using port 'chromium-win-win7'
Test configuration: <win7, x86, debug>
Placing test results in F:\ssdcygwin\home\fixme\chrome\src\webkit\Debug\layout-
est-results
Baseline search path: chromium-win -> generic
Using Debug build
Pixel tests enabled
Regular timeout: 12000, slow test timeout: 60000
Command line: F:\ssdcygwin\home\fixme\chrome\src\build\Debug\DumpRenderTree.exe
-

Found 1 test; running 1, skipping 0.
Ruby is not installed; can't generate pretty patches.

Running 1 DumpRenderTree.

[1/1] fast/dom/shadow/shadowroot-clonenode.html failed unexpectedly (text diff)

0 tests ran as expected, 1 didn't:


Regressions: Unexpected text-only failures (1)
  fast/dom/shadow/shadowroot-clonenode.html [ Failure ]

失敗のレポートがブラウザに表示されます。リンクをたどることで、失敗の詳細が見れます。