Changeset 238921 in webkit


Ignore:
Timestamp:
Dec 5, 2018 7:09:29 PM (5 years ago)
Author:
Wenson Hsieh
Message:

[Cocoa] Share ClassMethodSwizzler and InstanceMethodSwizzler between TestWebKitAPI and WebKitTestRunner
https://bugs.webkit.org/show_bug.cgi?id=192437

Reviewed by Tim Horton.

  • DumpRenderTree/DumpRenderTree.xcodeproj/project.pbxproj:
  • TestRunnerShared/cocoa/ClassMethodSwizzler.h: Renamed from Tools/TestWebKitAPI/ClassMethodSwizzler.h.
  • TestRunnerShared/cocoa/ClassMethodSwizzler.mm: Renamed from Tools/TestWebKitAPI/ClassMethodSwizzler.mm.

(ClassMethodSwizzler::ClassMethodSwizzler):
(ClassMethodSwizzler::~ClassMethodSwizzler):

  • TestRunnerShared/cocoa/InstanceMethodSwizzler.h: Renamed from Tools/TestWebKitAPI/cocoa/InstanceMethodSwizzler.h.
  • TestRunnerShared/cocoa/InstanceMethodSwizzler.mm: Renamed from Tools/TestWebKitAPI/cocoa/InstanceMethodSwizzler.mm.

(InstanceMethodSwizzler::InstanceMethodSwizzler):
(InstanceMethodSwizzler::~InstanceMethodSwizzler):

Move these swizzling helper classes into TestRunnerShared.

  • TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj:
  • TestWebKitAPI/Tests/WebKitCocoa/LocalStorageClear.mm:
  • TestWebKitAPI/Tests/WebKitCocoa/SafeBrowsing.mm:

(safeBrowsingView):

  • TestWebKitAPI/Tests/WebKitCocoa/WKWebViewDefaultNavigationDelegate.mm:
  • TestWebKitAPI/cocoa/TestWKWebView.mm:

(-[TestWKWebView initWithFrame:configuration:addToWindow:]):

Remove namespacing around ClassMethodSwizzler and InstanceMethodSwizzler in a few API tests.

  • TestWebKitAPI/mac/TestFontOptions.mm:
  • WebKitTestRunner/TestController.h:
  • WebKitTestRunner/WebKitTestRunner.xcodeproj/project.pbxproj:
  • WebKitTestRunner/cocoa/TestControllerCocoa.mm:

(WTR::ClassMethodSwizzler::ClassMethodSwizzler): Deleted.
(WTR::ClassMethodSwizzler::~ClassMethodSwizzler): Deleted.

Remove this duplicate implementation of ClassMethodSwizzler in WebKitTestRunner.

Location:
trunk/Tools
Files:
11 edited
4 moved

Legend:

