Diff
Modified: trunk/Source/WebKitLegacy/ChangeLog (269331 => 269332)
--- trunk/Source/WebKitLegacy/ChangeLog 2020-11-03 21:24:17 UTC (rev 269331)
+++ trunk/Source/WebKitLegacy/ChangeLog 2020-11-03 21:37:13 UTC (rev 269332)
@@ -1,3 +1,16 @@
+2020-11-03 David Kilzer <[email protected]>
+
+ Add test for cacheModelForMainBundle() in WebKitLegacy
+ <https://webkit.org/b/217960>
+
+ Reviewed by Darin Adler.
+
+ * WebKitLegacy.xcodeproj/project.pbxproj:
+ - Add TestingFunctions.h to the project.
+ (Generate Export Files):
+ - Append WebKit.Testing.exp to the generated export file if
+ WK_BUILD_FOR_TESTING is set to YES.
+
2020-11-03 Keith Rollin <[email protected]>
Extend check-for-inappropriate-files-in-framework to WebKitLegacy and _javascript_Core
Modified: trunk/Source/WebKitLegacy/WebKitLegacy.xcodeproj/project.pbxproj (269331 => 269332)
--- trunk/Source/WebKitLegacy/WebKitLegacy.xcodeproj/project.pbxproj 2020-11-03 21:24:17 UTC (rev 269331)
+++ trunk/Source/WebKitLegacy/WebKitLegacy.xcodeproj/project.pbxproj 2020-11-03 21:37:13 UTC (rev 269332)
@@ -136,6 +136,7 @@
3ABB3C7B1309C3B500E93D94 /* WebStorageTrackerClient.mm in Sources */ = {isa = PBXBuildFile; fileRef = 3ABB3C791309C3B500E93D94 /* WebStorageTrackerClient.mm */; };
3AE15D5012DBDED4009323C8 /* WebStorageManagerInternal.h in Headers */ = {isa = PBXBuildFile; fileRef = 3AE15D4F12DBDED4009323C8 /* WebStorageManagerInternal.h */; };
44BB8B141241A022001E3A22 /* WebArchiveInternal.h in Headers */ = {isa = PBXBuildFile; fileRef = 44BB8B131241A022001E3A22 /* WebArchiveInternal.h */; };
+ 44DDD0822540F97F00836F81 /* TestingFunctions.h in Headers */ = {isa = PBXBuildFile; fileRef = 44DDD0812540F8C800836F81 /* TestingFunctions.h */; };
4618DFF81DEF760A0033C3AA /* WebValidationMessageClient.h in Headers */ = {isa = PBXBuildFile; fileRef = 4618DFF61DEF760A0033C3AA /* WebValidationMessageClient.h */; };
4618DFF91DEF760A0033C3AA /* WebValidationMessageClient.mm in Sources */ = {isa = PBXBuildFile; fileRef = 4618DFF71DEF760A0033C3AA /* WebValidationMessageClient.mm */; };
4BF99F900AE050BC00815C2B /* WebEditorClient.h in Headers */ = {isa = PBXBuildFile; fileRef = 4BF99F8E0AE050BC00815C2B /* WebEditorClient.h */; settings = {ATTRIBUTES = (); }; };
@@ -872,6 +873,7 @@
3ABB3C791309C3B500E93D94 /* WebStorageTrackerClient.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = WebStorageTrackerClient.mm; sourceTree = "<group>"; };
3AE15D4F12DBDED4009323C8 /* WebStorageManagerInternal.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WebStorageManagerInternal.h; sourceTree = "<group>"; };
44BB8B131241A022001E3A22 /* WebArchiveInternal.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WebArchiveInternal.h; sourceTree = "<group>"; };
+ 44DDD0812540F8C800836F81 /* TestingFunctions.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = TestingFunctions.h; path = mac/TestingFunctions.h; sourceTree = "<group>"; };
4618DFF61DEF760A0033C3AA /* WebValidationMessageClient.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WebValidationMessageClient.h; sourceTree = "<group>"; };
4618DFF71DEF760A0033C3AA /* WebValidationMessageClient.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = WebValidationMessageClient.mm; sourceTree = "<group>"; };
4BF99F8E0AE050BC00815C2B /* WebEditorClient.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = WebEditorClient.h; sourceTree = "<group>"; };
@@ -1610,9 +1612,10 @@
0867D691FE84028FC02AAC07 /* WebKit */ = {
isa = PBXGroup;
children = (
+ 1C6CB03E0AA6391D00D23BFD /* MigrateHeaders.make */,
5C9D925822D7E8AD008E9266 /* Sources.txt */,
5C9D925922D7E8AD008E9266 /* SourcesCocoa.txt */,
- 1C6CB03E0AA6391D00D23BFD /* MigrateHeaders.make */,
+ 44DDD0812540F8C800836F81 /* TestingFunctions.h */,
F5F732D202FF4D4F01A80180 /* WebKit.exp */,
319A3F4D1885E5FB00E0C900 /* WebKit.mac.exp */,
A10C1D8F1820307D0036883A /* WebKit.iOS.exp */,
@@ -2957,6 +2960,7 @@
1A6B313A1A51F3A900422975 /* StorageThread.h in Headers */,
1A6B313C1A51F3A900422975 /* StorageTracker.h in Headers */,
1A6B313D1A51F3A900422975 /* StorageTrackerClient.h in Headers */,
+ 44DDD0822540F97F00836F81 /* TestingFunctions.h in Headers */,
7C1FB3C21846E8E1001A03D8 /* WebAllowDenyPolicyListener.h in Headers */,
CEDA12DC152CBE6800D9E08D /* WebAlternativeTextClient.h in Headers */,
B6CE5C25100BC5F500219936 /* WebApplicationCache.h in Headers */,
@@ -3316,7 +3320,7 @@
);
runOnlyForDeploymentPostprocessing = 0;
shellPath = /bin/sh;
- shellScript = "set -e\n\nmkdir -p \"${BUILT_PRODUCTS_DIR}/DerivedSources/WebKitLegacy\"\n\nEXP_GENERATED=\"${EXPORTED_SYMBOLS_FILE}\"\n\n[[ -z \"${EXP_GENERATED}\" ]] && exit 1\n\nif [[ \"${WK_PLATFORM_NAME}\" != \"macosx\" ]]; then\n EXP_WEBKIT_PLATFORM=\"${PROJECT_DIR}/ios/WebKit.iOS.exp\"\nelse\n EXP_WEBKIT_PLATFORM=\"${PROJECT_DIR}/mac/WebKit.mac.exp\"\nfi\n\ncat \"${PROJECT_DIR}/mac/WebKit.exp\" > \"${EXP_GENERATED}\"\ncat \"${EXP_WEBKIT_PLATFORM}\" >> \"${EXP_GENERATED}\"\n\nfor WK_CURRENT_ARCH in ${ARCHS}; do\n EXP_REEXPORTED=\"${BUILT_PRODUCTS_DIR}/DerivedSources/WebKitLegacy/ReexportedWebCoreSymbols_${WK_CURRENT_ARCH}.exp\"\n if [[ -f \"${EXP_REEXPORTED}\" ]]; then\n cat \"${EXP_REEXPORTED}\" >> \"${EXP_GENERATED}\"\n fi\ndone\n";
+ shellScript = "set -e\n\nmkdir -p \"${BUILT_PRODUCTS_DIR}/DerivedSources/WebKitLegacy\"\n\nEXP_GENERATED=\"${EXPORTED_SYMBOLS_FILE}\"\n\n[[ -z \"${EXP_GENERATED}\" ]] && exit 1\n\nif [[ \"${WK_PLATFORM_NAME}\" != \"macosx\" ]]; then\n EXP_WEBKIT_PLATFORM=\"${PROJECT_DIR}/ios/WebKit.iOS.exp\"\nelse\n EXP_WEBKIT_PLATFORM=\"${PROJECT_DIR}/mac/WebKit.mac.exp\"\nfi\n\ncat \"${PROJECT_DIR}/mac/WebKit.exp\" > \"${EXP_GENERATED}\"\ncat \"${EXP_WEBKIT_PLATFORM}\" >> \"${EXP_GENERATED}\"\n\nfor WK_CURRENT_ARCH in ${ARCHS}; do\n EXP_REEXPORTED=\"${BUILT_PRODUCTS_DIR}/DerivedSources/WebKitLegacy/ReexportedWebCoreSymbols_${WK_CURRENT_ARCH}.exp\"\n if [[ -f \"${EXP_REEXPORTED}\" ]]; then\n cat \"${EXP_REEXPORTED}\" >> \"${EXP_GENERATED}\"\n fi\ndone\n\nif [[ \"${WK_BUILD_FOR_TESTIN
G}\" == \"YES\" ]]; then\n cat \"${PROJECT_DIR}/mac/WebKit.Testing.exp\" >> \"${EXP_GENERATED}\"\nfi\n";
};
1C6CB0510AA63EB000D23BFD /* Migrate Headers */ = {
isa = PBXShellScriptBuildPhase;
Modified: trunk/Source/WebKitLegacy/mac/ChangeLog (269331 => 269332)
--- trunk/Source/WebKitLegacy/mac/ChangeLog 2020-11-03 21:24:17 UTC (rev 269331)
+++ trunk/Source/WebKitLegacy/mac/ChangeLog 2020-11-03 21:37:13 UTC (rev 269332)
@@ -1,3 +1,46 @@
+2020-11-03 David Kilzer <[email protected]>
+
+ Add test for cacheModelForMainBundle() in WebKitLegacy
+ <https://webkit.org/b/217960>
+
+ Reviewed by Darin Adler.
+
+ * Configurations/DebugRelease.xcconfig:
+ (WK_BUILD_FOR_TESTING): Add.
+ - This single setting controls whether test code is built and
+ test functions are exported. Currently only Debug and Release
+ configurations are supported.
+
+ * Configurations/WebKitLegacy.xcconfig:
+ (OTHER_CFLAGS):
+ - Include necessary macro definition when WK_BUILD_FOR_TESTING
+ is YES.
+ (WK_CFLAGS_BUILD_FOR_TESTING_YES):
+ - Define macro set when WK_BUILD_FOR_TESTING is YES. Used by
+ both OTHER_CFLAGS and OTHER_TAPI_FLAGS to enable test code.
+ (OTHER_TAPI_FLAGS[sdk=iphone*]):
+ - Include necessary macro definition when WK_BUILD_FOR_TESTING
+ is YES.
+ - Add -extra-private-header argument to declare exported
+ functions in TestingFunctions.h when WK_BUILD_FOR_TESTING is
+ YES.
+
+ * TestingFunctions.h: Add.
+ - Declare functions exported when WK_BUILD_FOR_TESTING is YES.
+
+ * WebKit.Testing.exp: Add.
+ - This contains a list of test functions that are only exported
+ when WK_BUILD_FOR_TESTING is YES.
+
+ * WebView/WebPreferences.mm:
+ (cacheModelForMainBundle):
+ - Add NSString *bundleIdentifier argument to make testable.
+ (TestWebPreferencesCacheModelForMainBundle): Add.
+ - Add function only used for testing, and only compiled when
+ WK_BUILD_FOR_TESTING is YES.
+ (+[WebPreferences initialize]):
+ - Change to pass main bundle identifier as argument.
+
2020-11-02 Sam Weinig <[email protected]>
[Testing] Match WebKitTestRunner and enable all "experimental" features in DumpRenderTree (cocoa)
Modified: trunk/Source/WebKitLegacy/mac/Configurations/DebugRelease.xcconfig (269331 => 269332)
--- trunk/Source/WebKitLegacy/mac/Configurations/DebugRelease.xcconfig 2020-11-03 21:24:17 UTC (rev 269331)
+++ trunk/Source/WebKitLegacy/mac/Configurations/DebugRelease.xcconfig 2020-11-03 21:37:13 UTC (rev 269332)
@@ -56,6 +56,8 @@
SDKROOT_ = macosx;
SDKROOT_YES = macosx.internal;
+WK_BUILD_FOR_TESTING = YES;
+
WK_RELOCATABLE_FRAMEWORKS = YES;
WK_DEFAULT_LTO_MODE = $(WK_USER_LTO_MODE_none);
Modified: trunk/Source/WebKitLegacy/mac/Configurations/WebKitLegacy.xcconfig (269331 => 269332)
--- trunk/Source/WebKitLegacy/mac/Configurations/WebKitLegacy.xcconfig 2020-11-03 21:24:17 UTC (rev 269331)
+++ trunk/Source/WebKitLegacy/mac/Configurations/WebKitLegacy.xcconfig 2020-11-03 21:37:13 UTC (rev 269332)
@@ -42,11 +42,13 @@
SYSTEM_FRAMEWORK_SEARCH_PATHS = $(inherited) $(SDKROOT)$(SYSTEM_LIBRARY_DIR)/PrivateFrameworks $(SDKROOT)$(SYSTEM_LIBRARY_DIR)/Frameworks;
-OTHER_CFLAGS = $(inherited) $(OTHER_CFLAGS_COCOA_TOUCH);
+OTHER_CFLAGS = $(inherited) $(OTHER_CFLAGS_COCOA_TOUCH) $(WK_CFLAGS_BUILD_FOR_TESTING_$(WK_BUILD_FOR_TESTING));
OTHER_CFLAGS_COCOA_TOUCH = $(OTHER_CFLAGS_COCOA_TOUCH_$(WK_IS_COCOA_TOUCH));
OTHER_CFLAGS_COCOA_TOUCH_NO = -iframework $(SDKROOT)$(SYSTEM_LIBRARY_DIR)/Frameworks/WebKit.framework/Frameworks;
OTHER_CPLUSPLUSFLAGS = $(inherited) $(OTHER_CFLAGS_COCOA_TOUCH);
+WK_CFLAGS_BUILD_FOR_TESTING_YES = -DENABLE_BUILD_FOR_TESTING;
+
GCC_PREFIX_HEADER = mac/WebKitPrefix.h;
GCC_PREPROCESSOR_DEFINITIONS = $(DEBUG_DEFINES) BUILDING_WEBKIT FRAMEWORK_NAME=WebKitLegacy $(inherited);
@@ -149,5 +151,5 @@
SUPPORTS_TEXT_BASED_API[sdk=iphone*] = YES;
SUPPORTS_TEXT_BASED_API[sdk=appletv*] = NO;
SUPPORTS_TEXT_BASED_API[sdk=watch*] = NO;
-OTHER_TAPI_FLAGS[sdk=iphone*] = -x objective-c++ -std=gnu++1z -fno-rtti -DRELEASE_WITHOUT_OPTIMIZATIONS -exclude-private-header $(BUILT_PRODUCTS_DIR)/$(PRIVATE_HEADERS_FOLDER_PATH)/NSURLDownloadSPI.h;
+OTHER_TAPI_FLAGS[sdk=iphone*] = -x objective-c++ -std=gnu++1z -fno-rtti $(WK_CFLAGS_BUILD_FOR_TESTING_$(WK_BUILD_FOR_TESTING)) -DRELEASE_WITHOUT_OPTIMIZATIONS -exclude-private-header $(BUILT_PRODUCTS_DIR)/$(PRIVATE_HEADERS_FOLDER_PATH)/NSURLDownloadSPI.h -extra-private-header $(SOURCE_ROOT)/mac/TestingFunctions.h;
TAPI_VERIFY_MODE[sdk=iphone*] = Pedantic;
Added: trunk/Source/WebKitLegacy/mac/TestingFunctions.h (0 => 269332)
--- trunk/Source/WebKitLegacy/mac/TestingFunctions.h (rev 0)
+++ trunk/Source/WebKitLegacy/mac/TestingFunctions.h 2020-11-03 21:37:13 UTC (rev 269332)
@@ -0,0 +1,38 @@
+/*
+ * Copyright (C) 2020 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
+
+#include <Foundation/Foundation.h>
+#include <WebKitLegacy/WebPreferences.h>
+#include <wtf/Compiler.h>
+#include <wtf/Platform.h>
+
+#if ENABLE(BUILD_FOR_TESTING)
+
+WTF_EXTERN_C_BEGIN
+WebCacheModel TestWebPreferencesCacheModelForMainBundle(NSString *bundleIdentifier);
+WTF_EXTERN_C_END
+
+#endif // ENABLE(BUILD_FOR_TESTING)
Added: trunk/Source/WebKitLegacy/mac/WebKit.Testing.exp (0 => 269332)
--- trunk/Source/WebKitLegacy/mac/WebKit.Testing.exp (rev 0)
+++ trunk/Source/WebKitLegacy/mac/WebKit.Testing.exp 2020-11-03 21:37:13 UTC (rev 269332)
@@ -0,0 +1 @@
+_TestWebPreferencesCacheModelForMainBundle
Modified: trunk/Source/WebKitLegacy/mac/WebView/WebPreferences.mm (269331 => 269332)
--- trunk/Source/WebKitLegacy/mac/WebView/WebPreferences.mm 2020-11-03 21:24:17 UTC (rev 269331)
+++ trunk/Source/WebKitLegacy/mac/WebView/WebPreferences.mm 2020-11-03 21:37:13 UTC (rev 269332)
@@ -30,6 +30,7 @@
#import "WebPreferencesInternal.h"
#import "NetworkStorageSessionMap.h"
+#import "TestingFunctions.h"
#import "WebApplicationCache.h"
#import "WebFeature.h"
#import "WebFrameNetworkingContext.h"
@@ -50,6 +51,7 @@
#import <WebCore/TextEncodingRegistry.h>
#import <WebCore/WebCoreJITOperations.h>
#import <pal/spi/cf/CFNetworkSPI.h>
+#import <wtf/Compiler.h>
#import <wtf/MainThread.h>
#import <wtf/RetainPtr.h>
#import <wtf/RunLoop.h>
@@ -88,7 +90,7 @@
return false;
}
-static WebCacheModel cacheModelForMainBundle(void)
+static WebCacheModel cacheModelForMainBundle(NSString *bundleIdentifier)
{
@autoreleasepool {
// Apps that probably need the small setting
@@ -139,7 +141,7 @@
"net.hmdt-web.Shiira",
};
- const char* bundleID = [[[NSBundle mainBundle] bundleIdentifier] UTF8String];
+ const char* bundleID = [bundleIdentifier UTF8String];
if (contains(documentViewerIDs, bundleID))
return WebCacheModelDocumentViewer;
if (contains(documentBrowserIDs, bundleID))
@@ -163,6 +165,13 @@
}
}
+#if ENABLE(BUILD_FOR_TESTING)
+WebCacheModel TestWebPreferencesCacheModelForMainBundle(NSString *bundleIdentifier)
+{
+ return cacheModelForMainBundle(bundleIdentifier);
+}
+#endif // ENABLE(BUILD_FOR_TESTING)
+
@interface WebPreferences ()
- (void)_postCacheModelChangedNotification;
@end
@@ -391,7 +400,7 @@
@YES, WebKitAllowAnimatedImageLoopingPreferenceKey,
@"1800", WebKitBackForwardCacheExpirationIntervalKey,
@NO, WebKitPrivateBrowsingEnabledPreferenceKey,
- @(cacheModelForMainBundle()), WebKitCacheModelPreferenceKey,
+ @(cacheModelForMainBundle([[NSBundle mainBundle] bundleIdentifier])), WebKitCacheModelPreferenceKey,
@YES, WebKitZoomsTextOnlyPreferenceKey,
@YES, WebKitForceWebGLUsesLowPowerPreferenceKey,
@NO, WebKitUsePreHTML5ParserQuirksKey,
Modified: trunk/Tools/ChangeLog (269331 => 269332)
--- trunk/Tools/ChangeLog 2020-11-03 21:24:17 UTC (rev 269331)
+++ trunk/Tools/ChangeLog 2020-11-03 21:37:13 UTC (rev 269332)
@@ -1,3 +1,16 @@
+2020-11-03 David Kilzer <[email protected]>
+
+ Add test for cacheModelForMainBundle() in WebKitLegacy
+ <https://webkit.org/b/217960>
+
+ Reviewed by Darin Adler.
+
+ * TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj:
+ - Add WebPreferencesTest.mm to project.
+ * TestWebKitAPI/Tests/WebKitLegacy/cocoa/WebPreferencesTest.mm: Add.
+ (TestWebKitAPI::TEST):
+ - Add test for TestWebPreferencesCacheModelForMainBundle().
+
2020-11-03 Adam Roben <[email protected]>
Add SwiftUI MiniBrowser
Modified: trunk/Tools/TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj (269331 => 269332)
--- trunk/Tools/TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj 2020-11-03 21:24:17 UTC (rev 269331)
+++ trunk/Tools/TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj 2020-11-03 21:37:13 UTC (rev 269332)
@@ -240,6 +240,7 @@
41882F0321010C0D002FF288 /* ProcessPreWarming.mm in Sources */ = {isa = PBXBuildFile; fileRef = 41882F0221010A70002FF288 /* ProcessPreWarming.mm */; };
44077BB123144B5000179E2D /* DataDetectorsTestIOS.mm in Sources */ = {isa = PBXBuildFile; fileRef = 44077BB0231449D200179E2D /* DataDetectorsTestIOS.mm */; };
4433A396208044140091ED57 /* SynchronousTimeoutTests.mm in Sources */ = {isa = PBXBuildFile; fileRef = 4433A395208044130091ED57 /* SynchronousTimeoutTests.mm */; };
+ 448110C2253F40300097FC33 /* WebPreferencesTest.mm in Sources */ = {isa = PBXBuildFile; fileRef = 448110C1253F40240097FC33 /* WebPreferencesTest.mm */; };
44817A2F1F0486BF00003810 /* WKRequestActivatedElementInfo.mm in Sources */ = {isa = PBXBuildFile; fileRef = 44817A2E1F0486BF00003810 /* WKRequestActivatedElementInfo.mm */; };
448D7E471EA6C55500ECC756 /* EnvironmentUtilitiesTest.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 448D7E451EA6C55500ECC756 /* EnvironmentUtilitiesTest.cpp */; };
44AC8BC621D0245A00CAFB34 /* RetainPtr.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BC029B161486AD6400817DA9 /* RetainPtr.cpp */; };
@@ -1957,6 +1958,7 @@
44077BB0231449D200179E2D /* DataDetectorsTestIOS.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = DataDetectorsTestIOS.mm; sourceTree = "<group>"; };
442BBF681C91CAD90017087F /* RefLogger.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = RefLogger.cpp; sourceTree = "<group>"; };
4433A395208044130091ED57 /* SynchronousTimeoutTests.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = SynchronousTimeoutTests.mm; sourceTree = "<group>"; };
+ 448110C1253F40240097FC33 /* WebPreferencesTest.mm */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.objcpp; name = WebPreferencesTest.mm; path = WebPreferencesTest.mm; sourceTree = "<group>"; };
44817A2E1F0486BF00003810 /* WKRequestActivatedElementInfo.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = WKRequestActivatedElementInfo.mm; sourceTree = "<group>"; };
448D7E451EA6C55500ECC756 /* EnvironmentUtilitiesTest.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = EnvironmentUtilitiesTest.cpp; sourceTree = "<group>"; };
44A622C114A0E2B60048515B /* WTFStringUtilities.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WTFStringUtilities.h; sourceTree = "<group>"; };
@@ -3525,6 +3527,14 @@
path = WebCore;
sourceTree = "<group>";
};
+ 448110BF253F3F8D0097FC33 /* cocoa */ = {
+ isa = PBXGroup;
+ children = (
+ 448110C1253F40240097FC33 /* WebPreferencesTest.mm */,
+ );
+ path = cocoa;
+ sourceTree = "<group>";
+ };
51EB125D24CA6B3E000CB030 /* GamepadMappings */ = {
isa = PBXGroup;
children = (
@@ -4602,6 +4612,7 @@
CDC8E4981BC728AE00594FEC /* WebKitLegacy */ = {
isa = PBXGroup;
children = (
+ 448110BF253F3F8D0097FC33 /* cocoa */,
CDC8E4991BC728C000594FEC /* ios */,
9BD5111A1FE8E10200D2B630 /* mac */,
);
@@ -5502,6 +5513,7 @@
5C973F5C1F58EF8B00359C27 /* WebGLPolicy.mm in Sources */,
31E9BDA1247F4C62002E51A2 /* WebGLPrepareDisplayOnWebThread.mm in Sources */,
7CCE7EAB1A411A2400447C4C /* WebKitAgnosticTest.mm in Sources */,
+ 448110C2253F40300097FC33 /* WebPreferencesTest.mm in Sources */,
51714EB81CF8CA17004723C4 /* WebProcessKillIDBCleanup.mm in Sources */,
536770341CC8022800D425B1 /* WebScriptObjectDescription.mm in Sources */,
5120C83D1E6751290025B250 /* WebsiteDataStoreCustomPaths.mm in Sources */,
Added: trunk/Tools/TestWebKitAPI/Tests/WebKitLegacy/cocoa/WebPreferencesTest.mm (0 => 269332)
--- trunk/Tools/TestWebKitAPI/Tests/WebKitLegacy/cocoa/WebPreferencesTest.mm (rev 0)
+++ trunk/Tools/TestWebKitAPI/Tests/WebKitLegacy/cocoa/WebPreferencesTest.mm 2020-11-03 21:37:13 UTC (rev 269332)
@@ -0,0 +1,86 @@
+/*
+ * Copyright (C) 2020 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.
+ */
+
+#import "config.h"
+
+#import <Foundation/Foundation.h>
+#import <WebKit/WebPreferences.h>
+
+WTF_EXTERN_C_BEGIN
+WebCacheModel TestWebPreferencesCacheModelForMainBundle(NSString *bundleIdentifier);
+WTF_EXTERN_C_END
+
+namespace TestWebKitAPI {
+
+TEST(WebKitLegacy, CacheModelForMainBundle)
+{
+ EXPECT_EQ(WebCacheModelDocumentViewer, TestWebPreferencesCacheModelForMainBundle(@"Microsoft/com.microsoft.Messenger"));
+ EXPECT_EQ(WebCacheModelDocumentViewer, TestWebPreferencesCacheModelForMainBundle(@"com.adiumX.adiumX"));
+ EXPECT_EQ(WebCacheModelDocumentViewer, TestWebPreferencesCacheModelForMainBundle(@"com.alientechnology.Proteus"));
+ EXPECT_EQ(WebCacheModelDocumentViewer, TestWebPreferencesCacheModelForMainBundle(@"com.apple.Dashcode"));
+ EXPECT_EQ(WebCacheModelDocumentViewer, TestWebPreferencesCacheModelForMainBundle(@"com.apple.iChat"));
+ EXPECT_EQ(WebCacheModelDocumentViewer, TestWebPreferencesCacheModelForMainBundle(@"com.barebones.bbedit"));
+ EXPECT_EQ(WebCacheModelDocumentViewer, TestWebPreferencesCacheModelForMainBundle(@"com.barebones.textwrangler"));
+ EXPECT_EQ(WebCacheModelDocumentViewer, TestWebPreferencesCacheModelForMainBundle(@"com.barebones.yojimbo"));
+ EXPECT_EQ(WebCacheModelDocumentViewer, TestWebPreferencesCacheModelForMainBundle(@"com.equinux.iSale4"));
+ EXPECT_EQ(WebCacheModelDocumentViewer, TestWebPreferencesCacheModelForMainBundle(@"com.growl.growlframework"));
+ EXPECT_EQ(WebCacheModelDocumentViewer, TestWebPreferencesCacheModelForMainBundle(@"com.intrarts.PandoraMan"));
+ EXPECT_EQ(WebCacheModelDocumentViewer, TestWebPreferencesCacheModelForMainBundle(@"com.karelia.Sandvox"));
+ EXPECT_EQ(WebCacheModelDocumentViewer, TestWebPreferencesCacheModelForMainBundle(@"com.macromates.textmate"));
+ EXPECT_EQ(WebCacheModelDocumentViewer, TestWebPreferencesCacheModelForMainBundle(@"com.realmacsoftware.rapidweaverpro"));
+ EXPECT_EQ(WebCacheModelDocumentViewer, TestWebPreferencesCacheModelForMainBundle(@"com.red-sweater.marsedit"));
+ EXPECT_EQ(WebCacheModelDocumentViewer, TestWebPreferencesCacheModelForMainBundle(@"com.yahoo.messenger3"));
+ EXPECT_EQ(WebCacheModelDocumentViewer, TestWebPreferencesCacheModelForMainBundle(@"de.codingmonkeys.SubEthaEdit"));
+ EXPECT_EQ(WebCacheModelDocumentViewer, TestWebPreferencesCacheModelForMainBundle(@"fi.karppinen.Pyro"));
+ EXPECT_EQ(WebCacheModelDocumentViewer, TestWebPreferencesCacheModelForMainBundle(@"info.colloquy"));
+ EXPECT_EQ(WebCacheModelDocumentViewer, TestWebPreferencesCacheModelForMainBundle(@"kungfoo.tv.ecto"));
+
+ EXPECT_EQ(WebCacheModelDocumentBrowser, TestWebPreferencesCacheModelForMainBundle(@"com.apple.Dictionary"));
+ EXPECT_EQ(WebCacheModelDocumentBrowser, TestWebPreferencesCacheModelForMainBundle(@"com.apple.Xcode"));
+ EXPECT_EQ(WebCacheModelDocumentBrowser, TestWebPreferencesCacheModelForMainBundle(@"com.apple.helpviewer"));
+ EXPECT_EQ(WebCacheModelDocumentBrowser, TestWebPreferencesCacheModelForMainBundle(@"com.culturedcode.xyle"));
+ EXPECT_EQ(WebCacheModelDocumentBrowser, TestWebPreferencesCacheModelForMainBundle(@"com.macrabbit.CSSEdit"));
+ EXPECT_EQ(WebCacheModelDocumentBrowser, TestWebPreferencesCacheModelForMainBundle(@"com.panic.Coda"));
+ EXPECT_EQ(WebCacheModelDocumentBrowser, TestWebPreferencesCacheModelForMainBundle(@"com.ranchero.NetNewsWire"));
+ EXPECT_EQ(WebCacheModelDocumentBrowser, TestWebPreferencesCacheModelForMainBundle(@"com.thinkmac.NewsLife"));
+ EXPECT_EQ(WebCacheModelDocumentBrowser, TestWebPreferencesCacheModelForMainBundle(@"org.xlife.NewsFire"));
+ EXPECT_EQ(WebCacheModelDocumentBrowser, TestWebPreferencesCacheModelForMainBundle(@"uk.co.opencommunity.vienna2"));
+
+ EXPECT_EQ(WebCacheModelPrimaryWebBrowser, TestWebPreferencesCacheModelForMainBundle(@"com.app4mac.KidsBrowser"));
+ EXPECT_EQ(WebCacheModelPrimaryWebBrowser, TestWebPreferencesCacheModelForMainBundle(@"com.app4mac.wKiosk"));
+ EXPECT_EQ(WebCacheModelPrimaryWebBrowser, TestWebPreferencesCacheModelForMainBundle(@"com.freeverse.bumpercar"));
+ EXPECT_EQ(WebCacheModelPrimaryWebBrowser, TestWebPreferencesCacheModelForMainBundle(@"com.omnigroup.OmniWeb5"));
+ EXPECT_EQ(WebCacheModelPrimaryWebBrowser, TestWebPreferencesCacheModelForMainBundle(@"com.sunrisebrowser.Sunrise"));
+ EXPECT_EQ(WebCacheModelPrimaryWebBrowser, TestWebPreferencesCacheModelForMainBundle(@"net.hmdt-web.Shiira"));
+
+ // Test bundle identifiers that are not hard-coded.
+ EXPECT_EQ(WebCacheModelDocumentViewer, TestWebPreferencesCacheModelForMainBundle(nil));
+ EXPECT_EQ(WebCacheModelDocumentViewer, TestWebPreferencesCacheModelForMainBundle(@""));
+ EXPECT_EQ(WebCacheModelDocumentViewer, TestWebPreferencesCacheModelForMainBundle(@"com"));
+ EXPECT_EQ(WebCacheModelDocumentViewer, TestWebPreferencesCacheModelForMainBundle(@"com.apple.Safari"));
+ EXPECT_EQ(WebCacheModelDocumentViewer, TestWebPreferencesCacheModelForMainBundle(@"com.apple.SafariTechnologyPreview"));
+}
+
+}