Index: third_party/WebKit/Source/web/tests/FrameTestHelpers.h |
diff --git a/third_party/WebKit/Source/web/tests/FrameTestHelpers.h b/third_party/WebKit/Source/web/tests/FrameTestHelpers.h |
index 067e7fa5bb2170dcd40172540d60fbf3a1ba0bdb..8a435f325e9fc5ae8c5283d25e241b08cfdc07bb 100644 |
--- a/third_party/WebKit/Source/web/tests/FrameTestHelpers.h |
+++ b/third_party/WebKit/Source/web/tests/FrameTestHelpers.h |
@@ -59,7 +59,8 @@ enum class WebCachePolicy; |
namespace FrameTestHelpers { |
class TestWebFrameClient; |
-using TestWebWidgetClient = WebWidgetClient; |
+class TestWebWidgetClient; |
+class TestWebViewClient; |
// Loads a url into the specified WebFrame for testing purposes. Pumps any |
// pending resource requests, as well as waiting for the threaded parser to |
@@ -82,7 +83,7 @@ WebMouseEvent createMouseEvent(WebInputEvent::Type, WebMouseEvent::Button, const |
// Calls WebRemoteFrame::createLocalChild, but with some arguments prefilled |
// with default test values (i.e. with a default |client| or |properties| and/or |
// with a precalculated |uniqueName|). |
-WebLocalFrame* createLocalChild(WebRemoteFrame* parent, const WebString& name = WebString(), WebFrameClient* = nullptr, WebFrame* previousSibling = nullptr, const WebFrameOwnerProperties& = WebFrameOwnerProperties()); |
+WebLocalFrame* createLocalChild(WebRemoteFrame* parent, const WebString& name = WebString(), WebFrameClient* = nullptr, WebWidgetClient* = nullptr, WebFrame* previousSibling = nullptr, const WebFrameOwnerProperties& = WebFrameOwnerProperties()); |
WebRemoteFrame* createRemoteChild(WebRemoteFrame* parent, WebRemoteFrameClient*, const WebString& name = WebString()); |
class SettingOverrider { |
@@ -117,9 +118,35 @@ private: |
bool m_originalOverlayScrollbarsEnabled; |
}; |
+class TestWebWidgetClient : public WebWidgetClient { |
+public: |
+ virtual ~TestWebWidgetClient() {} |
+ bool allowsBrokenNullLayerTreeView() const override { return true; } |
+}; |
+ |
+class TestWebViewWidgetClient : public TestWebWidgetClient { |
+public: |
+ explicit TestWebViewWidgetClient(TestWebViewClient* testWebViewClient) |
+ : m_testWebViewClient(testWebViewClient) |
+ { |
+ } |
+ virtual ~TestWebViewWidgetClient() {} |
+ |
+ void initializeLayerTreeView() override; |
+ WebLayerTreeView* layerTreeView() override; |
+ void scheduleAnimation() override; |
+ |
+private: |
+ TestWebViewClient* m_testWebViewClient; |
+}; |
+ |
class TestWebViewClient : public WebViewClient { |
public: |
- TestWebViewClient() : m_animationScheduled(false) { } |
+ TestWebViewClient() |
+ : m_testWebWidgetClient(this) |
+ , m_animationScheduled(false) |
+ { |
+ } |
virtual ~TestWebViewClient() { } |
void initializeLayerTreeView() override; |
WebLayerTreeView* layerTreeView() override { return m_layerTreeView.get(); } |
@@ -131,9 +158,10 @@ public: |
// TODO(lfg): This is a temporary method to retrieve the WebWidgetClient, |
// while we refactor WebView to not inherit from Webwidget. |
// Returns the WebWidgetClient. |
- WebWidgetClient* widgetClient() { return this; } |
+ TestWebWidgetClient* widgetClient() { return &m_testWebWidgetClient; } |
private: |
+ TestWebViewWidgetClient m_testWebWidgetClient; |
std::unique_ptr<WebLayerTreeView> m_layerTreeView; |
bool m_animationScheduled; |
}; |
@@ -166,7 +194,6 @@ public: |
private: |
WebViewImpl* m_webView; |
- WebFrameWidget* m_webViewWidget; |
SettingOverrider* m_settingOverrider; |
UseMockScrollbarSettings m_mockScrollbarSettings; |
TestWebViewClient* m_testWebViewClient; |
@@ -179,7 +206,7 @@ public: |
TestWebFrameClient(); |
WebFrame* createChildFrame(WebLocalFrame* parent, WebTreeScopeType, const WebString& name, const WebString& uniqueName, WebSandboxFlags, const WebFrameOwnerProperties&) override; |
- void frameDetached(WebFrame*, DetachType) override; |
+ void frameDetached(WebLocalFrame*, DetachType) override; |
void didStartLoading(bool) override; |
void didStopLoading() override; |