Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(218)

Side by Side Diff: third_party/WebKit/Source/web/tests/FrameTestHelpers.cpp

Issue 1924043002: Switch the inheritance of WebViewClient from WebWidgetClient to protected. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase, fix new test Created 4 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 171 matching lines...) Expand 10 before | Expand all | Expand 10 after
182 , m_webViewWidget(nullptr) 182 , m_webViewWidget(nullptr)
183 , m_settingOverrider(settingOverrider) 183 , m_settingOverrider(settingOverrider)
184 { 184 {
185 } 185 }
186 186
187 WebViewHelper::~WebViewHelper() 187 WebViewHelper::~WebViewHelper()
188 { 188 {
189 reset(); 189 reset();
190 } 190 }
191 191
192 WebViewImpl* WebViewHelper::initializeWithOpener(WebFrame* opener, bool enableJa vascript, TestWebFrameClient* webFrameClient, TestWebViewClient* webViewClient, void (*updateSettingsFunc)(WebSettings*)) 192 WebViewImpl* WebViewHelper::initializeWithOpener(WebFrame* opener, bool enableJa vascript, TestWebFrameClient* webFrameClient, TestWebViewClient* webViewClient, TestWebWidgetClient* webWidgetClient, void (*updateSettingsFunc)(WebSettings*))
193 { 193 {
194 reset(); 194 reset();
195 195
196 if (!webFrameClient) 196 if (!webFrameClient)
197 webFrameClient = defaultWebFrameClient(); 197 webFrameClient = defaultWebFrameClient();
198 if (!webViewClient) 198 if (!webViewClient)
199 webViewClient = defaultWebViewClient(); 199 webViewClient = defaultWebViewClient();
200 if (!webWidgetClient)
201 webWidgetClient = webViewClient->widgetClient();
200 m_webView = WebViewImpl::create(webViewClient); 202 m_webView = WebViewImpl::create(webViewClient);
201 m_webView->settings()->setJavaScriptEnabled(enableJavascript); 203 m_webView->settings()->setJavaScriptEnabled(enableJavascript);
202 m_webView->settings()->setPluginsEnabled(true); 204 m_webView->settings()->setPluginsEnabled(true);
203 // Enable (mocked) network loads of image URLs, as this simplifies 205 // Enable (mocked) network loads of image URLs, as this simplifies
204 // the completion of resource loads upon test shutdown & helps avoid 206 // the completion of resource loads upon test shutdown & helps avoid
205 // dormant loads trigger Resource leaks for image loads. 207 // dormant loads trigger Resource leaks for image loads.
206 // 208 //
207 // Consequently, all external image resources must be mocked. 209 // Consequently, all external image resources must be mocked.
208 m_webView->settings()->setLoadsImagesAutomatically(true); 210 m_webView->settings()->setLoadsImagesAutomatically(true);
209 if (updateSettingsFunc) 211 if (updateSettingsFunc)
210 updateSettingsFunc(m_webView->settings()); 212 updateSettingsFunc(m_webView->settings());
211 else 213 else
212 m_webView->settings()->setDeviceSupportsMouse(false); 214 m_webView->settings()->setDeviceSupportsMouse(false);
213 if (m_settingOverrider) 215 if (m_settingOverrider)
214 m_settingOverrider->overrideSettings(m_webView->settings()); 216 m_settingOverrider->overrideSettings(m_webView->settings());
215 m_webView->setDeviceScaleFactor(webViewClient->screenInfo().deviceScaleFacto r); 217 m_webView->setDeviceScaleFactor(webViewClient->screenInfo().deviceScaleFacto r);
216 m_webView->setDefaultPageScaleLimits(1, 4); 218 m_webView->setDefaultPageScaleLimits(1, 4);
217 WebLocalFrame* frame = WebLocalFrameImpl::create(WebTreeScopeType::Document, webFrameClient, opener); 219 WebLocalFrame* frame = WebLocalFrameImpl::create(WebTreeScopeType::Document, webFrameClient, opener);
218 m_webView->setMainFrame(frame); 220 m_webView->setMainFrame(frame);
219 // TODO(dcheng): The main frame widget currently has a special case. 221 // TODO(dcheng): The main frame widget currently has a special case.
220 // Eliminate this once WebView is no longer a WebWidget. 222 // Eliminate this once WebView is no longer a WebWidget.
221 m_webViewWidget = blink::WebFrameWidget::create(webViewClient, m_webView, fr ame); 223 m_webViewWidget = blink::WebFrameWidget::create(webWidgetClient, m_webView, frame);
222 224
223 m_testWebViewClient = webViewClient; 225 m_testWebViewClient = webViewClient;
224 226
225 return m_webView; 227 return m_webView;
226 } 228 }
227 229
228 WebViewImpl* WebViewHelper::initialize(bool enableJavascript, TestWebFrameClient * webFrameClient, TestWebViewClient* webViewClient, void (*updateSettingsFunc)(W ebSettings*)) 230 WebViewImpl* WebViewHelper::initialize(bool enableJavascript, TestWebFrameClient * webFrameClient, TestWebViewClient* webViewClient, TestWebWidgetClient* webWidg etClient, void (*updateSettingsFunc)(WebSettings*))
229 { 231 {
230 return initializeWithOpener(nullptr, enableJavascript, webFrameClient, webVi ewClient, updateSettingsFunc); 232 return initializeWithOpener(nullptr, enableJavascript, webFrameClient, webVi ewClient, webWidgetClient, updateSettingsFunc);
231 } 233 }
232 234
233 WebViewImpl* WebViewHelper::initializeAndLoad(const std::string& url, bool enabl eJavascript, TestWebFrameClient* webFrameClient, TestWebViewClient* webViewClien t, void (*updateSettingsFunc)(WebSettings*)) 235 WebViewImpl* WebViewHelper::initializeAndLoad(const std::string& url, bool enabl eJavascript, TestWebFrameClient* webFrameClient, TestWebViewClient* webViewClien t, TestWebWidgetClient* webWidgetClient, void (*updateSettingsFunc)(WebSettings* ))
234 { 236 {
235 initialize(enableJavascript, webFrameClient, webViewClient, updateSettingsFu nc); 237 initialize(enableJavascript, webFrameClient, webViewClient, webWidgetClient, updateSettingsFunc);
236 238
237 loadFrame(webView()->mainFrame(), url); 239 loadFrame(webView()->mainFrame(), url);
238 240
239 return webViewImpl(); 241 return webViewImpl();
240 } 242 }
241 243
242 void WebViewHelper::reset() 244 void WebViewHelper::reset()
243 { 245 {
244 if (m_webViewWidget) { 246 if (m_webViewWidget) {
245 m_webViewWidget->close(); 247 m_webViewWidget->close();
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
302 m_frame->close(); 304 m_frame->close();
303 } 305 }
304 306
305 void TestWebViewClient::initializeLayerTreeView() 307 void TestWebViewClient::initializeLayerTreeView()
306 { 308 {
307 m_layerTreeView = adoptPtr(new WebLayerTreeViewImplForTesting); 309 m_layerTreeView = adoptPtr(new WebLayerTreeViewImplForTesting);
308 } 310 }
309 311
310 } // namespace FrameTestHelpers 312 } // namespace FrameTestHelpers
311 } // namespace blink 313 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698