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

Side by Side Diff: webrtc/base/sigslottester.h

Issue 2066443003: Add SigslotTester0 for testing signals without argument. (Closed) Base URL: https://chromium.googlesource.com/external/webrtc@master
Patch Set: Created 4 years, 6 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 | webrtc/base/sigslottester.h.pump » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // This file was GENERATED by command: 1 // This file was GENERATED by command:
2 // pump.py sigslottester.h.pump 2 // pump.py sigslottester.h.pump
3 // DO NOT EDIT BY HAND!!! 3 // DO NOT EDIT BY HAND!!!
4 4
5 /* 5 /*
6 * Copyright 2014 The WebRTC Project Authors. All rights reserved. 6 * Copyright 2014 The WebRTC Project Authors. All rights reserved.
7 * 7 *
8 * Use of this source code is governed by a BSD-style license 8 * Use of this source code is governed by a BSD-style license
9 * that can be found in the LICENSE file in the root of the source 9 * that can be found in the LICENSE file in the root of the source
10 * tree. An additional intellectual property rights grant can be found 10 * tree. An additional intellectual property rights grant can be found
(...skipping 26 matching lines...) Expand all
37 // foo.emit("hello"); 37 // foo.emit("hello");
38 // EXPECT_EQ(1, slot.callback_count()); 38 // EXPECT_EQ(1, slot.callback_count());
39 // EXPECT_EQ("hello", capture); 39 // EXPECT_EQ("hello", capture);
40 // /* See unit-tests for more examples */ 40 // /* See unit-tests for more examples */
41 41
42 #include "webrtc/base/constructormagic.h" 42 #include "webrtc/base/constructormagic.h"
43 #include "webrtc/base/sigslot.h" 43 #include "webrtc/base/sigslot.h"
44 44
45 namespace rtc { 45 namespace rtc {
46 46
47 // For all the templates below: 47 // Base version for testing signals that passes no arguments.
48 class SigslotTester0 : public sigslot::has_slots<> {
49 public:
50 explicit SigslotTester0(sigslot::signal0<>* signal) : callback_count_(0) {
51 signal->connect(this, &SigslotTester0::OnSignalCallback);
52 }
53
54 int callback_count() const { return callback_count_; }
55
56 private:
57 void OnSignalCallback() { callback_count_++; }
58 int callback_count_;
59
60 DISALLOW_COPY_AND_ASSIGN(SigslotTester0);
61 };
62
63 // Versions below are for testing signals that pass arguments. For all the
64 // templates below:
48 // - A1-A5 is the type of the argument i in the callback. Signals may and often 65 // - A1-A5 is the type of the argument i in the callback. Signals may and often
49 // do use const-references here for efficiency. 66 // do use const-references here for efficiency.
50 // - C1-C5 is the type of the variable to capture argument i. These should be 67 // - C1-C5 is the type of the variable to capture argument i. These should be
51 // non-const value types suitable for use as lvalues. 68 // non-const value types suitable for use as lvalues.
52 69
53 template <class A1, class C1> 70 template <class A1, class C1>
54 class SigslotTester1 : public sigslot::has_slots<> { 71 class SigslotTester1 : public sigslot::has_slots<> {
55 public: 72 public:
56 SigslotTester1(sigslot::signal1<A1>* signal, 73 SigslotTester1(sigslot::signal1<A1>* signal,
57 C1* capture1) 74 C1* capture1)
(...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after
190 C2* capture2_; 207 C2* capture2_;
191 C3* capture3_; 208 C3* capture3_;
192 C4* capture4_; 209 C4* capture4_;
193 C5* capture5_; 210 C5* capture5_;
194 211
195 RTC_DISALLOW_COPY_AND_ASSIGN(SigslotTester5); 212 RTC_DISALLOW_COPY_AND_ASSIGN(SigslotTester5);
196 }; 213 };
197 } // namespace rtc 214 } // namespace rtc
198 215
199 #endif // WEBRTC_BASE_SIGSLOTTESTER_H_ 216 #endif // WEBRTC_BASE_SIGSLOTTESTER_H_
OLDNEW
« no previous file with comments | « no previous file | webrtc/base/sigslottester.h.pump » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698