OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 // Unit tests for EventsFunnel. | 5 // Unit tests for EventsFunnel. |
6 | 6 |
7 #include "base/json/json_writer.h" | 7 #include "base/json/json_writer.h" |
8 #include "base/values.h" | 8 #include "base/values.h" |
9 #include "ceee/ie/common/ceee_module_util.h" | 9 #include "ceee/ie/common/ceee_module_util.h" |
10 #include "ceee/ie/plugin/bho/events_funnel.h" | 10 #include "ceee/ie/plugin/bho/events_funnel.h" |
(...skipping 17 matching lines...) Expand all Loading... |
28 }; | 28 }; |
29 | 29 |
30 TEST(EventsFunnelTest, SendEvent) { | 30 TEST(EventsFunnelTest, SendEvent) { |
31 TestEventsFunnel events_funnel; | 31 TestEventsFunnel events_funnel; |
32 | 32 |
33 static const char* kEventName = "MADness"; | 33 static const char* kEventName = "MADness"; |
34 DictionaryValue event_args; | 34 DictionaryValue event_args; |
35 event_args.SetInteger("Answer to the Ultimate Question of Life," | 35 event_args.SetInteger("Answer to the Ultimate Question of Life," |
36 "the Universe, and Everything", 42); | 36 "the Universe, and Everything", 42); |
37 event_args.SetString("AYBABTU", "All your base are belong to us"); | 37 event_args.SetString("AYBABTU", "All your base are belong to us"); |
38 event_args.SetReal("www.unrealtournament.com", 3.0); | 38 event_args.SetDouble("www.unrealtournament.com", 3.0); |
39 | 39 |
40 ListValue args_list; | 40 ListValue args_list; |
41 args_list.Append(event_args.DeepCopy()); | 41 args_list.Append(event_args.DeepCopy()); |
42 | 42 |
43 std::string event_args_str; | 43 std::string event_args_str; |
44 base::JSONWriter::Write(&args_list, false, &event_args_str); | 44 base::JSONWriter::Write(&args_list, false, &event_args_str); |
45 | 45 |
46 EXPECT_CALL(events_funnel, SendEventToBroker(StrEq(kEventName), | 46 EXPECT_CALL(events_funnel, SendEventToBroker(StrEq(kEventName), |
47 StrEq(event_args_str))).Times(1); | 47 StrEq(event_args_str))).Times(1); |
48 EXPECT_HRESULT_SUCCEEDED( | 48 EXPECT_HRESULT_SUCCEEDED( |
49 events_funnel.CallSendEvent(kEventName, event_args)); | 49 events_funnel.CallSendEvent(kEventName, event_args)); |
50 } | 50 } |
51 | 51 |
52 } // namespace | 52 } // namespace |
OLD | NEW |