OLD | NEW |
1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2009 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 #include "chrome/common/render_messages.h" | 5 #include "chrome/common/render_messages.h" |
| 6 #include "chrome/renderer/extensions/event_bindings.h" |
6 #include "chrome/renderer/extensions/renderer_extension_bindings.h" | 7 #include "chrome/renderer/extensions/renderer_extension_bindings.h" |
7 #include "chrome/test/render_view_test.h" | 8 #include "chrome/test/render_view_test.h" |
8 #include "testing/gtest/include/gtest/gtest.h" | 9 #include "testing/gtest/include/gtest/gtest.h" |
9 | 10 |
10 // Tests that the bindings for opening a channel to an extension and sending | 11 // Tests that the bindings for opening a channel to an extension and sending |
11 // and receiving messages through that channel all works. | 12 // and receiving messages through that channel all works. |
12 TEST_F(RenderViewTest, ExtensionMessagesOpenChannel) { | 13 TEST_F(RenderViewTest, ExtensionMessagesOpenChannel) { |
13 render_thread_.sink().ClearMessages(); | 14 render_thread_.sink().ClearMessages(); |
14 LoadHTML("<body></body>"); | 15 LoadHTML("<body></body>"); |
15 ExecuteJavaScript( | 16 ExecuteJavaScript( |
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
86 // Verify that we got it. | 87 // Verify that we got it. |
87 const IPC::Message* alert_msg = | 88 const IPC::Message* alert_msg = |
88 render_thread_.sink().GetUniqueMessageMatching( | 89 render_thread_.sink().GetUniqueMessageMatching( |
89 ViewHostMsg_RunJavaScriptMessage::ID); | 90 ViewHostMsg_RunJavaScriptMessage::ID); |
90 ASSERT_TRUE(alert_msg); | 91 ASSERT_TRUE(alert_msg); |
91 void* iter = IPC::SyncMessage::GetDataIterator(alert_msg); | 92 void* iter = IPC::SyncMessage::GetDataIterator(alert_msg); |
92 ViewHostMsg_RunJavaScriptMessage::SendParam alert_param; | 93 ViewHostMsg_RunJavaScriptMessage::SendParam alert_param; |
93 ASSERT_TRUE(IPC::ReadParam(alert_msg, &iter, &alert_param)); | 94 ASSERT_TRUE(IPC::ReadParam(alert_msg, &iter, &alert_param)); |
94 EXPECT_EQ(L"got: 42", alert_param.a); | 95 EXPECT_EQ(L"got: 42", alert_param.a); |
95 } | 96 } |
OLD | NEW |