Pull IPadUserInterfaceSwizzler out into a separate header file
authorwenson_hsieh@apple.com <wenson_hsieh@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 25 Mar 2019 19:09:18 +0000 (19:09 +0000)
committerwenson_hsieh@apple.com <wenson_hsieh@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 25 Mar 2019 19:09:18 +0000 (19:09 +0000)
https://bugs.webkit.org/show_bug.cgi?id=196193

Reviewed by Anders Carlsson.

Pull the IPadUserInterfaceSwizzler helper class out into a separate file, so that it may
be used in other API tests.

* TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj:
* TestWebKitAPI/Tests/ios/ActionSheetTests.mm:
(TestWebKitAPI::IPadUserInterfaceSwizzler::IPadUserInterfaceSwizzler): Deleted.
(TestWebKitAPI::IPadUserInterfaceSwizzler::padUserInterfaceIdiom): Deleted.
* TestWebKitAPI/ios/IPadUserInterfaceSwizzler.h: Added.
(TestWebKitAPI::IPadUserInterfaceSwizzler::IPadUserInterfaceSwizzler):
(TestWebKitAPI::IPadUserInterfaceSwizzler::padUserInterfaceIdiom):

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@243445 268f45cc-cd09-0410-ab3c-d52691b4dbfc

Tools/ChangeLog
Tools/TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj
Tools/TestWebKitAPI/Tests/ios/ActionSheetTests.mm
Tools/TestWebKitAPI/ios/IPadUserInterfaceSwizzler.h [new file with mode: 0644]

index 0a1d067..a517cc4 100644 (file)
@@ -1,3 +1,21 @@
+2019-03-25  Wenson Hsieh  <wenson_hsieh@apple.com>
+
+        Pull IPadUserInterfaceSwizzler out into a separate header file
+        https://bugs.webkit.org/show_bug.cgi?id=196193
+
+        Reviewed by Anders Carlsson.
+
+        Pull the IPadUserInterfaceSwizzler helper class out into a separate file, so that it may
+        be used in other API tests.
+
+        * TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj:
+        * TestWebKitAPI/Tests/ios/ActionSheetTests.mm:
+        (TestWebKitAPI::IPadUserInterfaceSwizzler::IPadUserInterfaceSwizzler): Deleted.
+        (TestWebKitAPI::IPadUserInterfaceSwizzler::padUserInterfaceIdiom): Deleted.
+        * TestWebKitAPI/ios/IPadUserInterfaceSwizzler.h: Added.
+        (TestWebKitAPI::IPadUserInterfaceSwizzler::IPadUserInterfaceSwizzler):
+        (TestWebKitAPI::IPadUserInterfaceSwizzler::padUserInterfaceIdiom):
+
 2019-03-25  Gyuyoung Kim  <gyuyoung.kim@webkit.org>
 
         Remove NavigatorContentUtils in WebCore/Modules
 2019-03-25  Gyuyoung Kim  <gyuyoung.kim@webkit.org>
 
         Remove NavigatorContentUtils in WebCore/Modules
index 5b823ba..68cd69a 100644 (file)
                F4CD74C520FDACF500DE3794 /* text-with-async-script.html */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.html; path = "text-with-async-script.html"; sourceTree = "<group>"; };
                F4CD74C720FDB49600DE3794 /* TestURLSchemeHandler.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = TestURLSchemeHandler.h; sourceTree = "<group>"; };
                F4CD74C820FDB49600DE3794 /* TestURLSchemeHandler.mm */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.objcpp; path = TestURLSchemeHandler.mm; sourceTree = "<group>"; };
                F4CD74C520FDACF500DE3794 /* text-with-async-script.html */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.html; path = "text-with-async-script.html"; sourceTree = "<group>"; };
                F4CD74C720FDB49600DE3794 /* TestURLSchemeHandler.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = TestURLSchemeHandler.h; sourceTree = "<group>"; };
                F4CD74C820FDB49600DE3794 /* TestURLSchemeHandler.mm */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.objcpp; path = TestURLSchemeHandler.mm; sourceTree = "<group>"; };
