Add URLSchemeHandler API tests that verify the lack of URLSchemeTask object leaks.
authorbeidson@apple.com <beidson@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Sun, 30 Jul 2017 17:36:26 +0000 (17:36 +0000)
committerbeidson@apple.com <beidson@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Sun, 30 Jul 2017 17:36:26 +0000 (17:36 +0000)
commit4ed29441e682999e155513c54fc8ad867ae24091
tree9780b9b39255c461317044b4310dbf42afc25e8c
parentf1d75cec792c730cde5d85d6fdf6891b2098ea70
Add URLSchemeHandler API tests that verify the lack of URLSchemeTask object leaks.
https://bugs.webkit.org/show_bug.cgi?id=174958

Reviewed by Darin Adler.

Source/WebKit:

* UIProcess/API/APIURLSchemeTask.h:

* UIProcess/API/C/WKTestingSupport.cpp:
(WKGetAPIURLSchemeTaskInstanceCount):
(WKGetWebURLSchemeTaskInstanceCount):
* UIProcess/API/C/WKTestingSupport.h:

* UIProcess/WebURLSchemeTask.h:

* WebKit.xcodeproj/project.pbxproj:

Source/WTF:

This patch adds a new template class "InstanceCounted<T>".

For each specialization, "InstanceCounted" will keep track of the total number of
instances in existence.

This makes explicate leak checking in API tests possible.

Since this adds some runtime and storage overhead the code that actually does anything
is only compiled in debug builds.

* WTF.xcodeproj/project.pbxproj:
* wtf/InstanceCounted.h: Added.
(WTF::InstanceCounted::InstanceCounted):
(WTF::InstanceCounted::instanceCount):
(WTF::InstanceCounted::~InstanceCounted):

Tools:

* TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj:
* TestWebKitAPI/Tests/WebKit2Cocoa/WKURLSchemeHandler-leaks.mm: Added.
(-[LeakSchemeHandler webView:startURLSchemeTask:]):
(-[LeakSchemeHandler webView:stopURLSchemeTask:]):
(runUntilTasksInFlight):
(TEST):

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@220049 268f45cc-cd09-0410-ab3c-d52691b4dbfc
12 files changed:
Source/WTF/ChangeLog
Source/WTF/WTF.xcodeproj/project.pbxproj
Source/WTF/wtf/InstanceCounted.h [new file with mode: 0644]
Source/WebKit/ChangeLog
Source/WebKit/UIProcess/API/APIURLSchemeTask.h
Source/WebKit/UIProcess/API/C/WKTestingSupport.cpp [new file with mode: 0644]
Source/WebKit/UIProcess/API/C/WKTestingSupport.h [new file with mode: 0644]
Source/WebKit/UIProcess/WebURLSchemeTask.h
Source/WebKit/WebKit.xcodeproj/project.pbxproj
Tools/ChangeLog
Tools/TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj
Tools/TestWebKitAPI/Tests/WebKit2Cocoa/WKURLSchemeHandler-leaks.mm [new file with mode: 0644]