| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2011 Google Inc. All rights reserved. | 2 * Copyright (C) 2011 Google Inc. All rights reserved. |
| 3 * | 3 * |
| 4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
| 5 * modification, are permitted provided that the following conditions are | 5 * modification, are permitted provided that the following conditions are |
| 6 * met: | 6 * met: |
| 7 * | 7 * |
| 8 * * Redistributions of source code must retain the above copyright | 8 * * Redistributions of source code must retain the above copyright |
| 9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
| 10 * * Redistributions in binary form must reproduce the above | 10 * * Redistributions in binary form must reproduce the above |
| (...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 71 void reloadFrame(WebFrame*); | 71 void reloadFrame(WebFrame*); |
| 72 void reloadFrameIgnoringCache(WebFrame*); | 72 void reloadFrameIgnoringCache(WebFrame*); |
| 73 | 73 |
| 74 // Pumps pending resource requests while waiting for a frame to load. Don't use | 74 // Pumps pending resource requests while waiting for a frame to load. Don't use |
| 75 // this. Use one of the above helpers. | 75 // this. Use one of the above helpers. |
| 76 void pumpPendingRequestsDoNotUse(WebFrame*); | 76 void pumpPendingRequestsDoNotUse(WebFrame*); |
| 77 | 77 |
| 78 // Calls WebRemoteFrame::createLocalChild, but with some arguments prefilled | 78 // Calls WebRemoteFrame::createLocalChild, but with some arguments prefilled |
| 79 // with default test values (i.e. with a default |client| or |properties| and/or | 79 // with default test values (i.e. with a default |client| or |properties| and/or |
| 80 // with a precalculated |uniqueName|). | 80 // with a precalculated |uniqueName|). |
| 81 WebLocalFrame* createLocalChild(WebRemoteFrame* parent, const WebString& name =
WebString::fromUTF8("frameName"), WebFrameClient* = nullptr, WebFrame* previousS
ibling = nullptr, const WebFrameOwnerProperties& = WebFrameOwnerProperties()); | 81 WebLocalFrame* createLocalChild(WebRemoteFrame* parent, const WebString& name =
WebString(), WebFrameClient* = nullptr, WebFrame* previousSibling = nullptr, con
st WebFrameOwnerProperties& = WebFrameOwnerProperties()); |
| 82 WebRemoteFrame* createRemoteChild(WebRemoteFrame* parent, WebRemoteFrameClient*,
const WebString& name = WebString()); |
| 82 | 83 |
| 83 class SettingOverrider { | 84 class SettingOverrider { |
| 84 public: | 85 public: |
| 85 virtual void overrideSettings(WebSettings*) = 0; | 86 virtual void overrideSettings(WebSettings*) = 0; |
| 86 }; | 87 }; |
| 87 | 88 |
| 88 // Forces to use mocked overlay scrollbars instead of the default native theme s
crollbars to avoid | 89 // Forces to use mocked overlay scrollbars instead of the default native theme s
crollbars to avoid |
| 89 // crash in Chromium code when it tries to load UI resources that are not availa
ble when running | 90 // crash in Chromium code when it tries to load UI resources that are not availa
ble when running |
| 90 // blink unit tests, and to ensure consistent layout regardless of differences b
etween scrollbar themes. | 91 // blink unit tests, and to ensure consistent layout regardless of differences b
etween scrollbar themes. |
| 91 // WebViewHelper includes this, so this is only needed if a test doesn't use Web
ViewHelper or the test | 92 // WebViewHelper includes this, so this is only needed if a test doesn't use Web
ViewHelper or the test |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 128 bool m_animationScheduled; | 129 bool m_animationScheduled; |
| 129 }; | 130 }; |
| 130 | 131 |
| 131 // Convenience class for handling the lifetime of a WebView and its associated m
ainframe in tests. | 132 // Convenience class for handling the lifetime of a WebView and its associated m
ainframe in tests. |
| 132 class WebViewHelper { | 133 class WebViewHelper { |
| 133 WTF_MAKE_NONCOPYABLE(WebViewHelper); | 134 WTF_MAKE_NONCOPYABLE(WebViewHelper); |
| 134 public: | 135 public: |
| 135 WebViewHelper(SettingOverrider* = 0); | 136 WebViewHelper(SettingOverrider* = 0); |
| 136 ~WebViewHelper(); | 137 ~WebViewHelper(); |
| 137 | 138 |
| 138 // Creates and initializes the WebView. Implicitly calls reset() first. IF a | 139 // Creates and initializes the WebView. Implicitly calls reset() first. If |
| 139 // WebFrameClient or a WebViewClient are passed in, they must outlive the | 140 // a WebFrameClient or a WebViewClient are passed in, they must outlive the |
| 140 // WebViewHelper. | 141 // WebViewHelper. |
| 142 WebViewImpl* initializeWithOpener(WebFrame* opener, bool enableJavascript =
false, TestWebFrameClient* = nullptr, TestWebViewClient* = nullptr, void (*updat
eSettingsFunc)(WebSettings*) = nullptr); |
| 143 |
| 144 // Same as initializeWithOpener(), but always sets the opener to null. |
| 141 WebViewImpl* initialize(bool enableJavascript = false, TestWebFrameClient* =
0, TestWebViewClient* = 0, void (*updateSettingsFunc)(WebSettings*) = 0); | 145 WebViewImpl* initialize(bool enableJavascript = false, TestWebFrameClient* =
0, TestWebViewClient* = 0, void (*updateSettingsFunc)(WebSettings*) = 0); |
| 142 | 146 |
| 143 // Same as initialize() but also performs the initial load of the url. Only | 147 // Same as initialize() but also performs the initial load of the url. Only |
| 144 // returns once the load is complete. | 148 // returns once the load is complete. |
| 145 WebViewImpl* initializeAndLoad(const std::string& url, bool enableJavascript
= false, TestWebFrameClient* = 0, TestWebViewClient* = 0, void (*updateSettings
Func)(WebSettings*) = 0); | 149 WebViewImpl* initializeAndLoad(const std::string& url, bool enableJavascript
= false, TestWebFrameClient* = 0, TestWebViewClient* = 0, void (*updateSettings
Func)(WebSettings*) = 0); |
| 146 | 150 |
| 147 void resize(WebSize); | 151 void resize(WebSize); |
| 148 | 152 |
| 149 void reset(); | 153 void reset(); |
| 150 | 154 |
| (...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 194 WebDOMMessageEvent) override { } | 198 WebDOMMessageEvent) override { } |
| 195 | 199 |
| 196 private: | 200 private: |
| 197 RawPtrWillBePersistent<WebRemoteFrameImpl> const m_frame; | 201 RawPtrWillBePersistent<WebRemoteFrameImpl> const m_frame; |
| 198 }; | 202 }; |
| 199 | 203 |
| 200 } // namespace FrameTestHelpers | 204 } // namespace FrameTestHelpers |
| 201 } // namespace blink | 205 } // namespace blink |
| 202 | 206 |
| 203 #endif // FrameTestHelpers_h | 207 #endif // FrameTestHelpers_h |
| OLD | NEW |