Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(107)

Unified Diff: ios/chrome/common/noarc_block_unittest.mm

Issue 2697613003: Convert ios/chrome/commong/block_unittest.mm to ARC. (Closed)
Patch Set: Duplicate the test for ARC & non-ARC. Created 3 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « ios/chrome/common/block_unittest.mm ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ios/chrome/common/noarc_block_unittest.mm
diff --git a/ios/chrome/common/block_unittest.mm b/ios/chrome/common/noarc_block_unittest.mm
similarity index 88%
copy from ios/chrome/common/block_unittest.mm
copy to ios/chrome/common/noarc_block_unittest.mm
index 3ff46f844670e17057d67ea6eefa6be6e3c4a0d6..defab36e70f2e0a0cb829bd4971ca6379cdb8e7a 100644
--- a/ios/chrome/common/block_unittest.mm
+++ b/ios/chrome/common/noarc_block_unittest.mm
@@ -8,11 +8,17 @@
#include "base/memory/ref_counted.h"
#include "testing/platform_test.h"
+#if defined(__has_feature) && __has_feature(objc_arc)
+#error "This file must not be compiled with ARC."
+#endif
+
// This test verifies assumptions about the murky world of interaction between
// C++ objects and blocks. Just to make sure.
namespace {
+using NoArcBlockTest = PlatformTest;
+
class RefCountedObject : public base::RefCounted<RefCountedObject> {
public:
RefCountedObject() {}
@@ -37,7 +43,7 @@ class RefCountedObject : public base::RefCounted<RefCountedObject> {
virtual ~RefCountedObject() {}
};
-TEST_F(PlatformTest, BlockAndCPlusPlus) {
+TEST_F(NoArcBlockTest, BlockAndCPlusPlus) {
RefCountedObject* object = new RefCountedObject();
object->AddRef();
EXPECT_TRUE(object->HasOneRef());
@@ -49,7 +55,7 @@ TEST_F(PlatformTest, BlockAndCPlusPlus) {
}
EXPECT_TRUE(object->HasOneRef());
- void (^heap_block)(int) = 0;
+ void (^heap_block)(int) = nil;
{
scoped_refptr<RefCountedObject> object_ptr(object);
EXPECT_EQ(2, object->refcount());
@@ -74,8 +80,8 @@ TEST_F(PlatformTest, BlockAndCPlusPlus) {
object->Release();
}
-TEST_F(PlatformTest, BlockAndVectors) {
- void (^heap_block)(void) = 0;
+TEST_F(NoArcBlockTest, BlockAndVectors) {
+ void (^heap_block)(void) = nil;
{
std::vector<int> vector;
vector.push_back(0);
« no previous file with comments | « ios/chrome/common/block_unittest.mm ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698