Changeset 238921 in webkit
- Timestamp:
- Dec 5, 2018 7:09:29 PM (5 years ago)
- Location:
- trunk/Tools
- Files:
-
- 11 edited
- 4 moved
Legend:
- Unmodified
- Added
- Removed
-
trunk/Tools/ChangeLog
r238910 r238921 1 2018-12-05 Wenson Hsieh <wenson_hsieh@apple.com> 2 3 [Cocoa] Share ClassMethodSwizzler and InstanceMethodSwizzler between TestWebKitAPI and WebKitTestRunner 4 https://bugs.webkit.org/show_bug.cgi?id=192437 5 6 Reviewed by Tim Horton. 7 8 * DumpRenderTree/DumpRenderTree.xcodeproj/project.pbxproj: 9 * TestRunnerShared/cocoa/ClassMethodSwizzler.h: Renamed from Tools/TestWebKitAPI/ClassMethodSwizzler.h. 10 * TestRunnerShared/cocoa/ClassMethodSwizzler.mm: Renamed from Tools/TestWebKitAPI/ClassMethodSwizzler.mm. 11 (ClassMethodSwizzler::ClassMethodSwizzler): 12 (ClassMethodSwizzler::~ClassMethodSwizzler): 13 * TestRunnerShared/cocoa/InstanceMethodSwizzler.h: Renamed from Tools/TestWebKitAPI/cocoa/InstanceMethodSwizzler.h. 14 * TestRunnerShared/cocoa/InstanceMethodSwizzler.mm: Renamed from Tools/TestWebKitAPI/cocoa/InstanceMethodSwizzler.mm. 15 (InstanceMethodSwizzler::InstanceMethodSwizzler): 16 (InstanceMethodSwizzler::~InstanceMethodSwizzler): 17 18 Move these swizzling helper classes into TestRunnerShared. 19 20 * TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj: 21 * TestWebKitAPI/Tests/WebKitCocoa/LocalStorageClear.mm: 22 * TestWebKitAPI/Tests/WebKitCocoa/SafeBrowsing.mm: 23 (safeBrowsingView): 24 * TestWebKitAPI/Tests/WebKitCocoa/WKWebViewDefaultNavigationDelegate.mm: 25 * TestWebKitAPI/cocoa/TestWKWebView.mm: 26 (-[TestWKWebView initWithFrame:configuration:addToWindow:]): 27 28 Remove namespacing around ClassMethodSwizzler and InstanceMethodSwizzler in a few API tests. 29 30 * TestWebKitAPI/mac/TestFontOptions.mm: 31 * WebKitTestRunner/TestController.h: 32 * WebKitTestRunner/WebKitTestRunner.xcodeproj/project.pbxproj: 33 * WebKitTestRunner/cocoa/TestControllerCocoa.mm: 34 (WTR::ClassMethodSwizzler::ClassMethodSwizzler): Deleted. 35 (WTR::ClassMethodSwizzler::~ClassMethodSwizzler): Deleted. 36 37 Remove this duplicate implementation of ClassMethodSwizzler in WebKitTestRunner. 38 1 39 2018-12-05 Jonathan Bedard <jbedard@apple.com> 2 40 -
trunk/Tools/DumpRenderTree/DumpRenderTree.xcodeproj/project.pbxproj
r238219 r238921 148 148 C23EA2091BC9F05100C980B7 /* FontWithFeatures.ttf in Copy Font Files */ = {isa = PBXBuildFile; fileRef = C23EA2071BC9EABA00C980B7 /* FontWithFeatures.ttf */; }; 149 149 E1B7816511AF31B7007E1BC2 /* MockGeolocationProvider.mm in Sources */ = {isa = PBXBuildFile; fileRef = E1B7808711AF1669007E1BC2 /* MockGeolocationProvider.mm */; }; 150 F44A531D21B89A4D00DBB99C /* ClassMethodSwizzler.mm in Sources */ = {isa = PBXBuildFile; fileRef = F44A531A21B89A4400DBB99C /* ClassMethodSwizzler.mm */; }; 151 F44A531E21B89A5000DBB99C /* InstanceMethodSwizzler.mm in Sources */ = {isa = PBXBuildFile; fileRef = F44A531C21B89A4500DBB99C /* InstanceMethodSwizzler.mm */; }; 150 152 F4C3578D20E8444E00FA0748 /* LayoutTestSpellChecker.mm in Sources */ = {isa = PBXBuildFile; fileRef = F4C3578820E8442700FA0748 /* LayoutTestSpellChecker.mm */; }; 151 153 F4D423611DD5048200678290 /* TextInputControllerIOS.m in Sources */ = {isa = PBXBuildFile; fileRef = F4D4235F1DD5045300678290 /* TextInputControllerIOS.m */; }; … … 410 412 E1B7808511AF1643007E1BC2 /* MockGeolocationProvider.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = MockGeolocationProvider.h; path = mac/MockGeolocationProvider.h; sourceTree = "<group>"; }; 411 413 E1B7808711AF1669007E1BC2 /* MockGeolocationProvider.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; name = MockGeolocationProvider.mm; path = mac/MockGeolocationProvider.mm; sourceTree = "<group>"; }; 414 F44A531921B89A4400DBB99C /* InstanceMethodSwizzler.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = InstanceMethodSwizzler.h; path = ../TestRunnerShared/cocoa/InstanceMethodSwizzler.h; sourceTree = "<group>"; }; 415 F44A531A21B89A4400DBB99C /* ClassMethodSwizzler.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; name = ClassMethodSwizzler.mm; path = ../TestRunnerShared/cocoa/ClassMethodSwizzler.mm; sourceTree = "<group>"; }; 416 F44A531B21B89A4400DBB99C /* ClassMethodSwizzler.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = ClassMethodSwizzler.h; path = ../TestRunnerShared/cocoa/ClassMethodSwizzler.h; sourceTree = "<group>"; }; 417 F44A531C21B89A4500DBB99C /* InstanceMethodSwizzler.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; name = InstanceMethodSwizzler.mm; path = ../TestRunnerShared/cocoa/InstanceMethodSwizzler.mm; sourceTree = "<group>"; }; 412 418 F4C3578820E8442700FA0748 /* LayoutTestSpellChecker.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; name = LayoutTestSpellChecker.mm; path = ../TestRunnerShared/cocoa/LayoutTestSpellChecker.mm; sourceTree = "<group>"; }; 413 419 F4C3578920E8442700FA0748 /* LayoutTestSpellChecker.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = LayoutTestSpellChecker.h; path = ../TestRunnerShared/cocoa/LayoutTestSpellChecker.h; sourceTree = "<group>"; }; … … 818 824 isa = PBXGroup; 819 825 children = ( 826 F44A531B21B89A4400DBB99C /* ClassMethodSwizzler.h */, 827 F44A531A21B89A4400DBB99C /* ClassMethodSwizzler.mm */, 828 F44A531921B89A4400DBB99C /* InstanceMethodSwizzler.h */, 829 F44A531C21B89A4500DBB99C /* InstanceMethodSwizzler.mm */, 820 830 F4C3578920E8442700FA0748 /* LayoutTestSpellChecker.h */, 821 831 F4C3578820E8442700FA0748 /* LayoutTestSpellChecker.mm */, … … 1076 1086 BC0E26150E2DA4C6001B6BC2 /* AccessibilityUIElementMac.mm in Sources */, 1077 1087 BCA18B390C9B021900114369 /* AppleScriptController.m in Sources */, 1088 F44A531D21B89A4D00DBB99C /* ClassMethodSwizzler.mm in Sources */, 1078 1089 53CBB832134E42F3001CE6A4 /* CyclicRedundancyCheck.cpp in Sources */, 1079 1090 1A2FB84F178C80930059FD96 /* DefaultPolicyDelegate.m in Sources */, … … 1091 1102 BCA18B230C9B014B00114369 /* GCControllerMac.mm in Sources */, 1092 1103 5185F6B210714E07007AA393 /* HistoryDelegate.mm in Sources */, 1104 F44A531E21B89A5000DBB99C /* InstanceMethodSwizzler.mm in Sources */, 1093 1105 312943F91E71F2B4001EE2CC /* IOSLayoutTestCommunication.cpp in Sources */, 1094 1106 2CE88FA217124D8C00734FC0 /* JavaScriptThreading.cpp in Sources */, -
trunk/Tools/TestRunnerShared/cocoa/ClassMethodSwizzler.h
r238920 r238921 29 29 #include <wtf/Noncopyable.h> 30 30 31 namespace TestWebKitAPI {32 33 31 class ClassMethodSwizzler { 34 32 WTF_MAKE_NONCOPYABLE(ClassMethodSwizzler); … … 40 38 IMP m_originalImplementation; 41 39 }; 42 43 } // namespace TestWebKitAPI -
trunk/Tools/TestRunnerShared/cocoa/ClassMethodSwizzler.mm
r238920 r238921 27 27 #import "ClassMethodSwizzler.h" 28 28 29 namespace TestWebKitAPI {30 31 29 ClassMethodSwizzler::ClassMethodSwizzler(Class cls, SEL originalSelector, IMP implementation) 32 30 : m_method(class_getClassMethod(objc_getMetaClass(NSStringFromClass(cls).UTF8String), originalSelector)) … … 39 37 method_setImplementation(m_method, m_originalImplementation); 40 38 } 41 42 } // namespace TestWebKitAPI -
trunk/Tools/TestRunnerShared/cocoa/InstanceMethodSwizzler.h
r238920 r238921 1 1 /* 2 * Copyright (C) 2011 Apple Inc. All rights reserved.2 * Copyright (C) 2011-2018 Apple Inc. All rights reserved. 3 3 * 4 4 * Redistribution and use in source and binary forms, with or without … … 24 24 */ 25 25 26 #ifndef InstanceMethodSwizzler_h 27 #define InstanceMethodSwizzler_h 26 #pragma once 28 27 29 28 #include <objc/runtime.h> 30 29 #include <wtf/Noncopyable.h> 31 32 namespace TestWebKitAPI {33 30 34 31 class InstanceMethodSwizzler { … … 41 38 IMP m_originalImplementation; 42 39 }; 43 44 } // namespace TestWebKitAPI45 46 #endif // InstanceMethodSwizzler_h -
trunk/Tools/TestRunnerShared/cocoa/InstanceMethodSwizzler.mm
r238920 r238921 1 1 /* 2 * Copyright (C) 2011 Apple Inc. All rights reserved.2 * Copyright (C) 2011-2018 Apple Inc. All rights reserved. 3 3 * 4 4 * Redistribution and use in source and binary forms, with or without … … 27 27 #include "InstanceMethodSwizzler.h" 28 28 29 namespace TestWebKitAPI {30 31 29 InstanceMethodSwizzler::InstanceMethodSwizzler(Class cls, SEL selector, IMP implementation) 32 30 : m_method(class_getInstanceMethod(cls, selector)) … … 39 37 method_setImplementation(m_method, m_originalImplementation); 40 38 } 41 42 } // namespace TestWebKitAPI -
trunk/Tools/TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj
r238828 r238921 288 288 5C69BDD51F82A7EF000F4F4B /* JavaScriptDuringNavigation.mm in Sources */ = {isa = PBXBuildFile; fileRef = 5C69BDD41F82A7EB000F4F4B /* JavaScriptDuringNavigation.mm */; }; 289 289 5C7148952123A40A00FDE3C5 /* WKWebsiteDatastore.mm in Sources */ = {isa = PBXBuildFile; fileRef = 5C7148942123A40700FDE3C5 /* WKWebsiteDatastore.mm */; }; 290 5C726D6F1D3EE06E00C5E1A1 /* InstanceMethodSwizzler.mm in Sources */ = {isa = PBXBuildFile; fileRef = 5C726D6E1D3EE06800C5E1A1 /* InstanceMethodSwizzler.mm */; };291 290 5C7964101EB0278D0075D74C /* EventModifiers.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 5C79640F1EB0269B0075D74C /* EventModifiers.cpp */; }; 292 291 5C7C74CB1FB529BA002F9ABE /* WebViewScheduleInRunLoop.mm in Sources */ = {isa = PBXBuildFile; fileRef = 5C7C74CA1FB528D4002F9ABE /* WebViewScheduleInRunLoop.mm */; }; … … 829 828 F442851D2140DF2900CCDA22 /* NSFontPanelTesting.mm in Sources */ = {isa = PBXBuildFile; fileRef = F442851C2140DF2900CCDA22 /* NSFontPanelTesting.mm */; }; 830 829 F4451C761EB8FD890020C5DA /* two-paragraph-contenteditable.html in Copy Resources */ = {isa = PBXBuildFile; fileRef = F4451C751EB8FD7C0020C5DA /* two-paragraph-contenteditable.html */; }; 830 F44A531121B8990300DBB99C /* InstanceMethodSwizzler.mm in Sources */ = {isa = PBXBuildFile; fileRef = F44A531021B8976900DBB99C /* InstanceMethodSwizzler.mm */; }; 831 F44A531221B8990A00DBB99C /* ClassMethodSwizzler.mm in Sources */ = {isa = PBXBuildFile; fileRef = F44A530E21B8976900DBB99C /* ClassMethodSwizzler.mm */; }; 831 832 F44C79FF20F9E8710014478C /* ParserYieldTokenTests.mm in Sources */ = {isa = PBXBuildFile; fileRef = F44C79FE20F9E8710014478C /* ParserYieldTokenTests.mm */; }; 832 833 F44C7A0020F9EEBF0014478C /* ParserYieldTokenPlugIn.mm in Sources */ = {isa = PBXBuildFile; fileRef = F44C79FB20F9E50C0014478C /* ParserYieldTokenPlugIn.mm */; }; … … 838 839 F4512E131F60C44600BB369E /* DataTransferItem-getAsEntry.html in Copy Resources */ = {isa = PBXBuildFile; fileRef = F4512E121F60C43400BB369E /* DataTransferItem-getAsEntry.html */; }; 839 840 F4517B672054C49500C26721 /* TestWKWebViewController.mm in Sources */ = {isa = PBXBuildFile; fileRef = F4517B662054C49500C26721 /* TestWKWebViewController.mm */; }; 840 F4517B7F2055101B00C26721 /* ClassMethodSwizzler.mm in Sources */ = {isa = PBXBuildFile; fileRef = F4517B692054E0AC00C26721 /* ClassMethodSwizzler.mm */; };841 841 F4538EF71E8473E600B5C953 /* large-red-square.png in Copy Resources */ = {isa = PBXBuildFile; fileRef = F4538EF01E846B4100B5C953 /* large-red-square.png */; }; 842 842 F456AB1C213EDBA300CB2CEF /* FontManagerTests.mm in Sources */ = {isa = PBXBuildFile; fileRef = F456AB1B213EDBA300CB2CEF /* FontManagerTests.mm */; }; … … 1631 1631 5C69BDD41F82A7EB000F4F4B /* JavaScriptDuringNavigation.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = JavaScriptDuringNavigation.mm; sourceTree = "<group>"; }; 1632 1632 5C7148942123A40700FDE3C5 /* WKWebsiteDatastore.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = WKWebsiteDatastore.mm; sourceTree = "<group>"; }; 1633 5C726D6D1D3EE06800C5E1A1 /* InstanceMethodSwizzler.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = InstanceMethodSwizzler.h; path = cocoa/InstanceMethodSwizzler.h; sourceTree = "<group>"; };1634 5C726D6E1D3EE06800C5E1A1 /* InstanceMethodSwizzler.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; name = InstanceMethodSwizzler.mm; path = cocoa/InstanceMethodSwizzler.mm; sourceTree = "<group>"; };1635 1633 5C79640F1EB0269B0075D74C /* EventModifiers.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = EventModifiers.cpp; sourceTree = "<group>"; }; 1636 1634 5C7C74CA1FB528D4002F9ABE /* WebViewScheduleInRunLoop.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = WebViewScheduleInRunLoop.mm; sourceTree = "<group>"; }; … … 2126 2124 F442851C2140DF2900CCDA22 /* NSFontPanelTesting.mm */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.objcpp; path = NSFontPanelTesting.mm; sourceTree = "<group>"; }; 2127 2125 F4451C751EB8FD7C0020C5DA /* two-paragraph-contenteditable.html */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.html; path = "two-paragraph-contenteditable.html"; sourceTree = "<group>"; }; 2126 F44A530D21B8976900DBB99C /* InstanceMethodSwizzler.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = InstanceMethodSwizzler.h; path = ../TestRunnerShared/cocoa/InstanceMethodSwizzler.h; sourceTree = "<group>"; }; 2127 F44A530E21B8976900DBB99C /* ClassMethodSwizzler.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; name = ClassMethodSwizzler.mm; path = ../TestRunnerShared/cocoa/ClassMethodSwizzler.mm; sourceTree = "<group>"; }; 2128 F44A530F21B8976900DBB99C /* ClassMethodSwizzler.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = ClassMethodSwizzler.h; path = ../TestRunnerShared/cocoa/ClassMethodSwizzler.h; sourceTree = "<group>"; }; 2129 F44A531021B8976900DBB99C /* InstanceMethodSwizzler.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; name = InstanceMethodSwizzler.mm; path = ../TestRunnerShared/cocoa/InstanceMethodSwizzler.mm; sourceTree = "<group>"; }; 2128 2130 F44C79FB20F9E50C0014478C /* ParserYieldTokenPlugIn.mm */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.objcpp; path = ParserYieldTokenPlugIn.mm; sourceTree = "<group>"; }; 2129 2131 F44C79FD20F9E8710014478C /* ParserYieldTokenTests.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = ParserYieldTokenTests.h; sourceTree = "<group>"; }; … … 2138 2140 F4517B652054C49500C26721 /* TestWKWebViewController.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = TestWKWebViewController.h; sourceTree = "<group>"; }; 2139 2141 F4517B662054C49500C26721 /* TestWKWebViewController.mm */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.objcpp; path = TestWKWebViewController.mm; sourceTree = "<group>"; }; 2140 F4517B682054E0AC00C26721 /* ClassMethodSwizzler.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = ClassMethodSwizzler.h; sourceTree = "<group>"; };2141 F4517B692054E0AC00C26721 /* ClassMethodSwizzler.mm */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.objcpp; path = ClassMethodSwizzler.mm; sourceTree = "<group>"; };2142 2142 F4538EF01E846B4100B5C953 /* large-red-square.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "large-red-square.png"; sourceTree = "<group>"; }; 2143 2143 F456AB1B213EDBA300CB2CEF /* FontManagerTests.mm */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.objcpp; path = FontManagerTests.mm; sourceTree = "<group>"; }; … … 2330 2330 children = ( 2331 2331 A13EBB441B87332B00097110 /* WebProcessPlugIn */, 2332 F4 517B682054E0AC00C26721/* ClassMethodSwizzler.h */,2333 F4 517B692054E0AC00C26721/* ClassMethodSwizzler.mm */,2332 F44A530F21B8976900DBB99C /* ClassMethodSwizzler.h */, 2333 F44A530E21B8976900DBB99C /* ClassMethodSwizzler.mm */, 2334 2334 F47DFB2721A885E700021FB6 /* DataDetectorsCoreSPI.h */, 2335 2335 F46128B4211C861A00D9FADB /* DragAndDropSimulator.h */, 2336 2336 F44D06481F3962E3001A0E29 /* EditingTestHarness.h */, 2337 2337 F44D06491F3962E3001A0E29 /* EditingTestHarness.mm */, 2338 5C726D6D1D3EE06800C5E1A1/* InstanceMethodSwizzler.h */,2339 5C726D6E1D3EE06800C5E1A1/* InstanceMethodSwizzler.mm */,2338 F44A530D21B8976900DBB99C /* InstanceMethodSwizzler.h */, 2339 F44A531021B8976900DBB99C /* InstanceMethodSwizzler.mm */, 2340 2340 0F139E721A423A2B00F590F5 /* PlatformUtilitiesCocoa.mm */, 2341 2341 2D1C04A51D76298B000A6816 /* TestNavigationDelegate.h */, … … 3845 3845 57303BC9200824D300355965 /* CBORValueTest.cpp in Sources */, 3846 3846 57303BCA20082C0100355965 /* CBORWriterTest.cpp in Sources */, 3847 F4 517B7F2055101B00C26721/* ClassMethodSwizzler.mm in Sources */,3847 F44A531221B8990A00DBB99C /* ClassMethodSwizzler.mm in Sources */, 3848 3848 7CCE7EE61A411AE600447C4C /* CloseFromWithinCreatePage.cpp in Sources */, 3849 3849 7CCE7EB71A411A7E00447C4C /* CloseNewWindowInNavigationPolicyDelegate.mm in Sources */, … … 3988 3988 7C83E0B81D0A64BD00FEBCF3 /* InjectedBundleMakeAllShadowRootsOpen.cpp in Sources */, 3989 3989 7CCE7EC31A411A7E00447C4C /* InspectorBar.mm in Sources */, 3990 F44A531121B8990300DBB99C /* InstanceMethodSwizzler.mm in Sources */, 3990 3991 7CCE7EDA1A411A8700447C4C /* InstanceMethodSwizzler.mm in Sources */, 3991 5C726D6F1D3EE06E00C5E1A1 /* InstanceMethodSwizzler.mm in Sources */,3992 3992 2DB0232F1E4E871800707123 /* InteractionDeadlockAfterCrash.mm in Sources */, 3993 3993 7A909A811D877480007E10F8 /* IntPoint.cpp in Sources */, -
trunk/Tools/TestWebKitAPI/Tests/WebKitCocoa/LocalStorageClear.mm
r237266 r238921 131 131 #if PLATFORM(IOS_FAMILY) 132 132 // On iOS, MobileSafari and webbookmarksd need to share the same AppCache directory. 133 TestWebKitAPI::InstanceMethodSwizzler swizzle([NSBundle class], @selector(bundleIdentifier), reinterpret_cast<IMP>(swizzledBundleIdentifierWebBookmarksD));133 InstanceMethodSwizzler swizzle([NSBundle class], @selector(bundleIdentifier), reinterpret_cast<IMP>(swizzledBundleIdentifierWebBookmarksD)); 134 134 #endif 135 135 -
trunk/Tools/TestWebKitAPI/Tests/WebKitCocoa/SafeBrowsing.mm
r238641 r238921 146 146 TEST(SafeBrowsing, Preference) 147 147 { 148 TestWebKitAPI::ClassMethodSwizzler swizzler(objc_getClass("SSBLookupContext"), @selector(sharedLookupContext), [TestLookupContext methodForSelector:@selector(sharedLookupContext)]);148 ClassMethodSwizzler swizzler(objc_getClass("SSBLookupContext"), @selector(sharedLookupContext), [TestLookupContext methodForSelector:@selector(sharedLookupContext)]); 149 149 150 150 __block bool done = false; … … 169 169 static RetainPtr<WKWebView> safeBrowsingView() 170 170 { 171 TestWebKitAPI::ClassMethodSwizzler swizzler(objc_getClass("SSBLookupContext"), @selector(sharedLookupContext), [TestLookupContext methodForSelector:@selector(sharedLookupContext)]);171 ClassMethodSwizzler swizzler(objc_getClass("SSBLookupContext"), @selector(sharedLookupContext), [TestLookupContext methodForSelector:@selector(sharedLookupContext)]); 172 172 173 173 static auto delegate = adoptNS([SafeBrowsingNavigationDelegate new]); … … 270 270 TEST(SafeBrowsing, MissingFramework) 271 271 { 272 TestWebKitAPI::ClassMethodSwizzler swizzler(objc_getClass("SSBLookupContext"), @selector(sharedLookupContext), [NullLookupContext methodForSelector:@selector(sharedLookupContext)]);272 ClassMethodSwizzler swizzler(objc_getClass("SSBLookupContext"), @selector(sharedLookupContext), [NullLookupContext methodForSelector:@selector(sharedLookupContext)]); 273 273 auto webView = adoptNS([[TestWKWebView alloc] initWithFrame:CGRectMake(0, 0, 800, 600)]); 274 274 [webView synchronouslyLoadTestPageNamed:@"simple"]; -
trunk/Tools/TestWebKitAPI/Tests/WebKitCocoa/WKWebViewDefaultNavigationDelegate.mm
r202329 r238921 46 46 TEST(WKWebView, DefaultNavigationDelegate) 47 47 { 48 TestWebKitAPI::InstanceMethodSwizzler swizzle([NSWorkspace class], @selector(openURL:), reinterpret_cast<IMP>(newOpenURL));48 InstanceMethodSwizzler swizzle([NSWorkspace class], @selector(openURL:), reinterpret_cast<IMP>(newOpenURL)); 49 49 50 50 WKWebView *webView = [[WKWebView alloc] initWithFrame:NSMakeRect(0, 0, 800, 600)]; -
trunk/Tools/TestWebKitAPI/cocoa/TestWKWebView.mm
r238471 r238921 254 254 RetainPtr<TestMessageHandler> _testHandler; 255 255 #if PLATFORM(IOS_FAMILY) 256 std::unique_ptr< TestWebKitAPI::ClassMethodSwizzler> _sharedCalloutBarSwizzler;256 std::unique_ptr<ClassMethodSwizzler> _sharedCalloutBarSwizzler; 257 257 #endif 258 258 } … … 289 289 #if PLATFORM(IOS_FAMILY) 290 290 // FIXME: Remove this workaround once <https://webkit.org/b/175204> is fixed. 291 _sharedCalloutBarSwizzler = std::make_unique< TestWebKitAPI::ClassMethodSwizzler>([UICalloutBar class], @selector(sharedCalloutBar), reinterpret_cast<IMP>(suppressUICalloutBar));291 _sharedCalloutBarSwizzler = std::make_unique<ClassMethodSwizzler>([UICalloutBar class], @selector(sharedCalloutBar), reinterpret_cast<IMP>(suppressUICalloutBar)); 292 292 #endif 293 293 -
trunk/Tools/TestWebKitAPI/mac/TestFontOptions.mm
r236854 r238921 35 35 #import <wtf/SetForScope.h> 36 36 37 using namespace TestWebKitAPI;38 39 37 static TestFontOptions *sharedFontOptionsForTesting() 40 38 { -
trunk/Tools/WebKitTestRunner/TestController.h
r238512 r238921 40 40 41 41 #if PLATFORM(COCOA) 42 43 #include <objc/runtime.h> 44 42 #include "ClassMethodSwizzler.h" 45 43 #endif 46 44 … … 56 54 struct TestCommand; 57 55 struct TestOptions; 58 59 #if PLATFORM(COCOA)60 // FIXME: This should be shared with TestWebKitAPI.61 class ClassMethodSwizzler {62 WTF_MAKE_NONCOPYABLE(ClassMethodSwizzler);63 public:64 ClassMethodSwizzler(Class, SEL, IMP);65 ~ClassMethodSwizzler();66 67 Method m_method;68 IMP m_originalImplementation;69 };70 #endif // PLATFORM(COCOA)71 56 72 57 class AsyncTask { -
trunk/Tools/WebKitTestRunner/WebKitTestRunner.xcodeproj/project.pbxproj
r238219 r238921 136 136 E1C642C317CBCC7300D66A3C /* PoseAsClass.mm in Sources */ = {isa = PBXBuildFile; fileRef = E1C642C117CBCC7300D66A3C /* PoseAsClass.mm */; }; 137 137 E1C642C617CBCD4C00D66A3C /* WebKitTestRunnerPasteboard.mm in Sources */ = {isa = PBXBuildFile; fileRef = E1C642C417CBCD4C00D66A3C /* WebKitTestRunnerPasteboard.mm */; }; 138 F44A531721B899E200DBB99C /* ClassMethodSwizzler.mm in Sources */ = {isa = PBXBuildFile; fileRef = F44A531421B899DA00DBB99C /* ClassMethodSwizzler.mm */; }; 139 F44A531821B899E500DBB99C /* InstanceMethodSwizzler.mm in Sources */ = {isa = PBXBuildFile; fileRef = F44A531621B899DA00DBB99C /* InstanceMethodSwizzler.mm */; }; 138 140 F46240B1217013E500917B16 /* UIScriptControllerCocoa.mm in Sources */ = {isa = PBXBuildFile; fileRef = F46240AF2170128300917B16 /* UIScriptControllerCocoa.mm */; }; 139 141 F4C3578C20E8444600FA0748 /* LayoutTestSpellChecker.mm in Sources */ = {isa = PBXBuildFile; fileRef = F4C3578A20E8444000FA0748 /* LayoutTestSpellChecker.mm */; }; … … 380 382 E1C642C417CBCD4C00D66A3C /* WebKitTestRunnerPasteboard.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = WebKitTestRunnerPasteboard.mm; sourceTree = "<group>"; }; 381 383 E1C642C517CBCD4C00D66A3C /* WebKitTestRunnerPasteboard.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WebKitTestRunnerPasteboard.h; sourceTree = "<group>"; }; 384 F44A531321B899DA00DBB99C /* InstanceMethodSwizzler.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = InstanceMethodSwizzler.h; path = ../TestRunnerShared/cocoa/InstanceMethodSwizzler.h; sourceTree = "<group>"; }; 385 F44A531421B899DA00DBB99C /* ClassMethodSwizzler.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; name = ClassMethodSwizzler.mm; path = ../TestRunnerShared/cocoa/ClassMethodSwizzler.mm; sourceTree = "<group>"; }; 386 F44A531521B899DA00DBB99C /* ClassMethodSwizzler.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = ClassMethodSwizzler.h; path = ../TestRunnerShared/cocoa/ClassMethodSwizzler.h; sourceTree = "<group>"; }; 387 F44A531621B899DA00DBB99C /* InstanceMethodSwizzler.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; name = InstanceMethodSwizzler.mm; path = ../TestRunnerShared/cocoa/InstanceMethodSwizzler.mm; sourceTree = "<group>"; }; 382 388 F46240AF2170128300917B16 /* UIScriptControllerCocoa.mm */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.objcpp; path = UIScriptControllerCocoa.mm; sourceTree = "<group>"; }; 383 389 F4C3578A20E8444000FA0748 /* LayoutTestSpellChecker.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; name = LayoutTestSpellChecker.mm; path = ../TestRunnerShared/cocoa/LayoutTestSpellChecker.mm; sourceTree = "<group>"; }; … … 842 848 isa = PBXGroup; 843 849 children = ( 850 F44A531521B899DA00DBB99C /* ClassMethodSwizzler.h */, 851 F44A531421B899DA00DBB99C /* ClassMethodSwizzler.mm */, 852 F44A531321B899DA00DBB99C /* InstanceMethodSwizzler.h */, 853 F44A531621B899DA00DBB99C /* InstanceMethodSwizzler.mm */, 844 854 F4C3578B20E8444000FA0748 /* LayoutTestSpellChecker.h */, 845 855 F4C3578A20E8444000FA0748 /* LayoutTestSpellChecker.mm */, … … 1063 1073 buildActionMask = 2147483647; 1064 1074 files = ( 1075 F44A531721B899E200DBB99C /* ClassMethodSwizzler.mm in Sources */, 1065 1076 A185103A1B9AE0DA00744AEB /* CrashReporterInfo.mm in Sources */, 1066 1077 A185103E1B9AE12200744AEB /* CyclicRedundancyCheck.cpp in Sources */, 1067 1078 2DD4C49B1D6E7D3B0007379C /* EventSerializerMac.mm in Sources */, 1068 1079 A185103F1B9AE12900744AEB /* GeolocationProviderMock.cpp in Sources */, 1080 F44A531821B899E500DBB99C /* InstanceMethodSwizzler.mm in Sources */, 1069 1081 31DA8A3D1E7205CC00E1DF2F /* IOSLayoutTestCommunication.cpp in Sources */, 1070 1082 0F73B5511BA78968004B3EF4 /* JSUIScriptController.cpp in Sources */, -
trunk/Tools/WebKitTestRunner/cocoa/TestControllerCocoa.mm
r238623 r238921 206 206 } 207 207 208 ClassMethodSwizzler::ClassMethodSwizzler(Class cls, SEL originalSelector, IMP implementation)209 : m_method(class_getClassMethod(objc_getMetaClass(NSStringFromClass(cls).UTF8String), originalSelector))210 , m_originalImplementation(method_setImplementation(m_method, implementation))211 {212 }213 214 ClassMethodSwizzler::~ClassMethodSwizzler()215 {216 method_setImplementation(m_method, m_originalImplementation);217 }218 219 208 static NSCalendar *swizzledCalendar() 220 209 {
Note: See TracChangeset
for help on using the changeset viewer.