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

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

Issue 2165573003: Simplify tests by using Web*Impl types directly. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 5 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 24 matching lines...) Expand all
35 #include "platform/testing/WebLayerTreeViewImplForTesting.h" 35 #include "platform/testing/WebLayerTreeViewImplForTesting.h"
36 #include "public/platform/Platform.h" 36 #include "public/platform/Platform.h"
37 #include "public/platform/WebData.h" 37 #include "public/platform/WebData.h"
38 #include "public/platform/WebSecurityOrigin.h" 38 #include "public/platform/WebSecurityOrigin.h"
39 #include "public/platform/WebString.h" 39 #include "public/platform/WebString.h"
40 #include "public/platform/WebThread.h" 40 #include "public/platform/WebThread.h"
41 #include "public/platform/WebURLLoaderMockFactory.h" 41 #include "public/platform/WebURLLoaderMockFactory.h"
42 #include "public/platform/WebURLRequest.h" 42 #include "public/platform/WebURLRequest.h"
43 #include "public/platform/WebURLResponse.h" 43 #include "public/platform/WebURLResponse.h"
44 #include "public/web/WebFrameWidget.h" 44 #include "public/web/WebFrameWidget.h"
45 #include "public/web/WebRemoteFrame.h"
46 #include "public/web/WebSettings.h" 45 #include "public/web/WebSettings.h"
47 #include "public/web/WebTreeScopeType.h" 46 #include "public/web/WebTreeScopeType.h"
48 #include "public/web/WebViewClient.h" 47 #include "public/web/WebViewClient.h"
49 #include "web/WebLocalFrameImpl.h" 48 #include "web/WebLocalFrameImpl.h"
50 #include "web/WebRemoteFrameImpl.h" 49 #include "web/WebRemoteFrameImpl.h"
51 #include "wtf/Functional.h" 50 #include "wtf/Functional.h"
52 #include "wtf/PtrUtil.h" 51 #include "wtf/PtrUtil.h"
53 #include "wtf/StdLibExtras.h" 52 #include "wtf/StdLibExtras.h"
54 #include "wtf/text/StringBuilder.h" 53 #include "wtf/text/StringBuilder.h"
55 54
(...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after
165 WebMouseEvent result; 164 WebMouseEvent result;
166 result.type = type; 165 result.type = type;
167 result.x = result.windowX = result.globalX = point.x(); 166 result.x = result.windowX = result.globalX = point.x();
168 result.y = result.windowX = result.globalX = point.y(); 167 result.y = result.windowX = result.globalX = point.y();
169 result.modifiers = modifiers; 168 result.modifiers = modifiers;
170 result.button = button; 169 result.button = button;
171 result.clickCount = 1; 170 result.clickCount = 1;
172 return result; 171 return result;
173 } 172 }
174 173
175 WebLocalFrame* createLocalChild(WebRemoteFrame* parent, const WebString& name, W ebFrameClient* client, WebWidgetClient* widgetClient, WebFrame* previousSibling, const WebFrameOwnerProperties& properties) 174 WebLocalFrameImpl* createLocalChild(WebRemoteFrame* parent, const WebString& nam e, WebFrameClient* client, WebWidgetClient* widgetClient, WebFrame* previousSibl ing, const WebFrameOwnerProperties& properties)
176 { 175 {
177 if (!client) 176 if (!client)
178 client = defaultWebFrameClient(); 177 client = defaultWebFrameClient();
179 178
180 WebLocalFrame* frame = parent->createLocalChild(WebTreeScopeType::Document, name, nameToUniqueName(name), WebSandboxFlags::None, client, previousSibling, pr operties, nullptr); 179 WebLocalFrameImpl* frame = toWebLocalFrameImpl(parent->createLocalChild(WebT reeScopeType::Document, name, nameToUniqueName(name), WebSandboxFlags::None, cli ent, previousSibling, properties, nullptr));
181 180
182 if (!widgetClient) 181 if (!widgetClient)
183 widgetClient = defaultWebWidgetClient(); 182 widgetClient = defaultWebWidgetClient();
184 WebFrameWidget::create(widgetClient, frame); 183 WebFrameWidget::create(widgetClient, frame);
185 184
186 return frame; 185 return frame;
187 } 186 }
188 187
189 WebRemoteFrame* createRemoteChild(WebRemoteFrame* parent, WebRemoteFrameClient* client, const WebString& name) 188 WebRemoteFrameImpl* createRemoteChild(WebRemoteFrame* parent, WebRemoteFrameClie nt* client, const WebString& name)
190 { 189 {
191 return parent->createRemoteChild(WebTreeScopeType::Document, name, nameToUni queName(name), WebSandboxFlags::None, client, nullptr); 190 return toWebRemoteFrameImpl(parent->createRemoteChild(WebTreeScopeType::Docu ment, name, nameToUniqueName(name), WebSandboxFlags::None, client, nullptr));
192 } 191 }
193 192
194 void DefaultSettingOverride(WebSettings*) 193 void DefaultSettingOverride(WebSettings*)
195 { 194 {
196 } 195 }
197 196
198 void RootLayerScrollsSettingOverride(WebSettings *settings) 197 void RootLayerScrollsSettingOverride(WebSettings *settings)
199 { 198 {
200 settings->setRootLayerScrolls(true); 199 settings->setRootLayerScrolls(true);
201 } 200 }
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after
253 { 252 {
254 return initializeWithOpener(nullptr, enableJavascript, webFrameClient, webVi ewClient, webWidgetClient, updateSettingsFunc); 253 return initializeWithOpener(nullptr, enableJavascript, webFrameClient, webVi ewClient, webWidgetClient, updateSettingsFunc);
255 } 254 }
256 255
257 WebViewImpl* WebViewHelper::initializeAndLoad(const std::string& url, bool enabl eJavascript, TestWebFrameClient* webFrameClient, TestWebViewClient* webViewClien t, TestWebWidgetClient* webWidgetClient, void (*updateSettingsFunc)(WebSettings* )) 256 WebViewImpl* WebViewHelper::initializeAndLoad(const std::string& url, bool enabl eJavascript, TestWebFrameClient* webFrameClient, TestWebViewClient* webViewClien t, TestWebWidgetClient* webWidgetClient, void (*updateSettingsFunc)(WebSettings* ))
258 { 257 {
259 initialize(enableJavascript, webFrameClient, webViewClient, webWidgetClient, updateSettingsFunc); 258 initialize(enableJavascript, webFrameClient, webViewClient, webWidgetClient, updateSettingsFunc);
260 259
261 loadFrame(webView()->mainFrame(), url); 260 loadFrame(webView()->mainFrame(), url);
262 261
263 return webViewImpl(); 262 return webView();
264 } 263 }
265 264
266 void WebViewHelper::reset() 265 void WebViewHelper::reset()
267 { 266 {
268 if (m_webView) { 267 if (m_webView) {
269 DCHECK(m_webView->mainFrame()->isWebRemoteFrame() || !testClientForFrame (m_webView->mainFrame())->isLoading()); 268 DCHECK(m_webView->mainFrame()->isWebRemoteFrame() || !testClientForFrame (m_webView->mainFrame())->isLoading());
270 m_webView->willCloseLayerTreeView(); 269 m_webView->willCloseLayerTreeView();
271 m_webView->close(); 270 m_webView->close();
272 m_webView = nullptr; 271 m_webView = nullptr;
273 } 272 }
274 } 273 }
275 274
276 void WebViewHelper::resize(WebSize size) 275 void WebViewHelper::resize(WebSize size)
277 { 276 {
278 m_testWebViewClient->clearAnimationScheduled(); 277 m_testWebViewClient->clearAnimationScheduled();
279 webViewImpl()->resize(size); 278 webView()->resize(size);
280 EXPECT_FALSE(m_testWebViewClient->animationScheduled()); 279 EXPECT_FALSE(m_testWebViewClient->animationScheduled());
281 m_testWebViewClient->clearAnimationScheduled(); 280 m_testWebViewClient->clearAnimationScheduled();
282 } 281 }
283 282
284 TestWebFrameClient::TestWebFrameClient() 283 TestWebFrameClient::TestWebFrameClient()
285 { 284 {
286 } 285 }
287 286
288 WebFrame* TestWebFrameClient::createChildFrame(WebLocalFrame* parent, WebTreeSco peType scope, const WebString& name, const WebString& uniqueName, WebSandboxFlag s sandboxFlags, const WebFrameOwnerProperties& frameOwnerProperties) 287 WebFrame* TestWebFrameClient::createChildFrame(WebLocalFrame* parent, WebTreeSco peType scope, const WebString& name, const WebString& uniqueName, WebSandboxFlag s sandboxFlags, const WebFrameOwnerProperties& frameOwnerProperties)
289 { 288 {
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
346 m_testWebViewClient->scheduleAnimation(); 345 m_testWebViewClient->scheduleAnimation();
347 } 346 }
348 347
349 void TestWebViewWidgetClient::didMeaningfulLayout(WebMeaningfulLayout layoutType ) 348 void TestWebViewWidgetClient::didMeaningfulLayout(WebMeaningfulLayout layoutType )
350 { 349 {
351 m_testWebViewClient->didMeaningfulLayout(layoutType); 350 m_testWebViewClient->didMeaningfulLayout(layoutType);
352 } 351 }
353 352
354 } // namespace FrameTestHelpers 353 } // namespace FrameTestHelpers
355 } // namespace blink 354 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698