Unmodified
Added
Removed
  • trunk/Tools/ChangeLog

    r238910 r238921  
     12018-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
    1392018-12-05  Jonathan Bedard  <jbedard@apple.com>
    240
  • trunk/Tools/DumpRenderTree/DumpRenderTree.xcodeproj/project.pbxproj

    r238219 r238921  
    148148                C23EA2091BC9F05100C980B7 /* FontWithFeatures.ttf in Copy Font Files */ = {isa = PBXBuildFile; fileRef = C23EA2071BC9EABA00C980B7 /* FontWithFeatures.ttf */; };
    149149                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 */; };
    150152                F4C3578D20E8444E00FA0748 /* LayoutTestSpellChecker.mm in Sources */ = {isa = PBXBuildFile; fileRef = F4C3578820E8442700FA0748 /* LayoutTestSpellChecker.mm */; };
    151153                F4D423611DD5048200678290 /* TextInputControllerIOS.m in Sources */ = {isa = PBXBuildFile; fileRef = F4D4235F1DD5045300678290 /* TextInputControllerIOS.m */; };
     
    410412                E1B7808511AF1643007E1BC2 /* MockGeolocationProvider.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = MockGeolocationProvider.h; path = mac/MockGeolocationProvider.h; sourceTree = "<group>"; };
    411413                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>"; };
    412418                F4C3578820E8442700FA0748 /* LayoutTestSpellChecker.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; name = LayoutTestSpellChecker.mm; path = ../TestRunnerShared/cocoa/LayoutTestSpellChecker.mm; sourceTree = "<group>"; };
    413419                F4C3578920E8442700FA0748 /* LayoutTestSpellChecker.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = LayoutTestSpellChecker.h; path = ../TestRunnerShared/cocoa/LayoutTestSpellChecker.h; sourceTree = "<group>"; };
     
    818824                        isa = PBXGroup;
    819825                        children = (
     826                                F44A531B21B89A4400DBB99C /* ClassMethodSwizzler.h */,
     827                                F44A531A21B89A4400DBB99C /* ClassMethodSwizzler.mm */,
     828                                F44A531921B89A4400DBB99C /* InstanceMethodSwizzler.h */,
     829                                F44A531C21B89A4500DBB99C /* InstanceMethodSwizzler.mm */,
    820830                                F4C3578920E8442700FA0748 /* LayoutTestSpellChecker.h */,
    821831                                F4C3578820E8442700FA0748 /* LayoutTestSpellChecker.mm */,
     
    10761086                                BC0E26150E2DA4C6001B6BC2 /* AccessibilityUIElementMac.mm in Sources */,
    10771087                                BCA18B390C9B021900114369 /* AppleScriptController.m in Sources */,
     1088                                F44A531D21B89A4D00DBB99C /* ClassMethodSwizzler.mm in Sources */,
    10781089                                53CBB832134E42F3001CE6A4 /* CyclicRedundancyCheck.cpp in Sources */,
    10791090                                1A2FB84F178C80930059FD96 /* DefaultPolicyDelegate.m in Sources */,
     
    10911102                                BCA18B230C9B014B00114369 /* GCControllerMac.mm in Sources */,
    10921103                                5185F6B210714E07007AA393 /* HistoryDelegate.mm in Sources */,
     1104                                F44A531E21B89A5000DBB99C /* InstanceMethodSwizzler.mm in Sources */,
    10931105                                312943F91E71F2B4001EE2CC /* IOSLayoutTestCommunication.cpp in Sources */,
    10941106                                2CE88FA217124D8C00734FC0 /* JavaScriptThreading.cpp in Sources */,
  • trunk/Tools/TestRunnerShared/cocoa/ClassMethodSwizzler.h

    r238920 r238921  
    2929#include <wtf/Noncopyable.h>
    3030
    31 namespace TestWebKitAPI {
    32 
    3331class ClassMethodSwizzler {
    3432    WTF_MAKE_NONCOPYABLE(ClassMethodSwizzler);
     
    4038    IMP m_originalImplementation;
    4139};
    42 
    43 } // namespace TestWebKitAPI
  • trunk/Tools/TestRunnerShared/cocoa/ClassMethodSwizzler.mm

    r238920 r238921  
    2727#import "ClassMethodSwizzler.h"
    2828
    29 namespace TestWebKitAPI {
    30 
    3129ClassMethodSwizzler::ClassMethodSwizzler(Class cls, SEL originalSelector, IMP implementation)
    3230    : m_method(class_getClassMethod(objc_getMetaClass(NSStringFromClass(cls).UTF8String), originalSelector))
     
    3937    method_setImplementation(m_method, m_originalImplementation);
    4038}
    41 
    42 } // namespace TestWebKitAPI
  • trunk/Tools/TestRunnerShared/cocoa/InstanceMethodSwizzler.h

    r238920 r238921  
    11/*
    2  * Copyright (C) 2011 Apple Inc. All rights reserved.
     2 * Copyright (C) 2011-2018 Apple Inc. All rights reserved.
    33 *
    44 * Redistribution and use in source and binary forms, with or without
     
    2424 */
    2525
    26 #ifndef InstanceMethodSwizzler_h
    27 #define InstanceMethodSwizzler_h
     26#pragma once
    2827
    2928#include <objc/runtime.h>
    3029#include <wtf/Noncopyable.h>
    31 
    32 namespace TestWebKitAPI {
    3330
    3431class InstanceMethodSwizzler {
     
    4138    IMP m_originalImplementation;
    4239};
    43 
    44 } // namespace TestWebKitAPI
    45 
    46 #endif // InstanceMethodSwizzler_h
  • trunk/Tools/TestRunnerShared/cocoa/InstanceMethodSwizzler.mm

    r238920 r238921  
    11/*
    2  * Copyright (C) 2011 Apple Inc. All rights reserved.
     2 * Copyright (C) 2011-2018 Apple Inc. All rights reserved.
    33 *
    44 * Redistribution and use in source and binary forms, with or without
     
    2727#include "InstanceMethodSwizzler.h"
    2828
    29 namespace TestWebKitAPI {
    30 
    3129InstanceMethodSwizzler::InstanceMethodSwizzler(Class cls, SEL selector, IMP implementation)
    3230    : m_method(class_getInstanceMethod(cls, selector))
     
    3937    method_setImplementation(m_method, m_originalImplementation);
    4038}
    41 
    42 } // namespace TestWebKitAPI
  • trunk/Tools/TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj

    r238828 r238921  
    288288                5C69BDD51F82A7EF000F4F4B /* JavaScriptDuringNavigation.mm in Sources */ = {isa = PBXBuildFile; fileRef = 5C69BDD41F82A7EB000F4F4B /* JavaScriptDuringNavigation.mm */; };
    289289                5C7148952123A40A00FDE3C5 /* WKWebsiteDatastore.mm in Sources */ = {isa = PBXBuildFile; fileRef = 5C7148942123A40700FDE3C5 /* WKWebsiteDatastore.mm */; };
    290                 5C726D6F1D3EE06E00C5E1A1 /* InstanceMethodSwizzler.mm in Sources */ = {isa = PBXBuildFile; fileRef = 5C726D6E1D3EE06800C5E1A1 /* InstanceMethodSwizzler.mm */; };
    291290                5C7964101EB0278D0075D74C /* EventModifiers.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 5C79640F1EB0269B0075D74C /* EventModifiers.cpp */; };
    292291                5C7C74CB1FB529BA002F9ABE /* WebViewScheduleInRunLoop.mm in Sources */ = {isa = PBXBuildFile; fileRef = 5C7C74CA1FB528D4002F9ABE /* WebViewScheduleInRunLoop.mm */; };
     
    829828                F442851D2140DF2900CCDA22 /* NSFontPanelTesting.mm in Sources */ = {isa = PBXBuildFile; fileRef = F442851C2140DF2900CCDA22 /* NSFontPanelTesting.mm */; };
    830829                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 */; };
    831832                F44C79FF20F9E8710014478C /* ParserYieldTokenTests.mm in Sources */ = {isa = PBXBuildFile; fileRef = F44C79FE20F9E8710014478C /* ParserYieldTokenTests.mm */; };
    832833                F44C7A0020F9EEBF0014478C /* ParserYieldTokenPlugIn.mm in Sources */ = {isa = PBXBuildFile; fileRef = F44C79FB20F9E50C0014478C /* ParserYieldTokenPlugIn.mm */; };
     
    838839                F4512E131F60C44600BB369E /* DataTransferItem-getAsEntry.html in Copy Resources */ = {isa = PBXBuildFile; fileRef = F4512E121F60C43400BB369E /* DataTransferItem-getAsEntry.html */; };
    839840                F4517B672054C49500C26721 /* TestWKWebViewController.mm in Sources */ = {isa = PBXBuildFile; fileRef = F4517B662054C49500C26721 /* TestWKWebViewController.mm */; };
    840                 F4517B7F2055101B00C26721 /* ClassMethodSwizzler.mm in Sources */ = {isa = PBXBuildFile; fileRef = F4517B692054E0AC00C26721 /* ClassMethodSwizzler.mm */; };
    841841                F4538EF71E8473E600B5C953 /* large-red-square.png in Copy Resources */ = {isa = PBXBuildFile; fileRef = F4538EF01E846B4100B5C953 /* large-red-square.png */; };
    842842                F456AB1C213EDBA300CB2CEF /* FontManagerTests.mm in Sources */ = {isa = PBXBuildFile; fileRef = F456AB1B213EDBA300CB2CEF /* FontManagerTests.mm */; };
     
    16311631                5C69BDD41F82A7EB000F4F4B /* JavaScriptDuringNavigation.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = JavaScriptDuringNavigation.mm; sourceTree = "<group>"; };
    16321632                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>"; };
    16351633                5C79640F1EB0269B0075D74C /* EventModifiers.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = EventModifiers.cpp; sourceTree = "<group>"; };
    16361634                5C7C74CA1FB528D4002F9ABE /* WebViewScheduleInRunLoop.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = WebViewScheduleInRunLoop.mm; sourceTree = "<group>"; };
     
    21262124                F442851C2140DF2900CCDA22 /* NSFontPanelTesting.mm */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.objcpp; path = NSFontPanelTesting.mm; sourceTree = "<group>"; };
    21272125                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>"; };
    21282130                F44C79FB20F9E50C0014478C /* ParserYieldTokenPlugIn.mm */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.objcpp; path = ParserYieldTokenPlugIn.mm; sourceTree = "<group>"; };
    21292131                F44C79FD20F9E8710014478C /* ParserYieldTokenTests.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = ParserYieldTokenTests.h; sourceTree = "<group>"; };
     
    21382140                F4517B652054C49500C26721 /* TestWKWebViewController.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = TestWKWebViewController.h; sourceTree = "<group>"; };
    21392141                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>"; };
    21422142                F4538EF01E846B4100B5C953 /* large-red-square.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "large-red-square.png"; sourceTree = "<group>"; };
    21432143                F456AB1B213EDBA300CB2CEF /* FontManagerTests.mm */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.objcpp; path = FontManagerTests.mm; sourceTree = "<group>"; };
     
    23302330                        children = (
    23312331                                A13EBB441B87332B00097110 /* WebProcessPlugIn */,
    2332                                 F4517B682054E0AC00C26721 /* ClassMethodSwizzler.h */,
    2333                                 F4517B692054E0AC00C26721 /* ClassMethodSwizzler.mm */,
     2332                                F44A530F21B8976900DBB99C /* ClassMethodSwizzler.h */,
     2333                                F44A530E21B8976900DBB99C /* ClassMethodSwizzler.mm */,
    23342334                                F47DFB2721A885E700021FB6 /* DataDetectorsCoreSPI.h */,
    23352335                                F46128B4211C861A00D9FADB /* DragAndDropSimulator.h */,
    23362336                                F44D06481F3962E3001A0E29 /* EditingTestHarness.h */,
    23372337                                F44D06491F3962E3001A0E29 /* EditingTestHarness.mm */,
    2338                                 5C726D6D1D3EE06800C5E1A1 /* InstanceMethodSwizzler.h */,
    2339                                 5C726D6E1D3EE06800C5E1A1 /* InstanceMethodSwizzler.mm */,
     2338                                F44A530D21B8976900DBB99C /* InstanceMethodSwizzler.h */,
     2339                                F44A531021B8976900DBB99C /* InstanceMethodSwizzler.mm */,
    23402340                                0F139E721A423A2B00F590F5 /* PlatformUtilitiesCocoa.mm */,
    23412341                                2D1C04A51D76298B000A6816 /* TestNavigationDelegate.h */,
     
    38453845                                57303BC9200824D300355965 /* CBORValueTest.cpp in Sources */,
    38463846                                57303BCA20082C0100355965 /* CBORWriterTest.cpp in Sources */,
    3847                                 F4517B7F2055101B00C26721 /* ClassMethodSwizzler.mm in Sources */,
     3847                                F44A531221B8990A00DBB99C /* ClassMethodSwizzler.mm in Sources */,
    38483848                                7CCE7EE61A411AE600447C4C /* CloseFromWithinCreatePage.cpp in Sources */,
    38493849                                7CCE7EB71A411A7E00447C4C /* CloseNewWindowInNavigationPolicyDelegate.mm in Sources */,
     
    39883988                                7C83E0B81D0A64BD00FEBCF3 /* InjectedBundleMakeAllShadowRootsOpen.cpp in Sources */,
    39893989                                7CCE7EC31A411A7E00447C4C /* InspectorBar.mm in Sources */,
     3990                                F44A531121B8990300DBB99C /* InstanceMethodSwizzler.mm in Sources */,
    39903991                                7CCE7EDA1A411A8700447C4C /* InstanceMethodSwizzler.mm in Sources */,
    3991                                 5C726D6F1D3EE06E00C5E1A1 /* InstanceMethodSwizzler.mm in Sources */,
    39923992                                2DB0232F1E4E871800707123 /* InteractionDeadlockAfterCrash.mm in Sources */,
    39933993                                7A909A811D877480007E10F8 /* IntPoint.cpp in Sources */,
  • trunk/Tools/TestWebKitAPI/Tests/WebKitCocoa/LocalStorageClear.mm

    r237266 r238921  
    131131#if PLATFORM(IOS_FAMILY)
    132132    // 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));
    134134#endif
    135135
  • trunk/Tools/TestWebKitAPI/Tests/WebKitCocoa/SafeBrowsing.mm

    r238641 r238921  
    146146TEST(SafeBrowsing, Preference)
    147147{
    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)]);
    149149
    150150    __block bool done = false;
     
    169169static RetainPtr<WKWebView> safeBrowsingView()
    170170{
    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)]);
    172172
    173173    static auto delegate = adoptNS([SafeBrowsingNavigationDelegate new]);
     
    270270TEST(SafeBrowsing, MissingFramework)
    271271{
    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)]);
    273273    auto webView = adoptNS([[TestWKWebView alloc] initWithFrame:CGRectMake(0, 0, 800, 600)]);
    274274    [webView synchronouslyLoadTestPageNamed:@"simple"];
  • trunk/Tools/TestWebKitAPI/Tests/WebKitCocoa/WKWebViewDefaultNavigationDelegate.mm

    r202329 r238921  
    4646TEST(WKWebView, DefaultNavigationDelegate)
    4747{
    48     TestWebKitAPI::InstanceMethodSwizzler swizzle([NSWorkspace class], @selector(openURL:), reinterpret_cast<IMP>(newOpenURL));
     48    InstanceMethodSwizzler swizzle([NSWorkspace class], @selector(openURL:), reinterpret_cast<IMP>(newOpenURL));
    4949
    5050    WKWebView *webView = [[WKWebView alloc] initWithFrame:NSMakeRect(0, 0, 800, 600)];
  • trunk/Tools/TestWebKitAPI/cocoa/TestWKWebView.mm

    r238471 r238921  
    254254    RetainPtr<TestMessageHandler> _testHandler;
    255255#if PLATFORM(IOS_FAMILY)
    256     std::unique_ptr<TestWebKitAPI::ClassMethodSwizzler> _sharedCalloutBarSwizzler;
     256    std::unique_ptr<ClassMethodSwizzler> _sharedCalloutBarSwizzler;
    257257#endif
    258258}
     
    289289#if PLATFORM(IOS_FAMILY)
    290290    // 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));
    292292#endif
    293293
  • trunk/Tools/TestWebKitAPI/mac/TestFontOptions.mm

    r236854 r238921  
    3535#import <wtf/SetForScope.h>
    3636
    37 using namespace TestWebKitAPI;
    38 
    3937static TestFontOptions *sharedFontOptionsForTesting()
    4038{
  • trunk/Tools/WebKitTestRunner/TestController.h

    r238512 r238921  
    4040
    4141#if PLATFORM(COCOA)
    42 
    43 #include <objc/runtime.h>
    44 
     42#include "ClassMethodSwizzler.h"
    4543#endif
    4644
     
    5654struct TestCommand;
    5755struct 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)
    7156
    7257class AsyncTask {
  • trunk/Tools/WebKitTestRunner/WebKitTestRunner.xcodeproj/project.pbxproj

    r238219 r238921  
    136136                E1C642C317CBCC7300D66A3C /* PoseAsClass.mm in Sources */ = {isa = PBXBuildFile; fileRef = E1C642C117CBCC7300D66A3C /* PoseAsClass.mm */; };
    137137                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 */; };
    138140                F46240B1217013E500917B16 /* UIScriptControllerCocoa.mm in Sources */ = {isa = PBXBuildFile; fileRef = F46240AF2170128300917B16 /* UIScriptControllerCocoa.mm */; };
    139141                F4C3578C20E8444600FA0748 /* LayoutTestSpellChecker.mm in Sources */ = {isa = PBXBuildFile; fileRef = F4C3578A20E8444000FA0748 /* LayoutTestSpellChecker.mm */; };
     
    380382                E1C642C417CBCD4C00D66A3C /* WebKitTestRunnerPasteboard.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = WebKitTestRunnerPasteboard.mm; sourceTree = "<group>"; };
    381383                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>"; };
    382388                F46240AF2170128300917B16 /* UIScriptControllerCocoa.mm */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.objcpp; path = UIScriptControllerCocoa.mm; sourceTree = "<group>"; };
    383389                F4C3578A20E8444000FA0748 /* LayoutTestSpellChecker.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; name = LayoutTestSpellChecker.mm; path = ../TestRunnerShared/cocoa/LayoutTestSpellChecker.mm; sourceTree = "<group>"; };
     
    842848                        isa = PBXGroup;
    843849                        children = (
     850                                F44A531521B899DA00DBB99C /* ClassMethodSwizzler.h */,
     851                                F44A531421B899DA00DBB99C /* ClassMethodSwizzler.mm */,
     852                                F44A531321B899DA00DBB99C /* InstanceMethodSwizzler.h */,
     853                                F44A531621B899DA00DBB99C /* InstanceMethodSwizzler.mm */,
    844854                                F4C3578B20E8444000FA0748 /* LayoutTestSpellChecker.h */,
    845855                                F4C3578A20E8444000FA0748 /* LayoutTestSpellChecker.mm */,
     
    10631073                        buildActionMask = 2147483647;
    10641074                        files = (
     1075                                F44A531721B899E200DBB99C /* ClassMethodSwizzler.mm in Sources */,
    10651076                                A185103A1B9AE0DA00744AEB /* CrashReporterInfo.mm in Sources */,
    10661077                                A185103E1B9AE12200744AEB /* CyclicRedundancyCheck.cpp in Sources */,
    10671078                                2DD4C49B1D6E7D3B0007379C /* EventSerializerMac.mm in Sources */,
    10681079                                A185103F1B9AE12900744AEB /* GeolocationProviderMock.cpp in Sources */,
     1080                                F44A531821B899E500DBB99C /* InstanceMethodSwizzler.mm in Sources */,
    10691081                                31DA8A3D1E7205CC00E1DF2F /* IOSLayoutTestCommunication.cpp in Sources */,
    10701082                                0F73B5511BA78968004B3EF4 /* JSUIScriptController.cpp in Sources */,
  • trunk/Tools/WebKitTestRunner/cocoa/TestControllerCocoa.mm

    r238623 r238921  
    206206}
    207207
    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    
    219208static NSCalendar *swizzledCalendar()
    220209{
Note: See TracChangeset for help on using the changeset viewer.