Bug 88183 - Implement layoutTestController using IDL in DumpRenderTree
Summary: Implement layoutTestController using IDL in DumpRenderTree
Status: NEW
Alias: None
Product: WebKit
Classification: Unclassified
Component: Tools / Tests (show other bugs)
Version: 528+ (Nightly build)
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Nobody
URL:
Keywords:
Depends on: 88200
Blocks:
  Show dependency treegraph
 
Reported: 2012-06-02 23:13 PDT by Ryosuke Niwa
Modified: 2012-06-04 13:42 PDT (History)
13 users (show)

See Also:


Attachments
work in progress (31.10 KB, patch)
2012-06-03 04:11 PDT, Ryosuke Niwa
no flags Details | Formatted Diff | Diff
work in progress 2 (70.49 KB, patch)
2012-06-04 13:40 PDT, Ryosuke Niwa
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Ryosuke Niwa 2012-06-02 23:13:04 PDT
Right now, layoutTestController directly adds itself to window object using JSC/V8 code. It'll be nice if it were done via IDL files like internals object.
Comment 1 Ryosuke Niwa 2012-06-02 23:17:17 PDT
The challenge here is that layoutTestController is defined in DumpRenderTree instead of WebCore so we can't use Source/WebCore/DerivedSources.make.

One thing we can do is to add layoutTestController as an abstract class in WebCore/testing/ along with an IDL file, and let DumpRenderTree implement it with a concrete class.

That might be cleaner than introducing a derived source in DumpRenderTree since the latter involves modifying all build systems we have.
Comment 2 Adam Barth 2012-06-02 23:41:16 PDT
That sounds like a reasonable solution.  Adding a method would then involve editing the IDL file, the ABC, and the concrete LayoutTestController object.  That still seems like an improvement over the current situation.
Comment 3 Ryosuke Niwa 2012-06-02 23:46:01 PDT
(In reply to comment #2)
> That sounds like a reasonable solution.  Adding a method would then involve editing the IDL file, the ABC, and the concrete LayoutTestController object.  That still seems like an improvement over the current situation.

Yeah, we'll at least eliminate the need to modify both JSC and V8 versions of layoutTestController.cpp files.
Comment 4 Adam Barth 2012-06-02 23:55:26 PDT
I haven't looked at the details in a while, but I seem to remember that DRT and LayoutTestController don't share that much code across ports.  Having an ABC might be a good way to share more code.  For example, you could have an intermediate class that's shared by all the ports and then a further port-specific leaf class.  We'll have to look at the details to see what makes the most sense.
Comment 5 Ryosuke Niwa 2012-06-03 04:11:19 PDT
Created attachment 145480 [details]
work in progress

The test passes on Mac WebKit1. Will finish it up tomorrow.
Comment 6 Adam Barth 2012-06-03 08:38:02 PDT
Comment on attachment 145480 [details]
work in progress

View in context: https://bugs.webkit.org/attachment.cgi?id=145480&action=review

> Tools/DumpRenderTree/LayoutTestController.h:445
> +class TestRunner : public WebCore::TestRunnerBase {

I was expecting LayoutTestController to inherit from TestRunnerBase.  As written, you're going to need to forward every call to m_controller...
Comment 7 Ryosuke Niwa 2012-06-03 11:15:22 PDT
(In reply to comment #6)
> (From update of attachment 145480 [details])
> View in context: https://bugs.webkit.org/attachment.cgi?id=145480&action=review
> 
> > Tools/DumpRenderTree/LayoutTestController.h:445
> > +class TestRunner : public WebCore::TestRunnerBase {
> 
> I was expecting LayoutTestController to inherit from TestRunnerBase.  As written, you're going to need to forward every call to m_controller...

It turns out LayoutTestController doesn't implement methods like dumpAsText or waitUntilDone. Instead, static callback functions implement those.

So my current plan is to implement TestRunner class as a proxy for LayoutTestController, transition to use IDL, and then merge the existing LayoutTestController into TestRunner.  I mean... I could attempt to do all of them at once but the patch is going to be huge then.
Comment 8 Adam Barth 2012-06-03 11:17:08 PDT
Ah, ok.  That makes sense.
Comment 9 Ryosuke Niwa 2012-06-03 11:50:30 PDT
(In reply to comment #8)
> Ah, ok.  That makes sense.

But now I realize that WebKit2 already has layoutTestController.idl and CodeGeneratorTestRunner.pm. And it's a bit tricky to share the code there because of extensions like "PassContext".
Comment 10 Ryosuke Niwa 2012-06-03 12:02:58 PDT
I guess doing the rename in this patch is too aggressive given the separate IDL & code generator in WebKit2. We probably need to add IDL support in DumpRenderTree first, and somehow share IDL files between WebKitTestRunner and DumpRenderTree.
Comment 11 Ryosuke Niwa 2012-06-03 12:04:38 PDT
+Sam, +Maciej since they implemented WebKitTestRunner's IDL & code generator.
Comment 12 Adam Barth 2012-06-03 12:25:34 PDT
You're being drawn into the bigger problem, which is to unify DumpRenderTree and WebKitTestRunner.  Sharing the IDL file seems valuable given that we expect tests to run both in WebKit1 and WebKit2.
Comment 13 Ryosuke Niwa 2012-06-03 13:01:51 PDT
(In reply to comment #12)
> You're being drawn into the bigger problem, which is to unify DumpRenderTree and WebKitTestRunner.  Sharing the IDL file seems valuable given that we expect tests to run both in WebKit1 and WebKit2.

Yeah, we should probably do it in a separate patch though. This patch has already gotten quite massive.
Comment 14 Adam Barth 2012-06-03 13:03:53 PDT
Doing it in a separate patch is fine.  I'd just recommending having a plan in mind for how to share the IDL file.
Comment 15 Ryosuke Niwa 2012-06-04 13:40:44 PDT
Created attachment 145622 [details]
work in progress 2