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

Side by Side Diff: base/ios/weak_nsobject_unittest.mm

Issue 2132593002: Remove remaining calls to deprecated MessageLoop methods on Mac. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: h264_vt_encoder_unittest.cc Created 4 years, 5 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 unified diff | Download patch
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "base/bind.h" 5 #include "base/bind.h"
6 #include "base/ios/weak_nsobject.h" 6 #include "base/ios/weak_nsobject.h"
7 #include "base/mac/scoped_nsobject.h" 7 #include "base/mac/scoped_nsobject.h"
8 #include "base/message_loop/message_loop.h" 8 #include "base/message_loop/message_loop.h"
9 #include "base/run_loop.h"
9 #include "base/single_thread_task_runner.h" 10 #include "base/single_thread_task_runner.h"
10 #include "base/threading/thread.h" 11 #include "base/threading/thread.h"
11 #include "testing/gtest/include/gtest/gtest.h" 12 #include "testing/gtest/include/gtest/gtest.h"
12 13
13 namespace base { 14 namespace base {
14 namespace { 15 namespace {
15 16
16 TEST(WeakNSObjectTest, WeakNSObject) { 17 TEST(WeakNSObjectTest, WeakNSObject) {
17 scoped_nsobject<NSObject> p1([[NSObject alloc] init]); 18 scoped_nsobject<NSObject> p1([[NSObject alloc] init]);
18 WeakNSObject<NSObject> w1(p1); 19 WeakNSObject<NSObject> w1(p1);
(...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after
122 Thread other_thread("WeakNSObjectCopyOnOtherThread"); 123 Thread other_thread("WeakNSObjectCopyOnOtherThread");
123 other_thread.Start(); 124 other_thread.Start();
124 125
125 scoped_nsobject<NSMutableData> data([[NSMutableData alloc] init]); 126 scoped_nsobject<NSMutableData> data([[NSMutableData alloc] init]);
126 WeakNSObject<NSMutableData> weak(data); 127 WeakNSObject<NSMutableData> weak(data);
127 128
128 scoped_refptr<SingleThreadTaskRunner> runner = loop.task_runner(); 129 scoped_refptr<SingleThreadTaskRunner> runner = loop.task_runner();
129 other_thread.task_runner()->PostTask( 130 other_thread.task_runner()->PostTask(
130 FROM_HERE, Bind(&CopyWeakNSObjectAndPost, weak, runner)); 131 FROM_HERE, Bind(&CopyWeakNSObjectAndPost, weak, runner));
131 other_thread.Stop(); 132 other_thread.Stop();
132 loop.RunUntilIdle(); 133 RunLoop().RunUntilIdle();
133 134
134 // Check that TouchWeakData was called and the object touched twice. 135 // Check that TouchWeakData was called and the object touched twice.
135 EXPECT_EQ(2u, [data length]); 136 EXPECT_EQ(2u, [data length]);
136 } 137 }
137 138
138 } // namespace 139 } // namespace
139 } // namespace base 140 } // namespace base
OLDNEW
« no previous file with comments | « base/files/file_path_watcher_unittest.cc ('k') | base/memory/memory_pressure_listener_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698