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 WindowEventsFunnel. | 5 // Unit tests for WindowEventsFunnel. |
6 | 6 |
7 // MockWin32 can't be included after ChromeFrameHost because of an include | 7 // MockWin32 can't be included after ChromeFrameHost because of an include |
8 // incompatibility with atlwin.h. | 8 // incompatibility with atlwin.h. |
9 #include "ceee/testing/utils/mock_win32.h" // NOLINT | 9 #include "ceee/testing/utils/mock_win32.h" // NOLINT |
10 | 10 |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
48 }; | 48 }; |
49 | 49 |
50 TEST(WindowEventsFunnelTest, SendEvent) { | 50 TEST(WindowEventsFunnelTest, SendEvent) { |
51 TestWindowEventsFunnel events_funnel; | 51 TestWindowEventsFunnel events_funnel; |
52 | 52 |
53 static const char* kEventName = "MADness"; | 53 static const char* kEventName = "MADness"; |
54 DictionaryValue event_args; | 54 DictionaryValue event_args; |
55 event_args.SetInteger("Answer to the Ultimate Question of Life," | 55 event_args.SetInteger("Answer to the Ultimate Question of Life," |
56 "the Universe, and Everything", 42); | 56 "the Universe, and Everything", 42); |
57 event_args.SetString("AYBABTU", "All your base are belong to us"); | 57 event_args.SetString("AYBABTU", "All your base are belong to us"); |
58 event_args.SetReal("www.unrealtournament.com", 3.0); | 58 event_args.SetDouble("www.unrealtournament.com", 3.0); |
59 | 59 |
60 ListValue args_list; | 60 ListValue args_list; |
61 args_list.Append(event_args.DeepCopy()); | 61 args_list.Append(event_args.DeepCopy()); |
62 | 62 |
63 std::string event_args_str; | 63 std::string event_args_str; |
64 base::JSONWriter::Write(&args_list, false, &event_args_str); | 64 base::JSONWriter::Write(&args_list, false, &event_args_str); |
65 | 65 |
66 class MockChromePostman : public ChromePostman { | 66 class MockChromePostman : public ChromePostman { |
67 public: | 67 public: |
68 MOCK_METHOD2(FireEvent, void(const char*, const char*)); | 68 MOCK_METHOD2(FireEvent, void(const char*, const char*)); |
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
148 HWND window = reinterpret_cast<HWND>(window_id); | 148 HWND window = reinterpret_cast<HWND>(window_id); |
149 | 149 |
150 scoped_ptr<Value> args(Value::CreateIntegerValue(window_id)); | 150 scoped_ptr<Value> args(Value::CreateIntegerValue(window_id)); |
151 EXPECT_CALL(window_events_funnel, SendEvent( | 151 EXPECT_CALL(window_events_funnel, SendEvent( |
152 StrEq(ext_event_names::kOnWindowRemoved), ValuesEqual(args.get()))). | 152 StrEq(ext_event_names::kOnWindowRemoved), ValuesEqual(args.get()))). |
153 WillOnce(Return(S_OK)); | 153 WillOnce(Return(S_OK)); |
154 EXPECT_HRESULT_SUCCEEDED(window_events_funnel.OnRemoved(window)); | 154 EXPECT_HRESULT_SUCCEEDED(window_events_funnel.OnRemoved(window)); |
155 } | 155 } |
156 | 156 |
157 } // namespace | 157 } // namespace |
OLD | NEW |