+               F4CDAB3322489FE10057A2D9 /* IPadUserInterfaceSwizzler.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = IPadUserInterfaceSwizzler.h; sourceTree = "<group>"; };
                F4D2986D20FEE7370092D636 /* RunScriptAfterDocumentLoad.mm */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.objcpp; path = RunScriptAfterDocumentLoad.mm; sourceTree = "<group>"; };
                F4D4F3B41E4E2BCB00BB2767 /* DragAndDropSimulatorIOS.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = DragAndDropSimulatorIOS.mm; sourceTree = "<group>"; };
                F4D4F3B71E4E36E400BB2767 /* DragAndDropTestsIOS.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = DragAndDropTestsIOS.mm; sourceTree = "<group>"; };
                F4D2986D20FEE7370092D636 /* RunScriptAfterDocumentLoad.mm */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.objcpp; path = RunScriptAfterDocumentLoad.mm; sourceTree = "<group>"; };
                F4D4F3B41E4E2BCB00BB2767 /* DragAndDropSimulatorIOS.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = DragAndDropSimulatorIOS.mm; sourceTree = "<group>"; };
                F4D4F3B71E4E36E400BB2767 /* DragAndDropTestsIOS.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = DragAndDropTestsIOS.mm; sourceTree = "<group>"; };
                        isa = PBXGroup;
                        children = (
                                F4D4F3B41E4E2BCB00BB2767 /* DragAndDropSimulatorIOS.mm */,
                        isa = PBXGroup;
                        children = (
                                F4D4F3B41E4E2BCB00BB2767 /* DragAndDropSimulatorIOS.mm */,
+                               F4CDAB3322489FE10057A2D9 /* IPadUserInterfaceSwizzler.h */,
                                2E7765CC16C4D80A00BA2BB1 /* mainIOS.mm */,
                                2D61EC3021B0B75C00A7D1CB /* PencilKitTestSPI.h */,
                                F4517B652054C49500C26721 /* TestWKWebViewController.h */,
                                2E7765CC16C4D80A00BA2BB1 /* mainIOS.mm */,
                                2D61EC3021B0B75C00A7D1CB /* PencilKitTestSPI.h */,
                                F4517B652054C49500C26721 /* TestWKWebViewController.h */,
index bf7da79..e81f102 100644 (file)
@@ -29,7 +29,7 @@
 #if PLATFORM(IOS_FAMILY)
 
 #import "ClassMethodSwizzler.h"
 #if PLATFORM(IOS_FAMILY)
 
 #import "ClassMethodSwizzler.h"
-#import "InstanceMethodSwizzler.h"
+#import "IPadUserInterfaceSwizzler.h"
 #import "PlatformUtilities.h"
 #import "TestNavigationDelegate.h"
 #import "TestWKWebView.h"
 #import "PlatformUtilities.h"
 #import "TestNavigationDelegate.h"
 #import "TestWKWebView.h"
 
 namespace TestWebKitAPI {
 
 
 namespace TestWebKitAPI {
 
-class IPadUserInterfaceSwizzler {
-public:
-    IPadUserInterfaceSwizzler()
-        : m_swizzler([UIDevice class], @selector(userInterfaceIdiom), reinterpret_cast<IMP>(padUserInterfaceIdiom))
-    {
-    }
-private:
-    static UIUserInterfaceIdiom padUserInterfaceIdiom()
-    {
-        return UIUserInterfaceIdiomPad;
-    }
-    InstanceMethodSwizzler m_swizzler;
-};
-
 static RetainPtr<UIViewController> gOverrideViewControllerForFullscreenPresentation;
 static void setOverrideViewControllerForFullscreenPresentation(UIViewController *viewController)
 {
 static RetainPtr<UIViewController> gOverrideViewControllerForFullscreenPresentation;
 static void setOverrideViewControllerForFullscreenPresentation(UIViewController *viewController)
 {
diff --git a/Tools/TestWebKitAPI/ios/IPadUserInterfaceSwizzler.h b/Tools/TestWebKitAPI/ios/IPadUserInterfaceSwizzler.h
new file mode 100644 (file)
index 0000000..b025193
--- /dev/null
@@ -0,0 +1,51 @@
+/*
+ * Copyright (C) 2019 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#pragma once
+
+#if PLATFORM(IOS_FAMILY)
+
+#import "InstanceMethodSwizzler.h"
+#import <UIKit/UIKit.h>
+
+namespace TestWebKitAPI {
+
+class IPadUserInterfaceSwizzler {
+public:
+    IPadUserInterfaceSwizzler()
+        : m_swizzler([UIDevice class], @selector(userInterfaceIdiom), reinterpret_cast<IMP>(padUserInterfaceIdiom))
+    {
+    }
+private:
+    static UIUserInterfaceIdiom padUserInterfaceIdiom(id, SEL)
+    {
+        return UIUserInterfaceIdiomPad;
+    }
+    InstanceMethodSwizzler m_swizzler;
+};
+
+} // namespace TestWebKitAPI
+
+#endif // PLATFORM(IOS_FAMILY)