Changeset 70194 in webkit
- Timestamp:
- Oct 20, 2010 5:22:13 PM (14 years ago)
- Location:
- trunk/WebKitTools
- Files:
-
- 9 added
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/WebKitTools/ChangeLog
r70193 r70194 1 2010-10-20 Sam Weinig <sam@webkit.org> 2 3 Reviewed by Adam Roben. 4 5 https://bugs.webkit.org/show_bug.cgi?id=48027 6 Add ability to test injected bundle API using TestWebKitAPI 7 8 * TestWebKitAPI/InjectedBundleController.cpp: Added. 9 * TestWebKitAPI/InjectedBundleController.h: Added. 10 Shared main object for bundle functionality. 11 12 * TestWebKitAPI/InjectedBundleMain.cpp: Added. 13 Bundle entry point. 14 15 * TestWebKitAPI/InjectedBundleTest.h: Added. 16 Base class for which the bundle portion of a test derives from. 17 18 * TestWebKitAPI/PlatformUtilities.h: 19 * TestWebKitAPI/PlatformUtilities.cpp: Added. 20 * TestWebKitAPI/mac/PlatformUtilitiesMac.mm: 21 * TestWebKitAPI/win/PlatformUtilitiesWin.cpp: 22 (TestWebKitAPI::Util::createInjectedBundlePath): 23 (TestWebKitAPI::Util::createURLForResource): 24 (TestWebKitAPI::Util::URLForNonExistentResource): 25 Add helper to create a context with the shared injected bundle, 26 and send the initial message to set up the test. 27 28 * TestWebKitAPI/Configurations/InjectedBundle.xcconfig: Added. 29 * TestWebKitAPI/InjectedBundle-Info.plist: Added. 30 Add mac configuration files. 31 32 * TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj: 33 Add the new files. 34 35 * TestWebKitAPI/Tests/WebKit2/InjectedBundleBasic.cpp: Added. 36 * TestWebKitAPI/Tests/WebKit2/InjectedBundleBasic_Bundle.cpp: Added. 37 Add a simple initial bundle test. 38 1 39 2010-10-20 Eric Seidel <eric@webkit.org> 2 40 -
trunk/WebKitTools/TestWebKitAPI/PlatformUtilities.h
r69671 r70194 27 27 #define PlatformUtilities_h 28 28 29 #include <WebKit2/W KString.h>29 #include <WebKit2/WebKit2.h> 30 30 #include <string> 31 #include <wtf/OwnArrayPtr.h>32 #include <wtf/PassOwnArrayPtr.h>33 31 34 32 namespace TestWebKitAPI { … … 38 36 void run(bool* done); 39 37 38 WKContextRef createContextForInjectedBundleTest(const std::string&); 39 40 WKStringRef createInjectedBundlePath(); 40 41 WKURLRef createURLForResource(const char* resource, const char* extension); 41 42 WKURLRef URLForNonExistentResource(); … … 43 44 bool isKeyDown(WKNativeEventPtr); 44 45 45 inline std::string toSTD(WKStringRef string) 46 { 47 size_t bufferSize = WKStringGetMaximumUTF8CStringSize(string); 48 OwnArrayPtr<char> buffer = adoptArrayPtr(new char[bufferSize]); 49 size_t stringLength = WKStringGetUTF8CString(string, buffer.get(), bufferSize); 50 return std::string(buffer.get(), stringLength - 1); 51 } 46 std::string toSTD(WKStringRef string); 52 47 53 48 } // namespace Util -
trunk/WebKitTools/TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj
r69671 r70194 13 13 BC131A9B1171316900B69727 /* main.mm in Sources */ = {isa = PBXBuildFile; fileRef = BC131A9A1171316900B69727 /* main.mm */; }; 14 14 BC131AA9117131FC00B69727 /* TestsController.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BC131AA8117131FC00B69727 /* TestsController.cpp */; }; 15 BC575A90126E74D3006F0F12 /* Cocoa.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = BCB9E9F011235BDE00A137E0 /* Cocoa.framework */; }; 16 BC575A91126E74D3006F0F12 /* WebKit2.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = BCA61DB411700EFD00460D1E /* WebKit2.framework */; }; 17 BC575A92126E74D3006F0F12 /* JavaScriptCore.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = BC90964D1255620C00083756 /* JavaScriptCore.framework */; }; 18 BC575A97126E74F1006F0F12 /* InjectedBundleMain.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BC575946126E7351006F0F12 /* InjectedBundleMain.cpp */; }; 19 BC575AA2126E7660006F0F12 /* InjectedBundleController.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BC575AA0126E7657006F0F12 /* InjectedBundleController.cpp */; }; 20 BC575AAD126E83B9006F0F12 /* InjectedBundleBasic.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BC575AAC126E83B9006F0F12 /* InjectedBundleBasic.cpp */; }; 21 BC575AB0126E83C8006F0F12 /* InjectedBundleBasic_Bundle.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BC575AAF126E83C8006F0F12 /* InjectedBundleBasic_Bundle.cpp */; }; 22 BC575BC0126F5752006F0F12 /* PlatformUtilities.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BC575BBF126F5752006F0F12 /* PlatformUtilities.cpp */; }; 23 BC575BD9126F58E2006F0F12 /* PlatformUtilities.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BC575BBF126F5752006F0F12 /* PlatformUtilities.cpp */; }; 24 BC575BE0126F590D006F0F12 /* PlatformUtilitiesMac.mm in Sources */ = {isa = PBXBuildFile; fileRef = BC131884117114B600B69727 /* PlatformUtilitiesMac.mm */; }; 15 25 BC90955D125548AA00083756 /* PlatformWebViewMac.mm in Sources */ = {isa = PBXBuildFile; fileRef = BC90955C125548AA00083756 /* PlatformWebViewMac.mm */; }; 16 26 BC90964C125561BF00083756 /* VectorBasic.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BC90964B125561BF00083756 /* VectorBasic.cpp */; }; … … 31 41 /* End PBXBuildFile section */ 32 42 43 /* Begin PBXContainerItemProxy section */ 44 BC575A95126E74E7006F0F12 /* PBXContainerItemProxy */ = { 45 isa = PBXContainerItemProxy; 46 containerPortal = 08FB7793FE84155DC02AAC07 /* Project object */; 47 proxyType = 1; 48 remoteGlobalIDString = BC57597F126E74AF006F0F12 /* InjectedBundle */; 49 remoteInfo = InjectedBundle; 50 }; 51 /* End PBXContainerItemProxy section */ 52 33 53 /* Begin PBXCopyFilesBuildPhase section */ 34 54 8DD76F9E0486AA7600D96B5E /* CopyFiles */ = { … … 66 86 BC131A9E1171317C00B69727 /* TestWebKitAPIPrefix.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = TestWebKitAPIPrefix.h; sourceTree = "<group>"; }; 67 87 BC131AA8117131FC00B69727 /* TestsController.cpp */ = {isa = PBXFileReference; explicitFileType = sourcecode.cpp.cpp; fileEncoding = 4; path = TestsController.cpp; sourceTree = "<group>"; }; 88 BC575946126E7351006F0F12 /* InjectedBundleMain.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = InjectedBundleMain.cpp; sourceTree = "<group>"; }; 89 BC575980126E74AF006F0F12 /* InjectedBundle.bundle */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = InjectedBundle.bundle; sourceTree = BUILT_PRODUCTS_DIR; }; 90 BC575981126E74AF006F0F12 /* InjectedBundle-Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = "InjectedBundle-Info.plist"; sourceTree = "<group>"; }; 91 BC575A9E126E75FB006F0F12 /* InjectedBundleTest.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = InjectedBundleTest.h; sourceTree = "<group>"; }; 92 BC575A9F126E7657006F0F12 /* InjectedBundleController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = InjectedBundleController.h; sourceTree = "<group>"; }; 93 BC575AA0126E7657006F0F12 /* InjectedBundleController.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = InjectedBundleController.cpp; sourceTree = "<group>"; }; 94 BC575AAC126E83B9006F0F12 /* InjectedBundleBasic.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = InjectedBundleBasic.cpp; sourceTree = "<group>"; }; 95 BC575AAF126E83C8006F0F12 /* InjectedBundleBasic_Bundle.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = InjectedBundleBasic_Bundle.cpp; sourceTree = "<group>"; }; 96 BC575AE2126E88B1006F0F12 /* InjectedBundle.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; path = InjectedBundle.xcconfig; sourceTree = "<group>"; }; 97 BC575BBF126F5752006F0F12 /* PlatformUtilities.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = PlatformUtilities.cpp; sourceTree = "<group>"; }; 68 98 BC90951B125533D700083756 /* PlatformWebView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PlatformWebView.h; sourceTree = "<group>"; }; 69 99 BC90955C125548AA00083756 /* PlatformWebViewMac.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = PlatformWebViewMac.mm; sourceTree = "<group>"; }; … … 102 132 runOnlyForDeploymentPostprocessing = 0; 103 133 }; 134 BC57597E126E74AF006F0F12 /* Frameworks */ = { 135 isa = PBXFrameworksBuildPhase; 136 buildActionMask = 2147483647; 137 files = ( 138 BC575A90126E74D3006F0F12 /* Cocoa.framework in Frameworks */, 139 BC575A91126E74D3006F0F12 /* WebKit2.framework in Frameworks */, 140 BC575A92126E74D3006F0F12 /* JavaScriptCore.framework in Frameworks */, 141 ); 142 runOnlyForDeploymentPostprocessing = 0; 143 }; 104 144 /* End PBXFrameworksBuildPhase section */ 105 145 … … 113 153 08FB779DFE84155DC02AAC07 /* External Frameworks and Libraries */, 114 154 1AB674ADFE9D54B511CA2CBB /* Products */, 155 BC575981126E74AF006F0F12 /* InjectedBundle-Info.plist */, 115 156 ); 116 157 name = TestWebKitAPI; … … 121 162 children = ( 122 163 BCA61C3A11700B9400460D1E /* mac */, 164 BC575944126E733C006F0F12 /* InjectedBundle */, 123 165 BC131A9E1171317C00B69727 /* TestWebKitAPIPrefix.h */, 166 BC575BBF126F5752006F0F12 /* PlatformUtilities.cpp */, 124 167 BC131883117114A800B69727 /* PlatformUtilities.h */, 125 168 BC90951B125533D700083756 /* PlatformWebView.h */, … … 146 189 children = ( 147 190 8DD76FA10486AA7600D96B5E /* TestWebKitAPI */, 191 BC575980126E74AF006F0F12 /* InjectedBundle.bundle */, 148 192 ); 149 193 name = Products; 194 sourceTree = "<group>"; 195 }; 196 BC575944126E733C006F0F12 /* InjectedBundle */ = { 197 isa = PBXGroup; 198 children = ( 199 BC575946126E7351006F0F12 /* InjectedBundleMain.cpp */, 200 BC575A9E126E75FB006F0F12 /* InjectedBundleTest.h */, 201 BC575A9F126E7657006F0F12 /* InjectedBundleController.h */, 202 BC575AA0126E7657006F0F12 /* InjectedBundleController.cpp */, 203 ); 204 name = InjectedBundle; 150 205 sourceTree = "<group>"; 151 206 }; … … 155 210 BC90957E12554CF900083756 /* Base.xcconfig */, 156 211 BC90957F12554CF900083756 /* DebugRelease.xcconfig */, 212 BC575AE2126E88B1006F0F12 /* InjectedBundle.xcconfig */, 157 213 BC90958012554CF900083756 /* TestWebKitAPI.xcconfig */, 158 214 ); … … 172 228 BC9099931256ACF100083756 /* WKStringJSString.cpp */, 173 229 BCC8B95A12611F4700DE46A4 /* FailedLoad.cpp */, 230 BC575AAC126E83B9006F0F12 /* InjectedBundleBasic.cpp */, 231 BC575AAF126E83C8006F0F12 /* InjectedBundleBasic_Bundle.cpp */, 174 232 ); 175 233 path = WebKit2; … … 229 287 ); 230 288 dependencies = ( 289 BC575A96126E74E7006F0F12 /* PBXTargetDependency */, 231 290 ); 232 291 name = TestWebKitAPI; … … 235 294 productReference = 8DD76FA10486AA7600D96B5E /* TestWebKitAPI */; 236 295 productType = "com.apple.product-type.tool"; 296 }; 297 BC57597F126E74AF006F0F12 /* InjectedBundle */ = { 298 isa = PBXNativeTarget; 299 buildConfigurationList = BC575986126E74AF006F0F12 /* Build configuration list for PBXNativeTarget "InjectedBundle" */; 300 buildPhases = ( 301 BC57597C126E74AF006F0F12 /* Resources */, 302 BC57597D126E74AF006F0F12 /* Sources */, 303 BC57597E126E74AF006F0F12 /* Frameworks */, 304 ); 305 buildRules = ( 306 ); 307 dependencies = ( 308 ); 309 name = InjectedBundle; 310 productName = InjectedBundle; 311 productReference = BC575980126E74AF006F0F12 /* InjectedBundle.bundle */; 312 productType = "com.apple.product-type.bundle"; 237 313 }; 238 314 /* End PBXNativeTarget section */ … … 256 332 targets = ( 257 333 8DD76F960486AA7600D96B5E /* TestWebKitAPI */, 334 BC57597F126E74AF006F0F12 /* InjectedBundle */, 258 335 ); 259 336 }; 260 337 /* End PBXProject section */ 338 339 /* Begin PBXResourcesBuildPhase section */ 340 BC57597C126E74AF006F0F12 /* Resources */ = { 341 isa = PBXResourcesBuildPhase; 342 buildActionMask = 2147483647; 343 files = ( 344 ); 345 runOnlyForDeploymentPostprocessing = 0; 346 }; 347 /* End PBXResourcesBuildPhase section */ 261 348 262 349 /* Begin PBXSourcesBuildPhase section */ … … 278 365 BCC8B95B12611F4700DE46A4 /* FailedLoad.cpp in Sources */, 279 366 C02B77F2126612140026BF0F /* SpacebarScrolling.cpp in Sources */, 367 BC575AAD126E83B9006F0F12 /* InjectedBundleBasic.cpp in Sources */, 368 BC575BC0126F5752006F0F12 /* PlatformUtilities.cpp in Sources */, 369 ); 370 runOnlyForDeploymentPostprocessing = 0; 371 }; 372 BC57597D126E74AF006F0F12 /* Sources */ = { 373 isa = PBXSourcesBuildPhase; 374 buildActionMask = 2147483647; 375 files = ( 376 BC575A97126E74F1006F0F12 /* InjectedBundleMain.cpp in Sources */, 377 BC575AA2126E7660006F0F12 /* InjectedBundleController.cpp in Sources */, 378 BC575AB0126E83C8006F0F12 /* InjectedBundleBasic_Bundle.cpp in Sources */, 379 BC575BD9126F58E2006F0F12 /* PlatformUtilities.cpp in Sources */, 380 BC575BE0126F590D006F0F12 /* PlatformUtilitiesMac.mm in Sources */, 280 381 ); 281 382 runOnlyForDeploymentPostprocessing = 0; 282 383 }; 283 384 /* End PBXSourcesBuildPhase section */ 385 386 /* Begin PBXTargetDependency section */ 387 BC575A96126E74E7006F0F12 /* PBXTargetDependency */ = { 388 isa = PBXTargetDependency; 389 target = BC57597F126E74AF006F0F12 /* InjectedBundle */; 390 targetProxy = BC575A95126E74E7006F0F12 /* PBXContainerItemProxy */; 391 }; 392 /* End PBXTargetDependency section */ 284 393 285 394 /* Begin XCBuildConfiguration section */ … … 311 420 isa = XCBuildConfiguration; 312 421 baseConfigurationReference = BC90957F12554CF900083756 /* DebugRelease.xcconfig */; 422 buildSettings = { 423 }; 424 name = Release; 425 }; 426 BC575984126E74AF006F0F12 /* Debug */ = { 427 isa = XCBuildConfiguration; 428 baseConfigurationReference = BC575AE2126E88B1006F0F12 /* InjectedBundle.xcconfig */; 429 buildSettings = { 430 }; 431 name = Debug; 432 }; 433 BC575985126E74AF006F0F12 /* Release */ = { 434 isa = XCBuildConfiguration; 435 baseConfigurationReference = BC575AE2126E88B1006F0F12 /* InjectedBundle.xcconfig */; 313 436 buildSettings = { 314 437 }; … … 336 459 defaultConfigurationName = Release; 337 460 }; 461 BC575986126E74AF006F0F12 /* Build configuration list for PBXNativeTarget "InjectedBundle" */ = { 462 isa = XCConfigurationList; 463 buildConfigurations = ( 464 BC575984126E74AF006F0F12 /* Debug */, 465 BC575985126E74AF006F0F12 /* Release */, 466 ); 467 defaultConfigurationIsVisible = 0; 468 defaultConfigurationName = Release; 469 }; 338 470 /* End XCConfigurationList section */ 339 471 }; -
trunk/WebKitTools/TestWebKitAPI/mac/PlatformUtilitiesMac.mm
r69671 r70194 26 26 #include "PlatformUtilities.h" 27 27 28 #include <WebKit2/WKRetainPtr.h> 28 29 #include <WebKit2/WKStringCF.h> 29 30 #include <WebKit2/WKURLCF.h> 31 #include <WebKit2/WebKit2.h> 30 32 31 33 namespace TestWebKitAPI { … … 38 40 } 39 41 42 WKStringRef createInjectedBundlePath() 43 { 44 NSString *nsString = [[[NSBundle mainBundle] bundlePath] stringByAppendingPathComponent:@"InjectedBundle.bundle"]; 45 return WKStringCreateWithCFString((CFStringRef)nsString); 46 } 47 40 48 WKURLRef createURLForResource(const char* resource, const char* extension) 41 49 { 42 NSURL *nsURL = [[NSBundle mainBundle] URLForResource:[NSString stringWithUTF8String:resource] withExtension:[NSString stringWithUTF8String:extension]];50 NSURL *nsURL = [[NSBundle mainBundle] URLForResource:[NSString stringWithUTF8String:resource] withExtension:[NSString stringWithUTF8String:extension]]; 43 51 return WKURLCreateWithCFURL((CFURLRef)nsURL); 44 52 } … … 46 54 WKURLRef URLForNonExistentResource() 47 55 { 48 NSURL *nsURL = [NSURL URLWithString:@"file:///does-not-exist.html"];56 NSURL *nsURL = [NSURL URLWithString:@"file:///does-not-exist.html"]; 49 57 return WKURLCreateWithCFURL((CFURLRef)nsURL); 50 58 } -
trunk/WebKitTools/TestWebKitAPI/win/PlatformUtilitiesWin.cpp
r69671 r70194 32 32 namespace Util { 33 33 34 #if !defined(NDEBUG) && (!defined(DEBUG_INTERNAL) || defined(DEBUG_ALL)) 35 const char* injectedBundleDLL = "\\InjectedBundle_debug.dll"; 36 #else 37 const char* injectedBundleDLL = "\\InjectedBundle.dll"; 38 #endif 39 34 40 void run(bool* done) 35 41 { … … 47 53 { 48 54 return RetainPtr<CFStringRef>(AdoptCF, CFStringCreateWithCString(kCFAllocatorDefault, utf8String, kCFStringEncodingUTF8)); 55 } 56 57 WKStringRef createInjectedBundlePath() 58 { 59 RetainPtr<CFURLRef> executableURL(AdoptCF, CFBundleCopyExecutableURL(CFBundleGetMainBundle())); 60 RetainPtr<CFURLRef> executableContainerURL(AdoptCF, CFURLCreateCopyDeletingLastPathComponent(0, executableURL.get())); 61 RetainPtr<CFStringRef> dllFilename(AdoptCF, CFStringCreateWithCStringNoCopy(0, injectedBundleDLL, kCFStringEncodingWindowsLatin1, 0)); 62 RetainPtr<CFURLRef> bundleURL(AdoptCF, CFURLCreateCopyAppendingPathComponent(0, executableContainerURL.get(), dllFilename.get(), false)); 63 RetainPtr<CFStringRef> bundlePath(AdoptCF, CFURLCopyFileSystemPath(bundleURL.get(), kCFURLWindowsPathStyle)); 64 return WKStringCreateWithCFString(bundlePath.get()); 49 65 } 50 66 -
trunk/WebKitTools/TestWebKitAPI/win/TestWebKitAPI.vcproj
r69788 r70194 484 484 </Filter> 485 485 <File 486 RelativePath="..\PlatformUtilities.cpp" 487 > 488 </File> 489 <File 486 490 RelativePath="..\PlatformUtilities.h" 487 491 >
Note: See TracChangeset
for help on using the changeset viewer.