[WebEditingTester] Add a custom protocol for loading canned content
authortimothy_horton@apple.com <timothy_horton@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 20 Feb 2015 20:02:39 +0000 (20:02 +0000)
committertimothy_horton@apple.com <timothy_horton@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 20 Feb 2015 20:02:39 +0000 (20:02 +0000)
commitf2da13061dcc83716d189f341f465fa49688ae26
treeba352be41721d15b691a2c3693baabbebc560b17
parent44006f4a43c6dce7f79d4b160f3e478583461933
[WebEditingTester] Add a custom protocol for loading canned content
https://bugs.webkit.org/show_bug.cgi?id=141830

Reviewed by Enrica Casucci.

Add a canned:// protocol handler, which can be used to emulate behaviors
in WebKit client apps (like Mail) that use custom protocol handlers,
which can have important effects on editing (mostly, the URLs are only
valid inside of the client application, but not when copied/dragged out).

For now, we only support two canned files:

canned://dice is a PNG of dice (stolen from LayoutTests/)
canned://text is the string "canned text" served as text/html

In the future we could support things like very large (generated) files,
progressive loading, etc. to further simulate conditions in other apps.

* WebEditingTester/AppDelegate.m:
(-[WebEditingAppDelegate applicationDidFinishLaunching:]):
Register the protocol with CFNetwork, and the scheme with WebKit2.

* WebEditingTester/Canned Content/dice.png: Added.
* WebEditingTester/CannedContent.h: Added.
* WebEditingTester/CannedContent.m: Added.
(-[CannedContent initWithRequest:cachedResponse:client:]):
(+[CannedContent canonicalRequestForRequest:]):
(+[CannedContent canInitWithRequest:]):
We only want to handle canned:// URLs.

(-[CannedContent startLoading]):
For now, immediately load the two files we know about.
Otherwise, immediately fail the load.

(-[CannedContent stopLoading]):
* WebEditingTester/WebEditingTester.xcodeproj/project.pbxproj:

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@180439 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Tools/ChangeLog
Tools/WebEditingTester/AppDelegate.m
Tools/WebEditingTester/Canned Content/dice.png [new file with mode: 0644]
Tools/WebEditingTester/CannedContent.h [new file with mode: 0644]
Tools/WebEditingTester/CannedContent.m [new file with mode: 0644]
Tools/WebEditingTester/WebEditingTester.xcodeproj/project.pbxproj