blob: 33d7db8bf0a6d316f39593fe8e17cb8c09ed9573 [file] [log] [blame]
henrike@webrtc.orgf7795df2014-05-13 18:00:26 +00001/*
2 * Copyright 2014 The WebRTC Project Authors. All rights reserved.
3 *
4 * Use of this source code is governed by a BSD-style license
5 * that can be found in the LICENSE file in the root of the source
6 * tree. An additional intellectual property rights grant can be found
7 * in the file PATENTS. All contributing project authors may
8 * be found in the AUTHORS file in the root of the source tree.
9 */
10#include "webrtc/base/genericslot.h"
11#include "webrtc/base/gunit.h"
12#include "webrtc/base/sigslot.h"
13
14namespace rtc {
15
16TEST(GenericSlotTest, TestSlot1) {
17 sigslot::signal1<int> source1;
18 GenericSlot1<int> slot1(&source1, 1);
19 EXPECT_FALSE(slot1.callback_received());
20 source1.emit(10);
21 EXPECT_TRUE(slot1.callback_received());
22 EXPECT_EQ(10, slot1.arg1());
23}
24
25TEST(GenericSlotTest, TestSlot2) {
26 sigslot::signal2<int, char> source2;
27 GenericSlot2<int, char> slot2(&source2, 1, '0');
28 EXPECT_FALSE(slot2.callback_received());
29 source2.emit(10, 'x');
30 EXPECT_TRUE(slot2.callback_received());
31 EXPECT_EQ(10, slot2.arg1());
32 EXPECT_EQ('x', slot2.arg2());
33}
34
35// By induction we assume the rest work too...
36
37} // namespace rtc