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 22 matching lines...) Expand all Loading... | |
33 #include "platform/testing/URLTestHelpers.h" | 33 #include "platform/testing/URLTestHelpers.h" |
34 #include "platform/testing/UnitTestHelpers.h" | 34 #include "platform/testing/UnitTestHelpers.h" |
35 #include "public/platform/Platform.h" | 35 #include "public/platform/Platform.h" |
36 #include "public/platform/WebData.h" | 36 #include "public/platform/WebData.h" |
37 #include "public/platform/WebString.h" | 37 #include "public/platform/WebString.h" |
38 #include "public/platform/WebThread.h" | 38 #include "public/platform/WebThread.h" |
39 #include "public/platform/WebURLRequest.h" | 39 #include "public/platform/WebURLRequest.h" |
40 #include "public/platform/WebURLResponse.h" | 40 #include "public/platform/WebURLResponse.h" |
41 #include "public/platform/WebUnitTestSupport.h" | 41 #include "public/platform/WebUnitTestSupport.h" |
42 #include "public/web/WebFrameWidget.h" | 42 #include "public/web/WebFrameWidget.h" |
43 #include "public/web/WebRemoteFrame.h" | |
43 #include "public/web/WebSettings.h" | 44 #include "public/web/WebSettings.h" |
44 #include "public/web/WebTreeScopeType.h" | 45 #include "public/web/WebTreeScopeType.h" |
45 #include "public/web/WebViewClient.h" | 46 #include "public/web/WebViewClient.h" |
46 #include "web/WebLocalFrameImpl.h" | 47 #include "web/WebLocalFrameImpl.h" |
47 #include "web/WebRemoteFrameImpl.h" | 48 #include "web/WebRemoteFrameImpl.h" |
49 #include "wtf/Assertions.h" | |
48 #include "wtf/StdLibExtras.h" | 50 #include "wtf/StdLibExtras.h" |
49 | 51 |
50 namespace blink { | 52 namespace blink { |
51 namespace FrameTestHelpers { | 53 namespace FrameTestHelpers { |
52 | 54 |
53 namespace { | 55 namespace { |
54 | 56 |
55 // The frame test helpers coordinate frame loads in a carefully choreographed | 57 // The frame test helpers coordinate frame loads in a carefully choreographed |
56 // dance. Since the parser is threaded, simply spinning the run loop once is not | 58 // dance. Since the parser is threaded, simply spinning the run loop once is not |
57 // enough to ensure completion of a load. Instead, the following pattern is | 59 // enough to ensure completion of a load. Instead, the following pattern is |
(...skipping 164 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
222 { | 224 { |
223 Platform::current()->currentThread()->taskRunner()->postTask(BLINK_FROM_HERE , new ReloadTask(frame, true)); | 225 Platform::current()->currentThread()->taskRunner()->postTask(BLINK_FROM_HERE , new ReloadTask(frame, true)); |
224 pumpPendingRequests(frame); | 226 pumpPendingRequests(frame); |
225 } | 227 } |
226 | 228 |
227 void pumpPendingRequestsDoNotUse(WebFrame* frame) | 229 void pumpPendingRequestsDoNotUse(WebFrame* frame) |
228 { | 230 { |
229 pumpPendingRequests(frame); | 231 pumpPendingRequests(frame); |
230 } | 232 } |
231 | 233 |
234 WebLocalFrame* createLocalChild(WebRemoteFrame* parent, const WebString& name, W ebFrameClient* client, WebFrame* previousSibling, const WebFrameOwnerProperties& properties) | |
235 { | |
236 if (!client) | |
237 client = defaultWebFrameClient(); | |
238 | |
239 // |uniqueName| is normally calculated in a somewhat complicated way by | |
dcheng
2016/02/19 21:36:27
I think we should make a nominal effort at uniquen
dcheng
2016/02/19 21:37:02
Also: nit
Change "way by" to "way by the"
Łukasz Anforowicz
2016/02/19 22:10:09
Done.
Łukasz Anforowicz
2016/02/19 22:10:09
Done.
| |
240 // FrameTree class, but for test purposes the approximation below should be | |
241 // close enough. | |
242 ASSERT(!name.isEmpty()); | |
243 WebString uniqueName = name; | |
244 | |
245 return parent->createLocalChild(WebTreeScopeType::Document, name, uniqueName , WebSandboxFlags::None, client, previousSibling, properties); | |
246 } | |
247 | |
232 WebViewHelper::WebViewHelper(SettingOverrider* settingOverrider) | 248 WebViewHelper::WebViewHelper(SettingOverrider* settingOverrider) |
233 : m_webView(nullptr) | 249 : m_webView(nullptr) |
234 , m_webViewWidget(nullptr) | 250 , m_webViewWidget(nullptr) |
235 , m_settingOverrider(settingOverrider) | 251 , m_settingOverrider(settingOverrider) |
236 { | 252 { |
237 } | 253 } |
238 | 254 |
239 WebViewHelper::~WebViewHelper() | 255 WebViewHelper::~WebViewHelper() |
240 { | 256 { |
241 reset(); | 257 reset(); |
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
305 m_testWebViewClient->clearAnimationScheduled(); | 321 m_testWebViewClient->clearAnimationScheduled(); |
306 webViewImpl()->resize(size); | 322 webViewImpl()->resize(size); |
307 EXPECT_FALSE(m_testWebViewClient->animationScheduled()); | 323 EXPECT_FALSE(m_testWebViewClient->animationScheduled()); |
308 m_testWebViewClient->clearAnimationScheduled(); | 324 m_testWebViewClient->clearAnimationScheduled(); |
309 } | 325 } |
310 | 326 |
311 TestWebFrameClient::TestWebFrameClient() : m_loadsInProgress(0) | 327 TestWebFrameClient::TestWebFrameClient() : m_loadsInProgress(0) |
312 { | 328 { |
313 } | 329 } |
314 | 330 |
315 WebFrame* TestWebFrameClient::createChildFrame(WebLocalFrame* parent, WebTreeSco peType scope, const WebString& frameName, WebSandboxFlags sandboxFlags, const We bFrameOwnerProperties& frameOwnerProperties) | 331 WebFrame* TestWebFrameClient::createChildFrame(WebLocalFrame* parent, WebTreeSco peType scope, const WebString& name, const WebString& uniqueName, WebSandboxFlag s sandboxFlags, const WebFrameOwnerProperties& frameOwnerProperties) |
316 { | 332 { |
317 WebFrame* frame = WebLocalFrame::create(scope, this); | 333 WebFrame* frame = WebLocalFrame::create(scope, this); |
318 parent->appendChild(frame); | 334 parent->appendChild(frame); |
319 return frame; | 335 return frame; |
320 } | 336 } |
321 | 337 |
322 void TestWebFrameClient::frameDetached(WebFrame* frame, DetachType type) | 338 void TestWebFrameClient::frameDetached(WebFrame* frame, DetachType type) |
323 { | 339 { |
324 if (type == DetachType::Remove && frame->parent()) | 340 if (type == DetachType::Remove && frame->parent()) |
325 frame->parent()->removeChild(frame); | 341 frame->parent()->removeChild(frame); |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
365 } | 381 } |
366 | 382 |
367 void TestWebViewClient::initializeLayerTreeView() | 383 void TestWebViewClient::initializeLayerTreeView() |
368 { | 384 { |
369 m_layerTreeView = adoptPtr(Platform::current()->unitTestSupport()->createLay erTreeViewForTesting()); | 385 m_layerTreeView = adoptPtr(Platform::current()->unitTestSupport()->createLay erTreeViewForTesting()); |
370 ASSERT(m_layerTreeView); | 386 ASSERT(m_layerTreeView); |
371 } | 387 } |
372 | 388 |
373 } // namespace FrameTestHelpers | 389 } // namespace FrameTestHelpers |
374 } // namespace blink | 390 } // namespace blink |
OLD | NEW |