| 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 "base/values.h" | 5 #include "base/values.h" |
| 6 #include "chrome/browser/extensions/extension_message_service.h" | 6 #include "chrome/browser/extensions/extension_message_service.h" |
| 7 #include "chrome/common/render_messages.h" | 7 #include "chrome/common/render_messages.h" |
| 8 #include "chrome/renderer/extensions/event_bindings.h" | 8 #include "chrome/renderer/extensions/event_bindings.h" |
| 9 #include "chrome/renderer/extensions/renderer_extension_bindings.h" | 9 #include "chrome/renderer/extensions/renderer_extension_bindings.h" |
| 10 #include "chrome/test/render_view_test.h" | 10 #include "chrome/test/render_view_test.h" |
| 11 #include "content/common/view_messages.h" |
| 11 #include "testing/gtest/include/gtest/gtest.h" | 12 #include "testing/gtest/include/gtest/gtest.h" |
| 12 | 13 |
| 13 static void DispatchOnConnect(int source_port_id, const std::string& name, | 14 static void DispatchOnConnect(int source_port_id, const std::string& name, |
| 14 const std::string& tab_json) { | 15 const std::string& tab_json) { |
| 15 ListValue args; | 16 ListValue args; |
| 16 args.Set(0, Value::CreateIntegerValue(source_port_id)); | 17 args.Set(0, Value::CreateIntegerValue(source_port_id)); |
| 17 args.Set(1, Value::CreateStringValue(name)); | 18 args.Set(1, Value::CreateStringValue(name)); |
| 18 args.Set(2, Value::CreateStringValue(tab_json)); | 19 args.Set(2, Value::CreateStringValue(tab_json)); |
| 19 // Testing extensionId. Set in EventBindings::HandleContextCreated. | 20 // Testing extensionId. Set in EventBindings::HandleContextCreated. |
| 20 // We use the same id for source & target to similute an extension "talking | 21 // We use the same id for source & target to similute an extension "talking |
| (...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 144 | 145 |
| 145 // Verify that we got it. | 146 // Verify that we got it. |
| 146 alert_msg = | 147 alert_msg = |
| 147 render_thread_.sink().GetUniqueMessageMatching( | 148 render_thread_.sink().GetUniqueMessageMatching( |
| 148 ViewHostMsg_RunJavaScriptMessage::ID); | 149 ViewHostMsg_RunJavaScriptMessage::ID); |
| 149 ASSERT_TRUE(alert_msg); | 150 ASSERT_TRUE(alert_msg); |
| 150 iter = IPC::SyncMessage::GetDataIterator(alert_msg); | 151 iter = IPC::SyncMessage::GetDataIterator(alert_msg); |
| 151 ASSERT_TRUE(IPC::ReadParam(alert_msg, &iter, &alert_param)); | 152 ASSERT_TRUE(IPC::ReadParam(alert_msg, &iter, &alert_param)); |
| 152 EXPECT_EQ(L"disconnected: 24", alert_param.a); | 153 EXPECT_EQ(L"disconnected: 24", alert_param.a); |
| 153 } | 154 } |
| OLD | NEW |