Diff
Modified: trunk/Tools/ChangeLog (101964 => 101965)
--- trunk/Tools/ChangeLog 2011-12-04 21:16:43 UTC (rev 101964)
+++ trunk/Tools/ChangeLog 2011-12-04 21:25:30 UTC (rev 101965)
@@ -1,3 +1,22 @@
+2011-12-04 Sam Weinig <s...@webkit.org>
+
+ Add tests for RetainPtr::adoptNS/adoptCF
+ https://bugs.webkit.org/show_bug.cgi?id=73470
+
+ Reviewed by Adam Roben and Darin Adler.
+
+ * TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj:
+ * TestWebKitAPI/Tests/WTF/cf/RetainPtr.cpp: Added.
+ (TestWebKitAPI::TEST):
+ Test that adopting using adoptCF creates a RetainPtr with a
+ value whose retain count is 1.
+
+ * TestWebKitAPI/Tests/WTF/ns: Added.
+ * TestWebKitAPI/Tests/WTF/ns/RetainPtr.mm: Added.
+ (TestWebKitAPI::TEST):
+ Test that adopting using adoptNS creates a RetainPtr with a
+ value whose retain count is 1.
+
2011-12-04 Martin Robinson <mrobin...@igalia.com>
[GTK] Include cairo, pixman and gnome-icon-theme in the jhbuild modules
Modified: trunk/Tools/TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj (101964 => 101965)
--- trunk/Tools/TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj 2011-12-04 21:16:43 UTC (rev 101964)
+++ trunk/Tools/TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj 2011-12-04 21:25:30 UTC (rev 101965)
@@ -38,6 +38,8 @@
81B50193140F232300D9EB58 /* StringBuilder.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 81B50192140F232300D9EB58 /* StringBuilder.cpp */; };
939BA91714103412001A01BD /* DeviceScaleFactorOnBack.mm in Sources */ = {isa = PBXBuildFile; fileRef = 939BA91614103412001A01BD /* DeviceScaleFactorOnBack.mm */; };
A7A966DB140ECCC8005EF9B4 /* CheckedArithmeticOperations.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A7A966DA140ECCC8005EF9B4 /* CheckedArithmeticOperations.cpp */; };
+ BC029B181486AD6400817DA9 /* RetainPtr.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BC029B161486AD6400817DA9 /* RetainPtr.cpp */; };
+ BC029B1C1486B25900817DA9 /* RetainPtr.mm in Sources */ = {isa = PBXBuildFile; fileRef = BC029B1B1486B25900817DA9 /* RetainPtr.mm */; };
BC131885117114B600B69727 /* PlatformUtilitiesMac.mm in Sources */ = {isa = PBXBuildFile; fileRef = BC131884117114B600B69727 /* PlatformUtilitiesMac.mm */; };
BC131A9B1171316900B69727 /* main.mm in Sources */ = {isa = PBXBuildFile; fileRef = BC131A9A1171316900B69727 /* main.mm */; };
BC131AA9117131FC00B69727 /* TestsController.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BC131AA8117131FC00B69727 /* TestsController.cpp */; };
@@ -178,6 +180,8 @@
8DD76FA10486AA7600D96B5E /* TestWebKitAPI */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; path = TestWebKitAPI; sourceTree = BUILT_PRODUCTS_DIR; };
939BA91614103412001A01BD /* DeviceScaleFactorOnBack.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = DeviceScaleFactorOnBack.mm; sourceTree = "<group>"; };
A7A966DA140ECCC8005EF9B4 /* CheckedArithmeticOperations.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = CheckedArithmeticOperations.cpp; path = WTF/CheckedArithmeticOperations.cpp; sourceTree = "<group>"; };
+ BC029B161486AD6400817DA9 /* RetainPtr.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = RetainPtr.cpp; sourceTree = "<group>"; };
+ BC029B1B1486B25900817DA9 /* RetainPtr.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; name = RetainPtr.mm; path = WTF/ns/RetainPtr.mm; sourceTree = "<group>"; };
BC131883117114A800B69727 /* PlatformUtilities.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PlatformUtilities.h; sourceTree = "<group>"; };
BC131884117114B600B69727 /* PlatformUtilitiesMac.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = PlatformUtilitiesMac.mm; sourceTree = "<group>"; };
BC131A9A1171316900B69727 /* main.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = main.mm; sourceTree = "<group>"; };
@@ -334,6 +338,14 @@
name = Products;
sourceTree = "<group>";
};
+ BC029B1A1486B23800817DA9 /* ns */ = {
+ isa = PBXGroup;
+ children = (
+ BC029B1B1486B25900817DA9 /* RetainPtr.mm */,
+ );
+ name = ns;
+ sourceTree = "<group>";
+ };
BC3C4C6F14575B1D0025FB62 /* WebKit2 Objective-C */ = {
isa = PBXGroup;
children = (
@@ -414,6 +426,7 @@
BC9096461255618900083756 /* WTF */ = {
isa = PBXGroup;
children = (
+ BC029B1A1486B23800817DA9 /* ns */,
C0991C4F143C7D68007998F2 /* cf */,
0FC6C4CE141034AD005B7F0C /* MetaAllocator.cpp */,
0FC6C4CB141027E0005B7F0C /* RedBlackTree.cpp */,
@@ -518,6 +531,7 @@
isa = PBXGroup;
children = (
C0991C50143C7D68007998F2 /* RetainPtrHashing.cpp */,
+ BC029B161486AD6400817DA9 /* RetainPtr.cpp */,
);
name = cf;
path = WTF/cf;
@@ -668,6 +682,8 @@
3722C8691461E03E00C45D00 /* RenderedImageFromDOMRange.mm in Sources */,
0BCD856A1485C98B00EA2003 /* TemporaryChange.cpp in Sources */,
37A6895F148A9B50005100FA /* SubresourceErrorCrash.mm in Sources */,
+ BC029B181486AD6400817DA9 /* RetainPtr.cpp in Sources */,
+ BC029B1C1486B25900817DA9 /* RetainPtr.mm in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
Added: trunk/Tools/TestWebKitAPI/Tests/WTF/cf/RetainPtr.cpp (0 => 101965)
--- trunk/Tools/TestWebKitAPI/Tests/WTF/cf/RetainPtr.cpp (rev 0)
+++ trunk/Tools/TestWebKitAPI/Tests/WTF/cf/RetainPtr.cpp 2011-12-04 21:25:30 UTC (rev 101965)
@@ -0,0 +1,42 @@
+/*
+ * Copyright (C) 2011 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.
+ * 3. Neither the name of Apple Computer, Inc. ("Apple") nor the names of
+ * its contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE 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 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.
+ */
+
+#include "config.h"
+
+#include <wtf/RetainPtr.h>
+
+namespace TestWebKitAPI {
+
+TEST(RetainPtr, AdoptCF)
+{
+ RetainPtr<CFStringRef> foo = adoptCF(CFStringCreateWithCString(kCFAllocatorDefault, "foo", kCFStringEncodingUTF8));
+
+ EXPECT_EQ(1, CFGetRetainCount(foo.get()));
+}
+
+} // namespace TestWebKitAPI
Added: trunk/Tools/TestWebKitAPI/Tests/WTF/ns/RetainPtr.mm (0 => 101965)
--- trunk/Tools/TestWebKitAPI/Tests/WTF/ns/RetainPtr.mm (rev 0)
+++ trunk/Tools/TestWebKitAPI/Tests/WTF/ns/RetainPtr.mm 2011-12-04 21:25:30 UTC (rev 101965)
@@ -0,0 +1,42 @@
+/*
+ * Copyright (C) 2011 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.
+ * 3. Neither the name of Apple Computer, Inc. ("Apple") nor the names of
+ * its contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE 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 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.
+ */
+
+#include "config.h"
+
+#include <wtf/RetainPtr.h>
+
+namespace TestWebKitAPI {
+
+TEST(RetainPtr, AdoptNS)
+{
+ RetainPtr<NSObject> foo = adoptNS([[NSObject alloc] init]);
+
+ EXPECT_EQ(1, CFGetRetainCount(foo.get()));
+}
+
+} // namespace TestWebKitAPI
Modified: trunk/Tools/TestWebKitAPI/win/TestWebKitAPI.vcproj (101964 => 101965)
--- trunk/Tools/TestWebKitAPI/win/TestWebKitAPI.vcproj 2011-12-04 21:16:43 UTC (rev 101964)
+++ trunk/Tools/TestWebKitAPI/win/TestWebKitAPI.vcproj 2011-12-04 21:25:30 UTC (rev 101965)
@@ -623,14 +623,18 @@
<Filter
Name="WTF"
>
- <Filter
- Name="cf"
- >
- <File
- RelativePath="..\Tests\WTF\cf\RetainPtrHashing.cpp"
- >
- </File>
- </Filter>
+ <Filter
+ Name="cf"
+ >
+ <File
+ RelativePath="..\Tests\WTF\cf\RetainPtrHashing.cpp"
+ >
+ </File>
+ <File
+ RelativePath="..\Tests\WTF\cf\RetainPtr.cpp"
+ >
+ </File>
+ </Filter>
<File
RelativePath="..\Tests\WTF\CheckedArithmeticOperations.cpp"
>