WebKit Bugzilla
New
Browse
Log In
×
Sign in with GitHub
or
Remember my login
Create Account
·
Forgot Password
Forgotten password account recovery
RESOLVED FIXED
48506
Move DeviceOrientationClientMock from LayoutTestController to WebViewHost
https://bugs.webkit.org/show_bug.cgi?id=48506
Summary
Move DeviceOrientationClientMock from LayoutTestController to WebViewHost
John Knottenbelt
Reported
2010-10-28 04:15:16 PDT
The test fast/dom/DeviceOrientation/no-page-cache.html opens an additional window which results in a secondary page with its own DeviceOrientationController. Since DeviceOrientationClientMock maintains a back pointer to the corresponding WebCore::Page's DeviceOrientationController, there should be one DeviceOrientationClientMock per DeviceOrientationController. In DumpRenderTree (unlike test_shell) there is only one instance of LayoutTestController. LayoutTestController owns WebDeviceOrientationClientMock which owns DeviceOrientationClientMock, so there is only one instance of the mock that must serve two controllers (in the above test). There is exactly one WebViewHost instance per WebView (per page). I propose that we move the mock to WebViewHost, and that LayoutTestController::setMockOrientation delegates to the TestShell's primary WebView.
Attachments
Patch
(8.66 KB, patch)
2010-10-28 06:04 PDT
,
John Knottenbelt
no flags
Details
Formatted Diff
Diff
Patch
(8.14 KB, patch)
2010-11-09 04:56 PST
,
John Knottenbelt
no flags
Details
Formatted Diff
Diff
Patch
(8.34 KB, patch)
2010-11-09 07:03 PST
,
John Knottenbelt
no flags
Details
Formatted Diff
Diff
Patch
(8.36 KB, patch)
2010-11-15 09:00 PST
,
John Knottenbelt
no flags
Details
Formatted Diff
Diff
Patch
(8.60 KB, patch)
2010-11-15 09:51 PST
,
John Knottenbelt
no flags
Details
Formatted Diff
Diff
Show Obsolete
(4)
View All
Add attachment
proposed patch, testcase, etc.
John Knottenbelt
Comment 1
2010-10-28 06:04:05 PDT
Created
attachment 72178
[details]
Patch
Hans Wennborg
Comment 2
2010-10-28 06:24:57 PDT
Comment on
attachment 72178
[details]
Patch View in context:
https://bugs.webkit.org/attachment.cgi?id=72178&action=review
This looks fine (assuming the tests still pass of course :), I only have a couple of nits (also I'm not a real reviewer):
> WebCore/ChangeLog:5 > + Add an assert to check that the DeviceOrientationClient is
DeviceOrientationClient -> DeviceOrientationClientMock?
> WebKitTools/ChangeLog:6 > + WebViewHost.
Maybe add a comment that this is to make sure that each Page gets its own client?
> WebKitTools/DumpRenderTree/chromium/LayoutTestController.cpp:1562 > +WebKit::WebDeviceOrientationClientMock* LayoutTestController::deviceOrientationClientMock()
There's a using directive for the WebKit namespace, so WebKit:: shouldn't be necessary.
> WebKitTools/DumpRenderTree/chromium/WebViewHost.cpp:1110 > + PassOwnPtr<WebDeviceOrientationClientMock> deviceOrientationClientMock = m_deviceOrientationClientMock.release();
Should this be a PassOwnPtr? I'm always confused by these smart pointers, but since release() returns a raw pointer, isn't that what we should use? Steve would know this better than me, I think..
John Knottenbelt
Comment 3
2010-10-28 06:41:30 PDT
Comment on
attachment 72178
[details]
Patch View in context:
https://bugs.webkit.org/attachment.cgi?id=72178&action=review
>> WebKitTools/DumpRenderTree/chromium/WebViewHost.cpp:1110 >> + PassOwnPtr<WebDeviceOrientationClientMock> deviceOrientationClientMock = m_deviceOrientationClientMock.release(); > > Should this be a PassOwnPtr? I'm always confused by these smart pointers, but since release() returns a raw pointer, isn't that what we should use? Steve would know this better than me, I think..
PassOwnPtr will take ownership of the mock, and set the member variable m_deviceOrientationClientMock to 0. The reason for doing this is because the destructor will be invoked and we don't actually want the mock to be destroyed and reallocated because the WebView() still exists, meaning that the DeviceOrientationController still have a pointer back to the current (Web)DeviceOrientationControllerMock. This means that the address of the DeviceOrientationControllerMock should stay the same. I need to talk to Kent Tamura about whether the placement destruction / new is necessary, but in the meantime this should do the trick. If it is important to reset the state of the mock between tests (the tests run fine without), we should add a reset() method to the mock and call it at the end of this method.
John Knottenbelt
Comment 4
2010-11-09 04:56:06 PST
Created
attachment 73361
[details]
Patch
John Knottenbelt
Comment 5
2010-11-09 04:57:00 PST
WebViewHost::reset() refactored, so no longer need rather strange PassOwnPtr combination.
Hans Wennborg
Comment 6
2010-11-09 06:06:54 PST
(In reply to
comment #5
)
> WebViewHost::reset() refactored, so no longer need rather strange PassOwnPtr combination.
Great! I believe my first three nits still apply, though ;)
John Knottenbelt
Comment 7
2010-11-09 07:03:45 PST
Created
attachment 73372
[details]
Patch
Hans Wennborg
Comment 8
2010-11-10 07:47:50 PST
(In reply to
comment #7
)
> Created an attachment (id=73372) [details] > Patch
LGTM.
Steve Block
Comment 9
2010-11-11 06:11:21 PST
Comment on
attachment 73372
[details]
Patch View in context:
https://bugs.webkit.org/attachment.cgi?id=73372&action=review
> WebKitTools/DumpRenderTree/chromium/LayoutTestController.cpp:1569 > + return m_shell->webViewHost()->deviceOrientationClientMock();
So webViewHost() returns the primary WebView, right? This means that JS calls in all pages will only configure the mock for the main page. Maybe add a comment?
> WebKitTools/DumpRenderTree/chromium/LayoutTestController.h:446 > + WebKit::WebDeviceOrientationClientMock* deviceOrientationClientMock();
Is there any need for this method if it's a one-liner and only called once?
> WebKitTools/DumpRenderTree/chromium/WebViewHost.cpp:584 > +WebDeviceOrientationClient* WebViewHost::deviceOrientationClient()
Is this method needed? Can we just use deviceOrientationClientMock()? Where is it called from?
John Knottenbelt
Comment 10
2010-11-15 09:00:17 PST
Created
attachment 73904
[details]
Patch
Jeremy Orlow
Comment 11
2010-11-15 09:15:40 PST
Comment on
attachment 73904
[details]
Patch View in context:
https://bugs.webkit.org/attachment.cgi?id=73904&action=review
r=me
> WebCore/platform/mock/DeviceOrientationClientMock.cpp:43 > + ASSERT(controller);
It's probably better to keep the m_controler check after
> WebCore/platform/mock/DeviceOrientationClientMock.cpp:-43 > - ASSERT(m_controller);
I think it's better to leave this one.
> WebKitTools/ChangeLog:9 > +
https://bugs.webkit.org/show_bug.cgi?id=48506
""" Reviewed by Title this url description """ Also describe why it's a design constraint.
John Knottenbelt
Comment 12
2010-11-15 09:51:41 PST
Created
attachment 73906
[details]
Patch
Jeremy Orlow
Comment 13
2010-11-16 02:35:52 PST
Comment on
attachment 73906
[details]
Patch lgtm
WebKit Commit Bot
Comment 14
2010-11-16 02:54:42 PST
Comment on
attachment 73906
[details]
Patch Clearing flags on attachment: 73906 Committed
r72071
: <
http://trac.webkit.org/changeset/72071
>
WebKit Commit Bot
Comment 15
2010-11-16 02:54:49 PST
All reviewed patches have been landed. Closing bug.
Note
You need to
log in
before you can comment on or make changes to this bug.
Top of Page
Format For Printing
XML
Clone This Bug