[webkit-dev] Sharing WebKit mocks across platforms

Steve Block steveblock at google.com
Wed Jul 28 11:30:21 PDT 2010


I'm in the process of adding a mock client for DeviceOrientation,
which will be used in DumpRenderTree to test the feature. In order to
share the mock across platforms, I'd like to add the mock to
WebCore/platform/mock.

An interface to the mock will have to be exposed to the embedder
through the platform's WebKit API, so that it can be configured by
DRT, eg ...

mWebView.getDeviceOrientationClientMock().setOrientation(...);

To avoid each platform having to produce it's own WebKit wrapper for
the mock, I'm considering adding a common WebKit wrapper, perhaps to
WebKit/common, and I wanted to get some feedback on the idea. The mock
would be shared between all C++ WebKit platforms. (Note that this is
for convenience only, a platform could equally use it's own WebKit
wrapper around the WebCore mock (eg Mac may do so in ObjectiveC), or
use its own mock altogether.)

Of course we also need WebKit wrappers for all of the non-POD types
used by the mock's interface, and these have to be common between all
platforms. One obvious potential difficulty is the wrapper for
WebCore::String. Each platforms already has a wrapper for this type,
but there's no guarantee of interoperability, so we'd need to write a
new common interface if we're to use the string type.

If a wrapper for string ends up being too problematic, the approach
could still be used for mocks that don't need the string type (of
which DeviceOrientation is one), but the approach then seems less
compelling.

Do people think that this is a reasonable proposal and worth pursuing?
Has there been any attempt to do anything similar before? Or is any
attempt to write this kind of common WebKit code not worth the effort
and destined to failure?

You can see the work in progress for DeviceOrientation at
https://bugs.webkit.org/show_bug.cgi?id=39589 and a similar patch for
SpeechInput mocks at https://bugs.webkit.org/show_bug.cgi?id=42603

I'd appreciate any feedback you may have.

Thanks,
Steve

-- 
Google UK Limited
Registered Office: Belgrave House, 76 Buckingham Palace Road, London SW1W 9TQ
Registered in England Number: 3977902


More information about the webkit-dev mailing list