5#include "flutter/fml/message_loop.h"
6#include "flutter/fml/platform/darwin/scoped_nsobject.h"
7#include "flutter/fml/platform/darwin/weak_nsobject.h"
8#include "flutter/fml/task_runner.h"
9#include "flutter/fml/thread.h"
10#include "gtest/gtest.h"
15TEST(WeakNSObjectTest, WeakNSObject) {
16 scoped_nsobject<NSObject> p1([[NSObject alloc]
init]);
17 WeakNSObjectFactory factory(p1.get());
18 WeakNSObject<NSObject> w1 = factory.GetWeakNSObject();
24TEST(WeakNSObjectTest, MultipleWeakNSObject) {
25 scoped_nsobject<NSObject> p1([[NSObject alloc]
init]);
26 WeakNSObjectFactory factory(p1.get());
27 WeakNSObject<NSObject> w1 = factory.GetWeakNSObject();
29 WeakNSObject<NSObject> w2(w1);
38TEST(WeakNSObjectTest, WeakNSObjectDies) {
39 scoped_nsobject<NSObject> p1([[NSObject alloc]
init]);
40 WeakNSObjectFactory factory(p1.get());
42 WeakNSObject<NSObject> w1 = factory.GetWeakNSObject();
47TEST(WeakNSObjectTest, WeakNSObjectReset) {
48 scoped_nsobject<NSObject> p1([[NSObject alloc]
init]);
49 WeakNSObjectFactory factory(p1.get());
50 WeakNSObject<NSObject> w1 = factory.GetWeakNSObject();
58TEST(WeakNSObjectTest, WeakNSObjectEmpty) {
59 scoped_nsobject<NSObject> p1([[NSObject alloc]
init]);
60 WeakNSObject<NSObject> w1;
62 WeakNSObjectFactory factory(p1.get());
63 w1 = factory.GetWeakNSObject();
69TEST(WeakNSObjectTest, WeakNSObjectCopy) {
70 scoped_nsobject<NSObject> p1([[NSObject alloc]
init]);
71 WeakNSObjectFactory factory(p1.get());
72 WeakNSObject<NSObject> w1 = factory.GetWeakNSObject();
74 WeakNSObject<NSObject> w2(w1);
82TEST(WeakNSObjectTest, WeakNSObjectAssignment) {
83 scoped_nsobject<NSObject> p1([[NSObject alloc]
init]);
84 WeakNSObjectFactory factory(p1.get());
85 WeakNSObject<NSObject> w1 = factory.GetWeakNSObject();
87 WeakNSObject<NSObject> w2 = w1;
TEST(MallocMapping, EmptyContructor)
#define EXPECT_TRUE(handle)