OLD | NEW |
| (Empty) |
1 // Copyright 2010 The Ginsu Authors. All rights reserved. | |
2 // Use of this source code is governed by a BSD-style license that can | |
3 // be found in the LICENSE file. | |
4 | |
5 #include "c_salt/notification.h" | |
6 #include "gmock/gmock.h" | |
7 #include "gtest/gtest.h" | |
8 | |
9 namespace { | |
10 const char* const kNotificationName = "notification"; | |
11 const char* const kOtherNotificationName = "other notification"; | |
12 const char* const kPublisher1 = "publisher1"; | |
13 const int kIntValue42 = 42; | |
14 } // namespace | |
15 | |
16 using c_salt::Notification; | |
17 | |
18 class NotificationTest : public ::testing::Test { | |
19 protected: | |
20 virtual void SetUp() {} | |
21 }; | |
22 | |
23 // Verify that the default ctor caches the name,and produces an anonymous | |
24 // notification with an empty payload. | |
25 TEST_F(NotificationTest, DefaultCtor) { | |
26 Notification note(kNotificationName); | |
27 EXPECT_EQ(kNotificationName, note.name()); | |
28 EXPECT_TRUE(note.data()->empty()); | |
29 EXPECT_EQ("", note.publisher_name()); | |
30 } | |
31 | |
32 TEST_F(NotificationTest, IntCtor) { | |
33 Notification::SharedNotificationValue | |
34 int_value(new Notification::NotificationValue(kIntValue42)); | |
35 Notification note(kNotificationName, int_value, kPublisher1); | |
36 EXPECT_FALSE(note.data()->empty()); | |
37 EXPECT_EQ(kIntValue42, boost::any_cast<int>(*note.data())); | |
38 } | |
OLD | NEW |