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

Side by Side Diff: base/callback_list_unittest.nc

Issue 2603573002: Support no-compile tests on Mac (Closed)
Patch Set: Support no-compile tests on Mac Created 3 years, 12 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 // This is a "No Compile Test" suite. 5 // This is a "No Compile Test" suite.
6 // http://dev.chromium.org/developers/testing/no-compile-tests 6 // http://dev.chromium.org/developers/testing/no-compile-tests
7 7
8 #include "base/callback_list.h" 8 #include "base/callback_list.h"
9 9
10 #include <memory> 10 #include <memory>
(...skipping 17 matching lines...) Expand all
28 28
29 void GotAScopedFoo(std::unique_ptr<Foo> f) { foo_ = std::move(f); } 29 void GotAScopedFoo(std::unique_ptr<Foo> f) { foo_ = std::move(f); }
30 30
31 std::unique_ptr<Foo> foo_; 31 std::unique_ptr<Foo> foo_;
32 32
33 private: 33 private:
34 DISALLOW_COPY_AND_ASSIGN(FooListener); 34 DISALLOW_COPY_AND_ASSIGN(FooListener);
35 }; 35 };
36 36
37 37
38 #if defined(NCTEST_MOVE_ONLY_TYPE_PARAMETER) // [r"fatal error: call to deleted constructor"] 38 #if defined(NCTEST_MOVE_ONLY_TYPE_PARAMETER) // [r"fatal error: call to [^ ]*de leted .*constructor"]
dcheng 2016/12/27 04:58:33 Can we make this match precise? "call to (implicit
wychen 2016/12/27 09:49:51 Done.
39 39
40 // Callbacks run with a move-only typed parameter. 40 // Callbacks run with a move-only typed parameter.
41 // 41 //
42 // CallbackList does not support move-only typed parameters. Notify() is 42 // CallbackList does not support move-only typed parameters. Notify() is
43 // designed to take zero or more parameters, and run each registered callback 43 // designed to take zero or more parameters, and run each registered callback
44 // with them. With move-only types, the parameter will be set to NULL after the 44 // with them. With move-only types, the parameter will be set to NULL after the
45 // first callback has been run. 45 // first callback has been run.
46 void WontCompile() { 46 void WontCompile() {
47 FooListener f; 47 FooListener f;
48 CallbackList<void(std::unique_ptr<Foo>)> c1; 48 CallbackList<void(std::unique_ptr<Foo>)> c1;
49 std::unique_ptr<CallbackList<void(std::unique_ptr<Foo>)>::Subscription> sub = 49 std::unique_ptr<CallbackList<void(std::unique_ptr<Foo>)>::Subscription> sub =
50 c1.Add(Bind(&FooListener::GotAScopedFoo, Unretained(&f))); 50 c1.Add(Bind(&FooListener::GotAScopedFoo, Unretained(&f)));
51 c1.Notify(std::unique_ptr<Foo>(new Foo())); 51 c1.Notify(std::unique_ptr<Foo>(new Foo()));
52 } 52 }
53 53
54 #endif 54 #endif
55 55
56 } // namespace base 56 } // namespace base
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698