OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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/utf_string_conversions.h" | 5 #include "base/utf_string_conversions.h" |
6 #include "base/values.h" | 6 #include "base/values.h" |
7 #include "chrome/browser/extensions/extension_message_service.h" | 7 #include "chrome/browser/extensions/extension_message_service.h" |
8 #include "chrome/common/extensions/extension_messages.h" | 8 #include "chrome/common/extensions/extension_messages.h" |
9 #include "chrome/common/render_messages.h" | 9 #include "chrome/common/render_messages.h" |
10 #include "chrome/renderer/extensions/event_bindings.h" | 10 #include "chrome/renderer/extensions/event_bindings.h" |
11 #include "chrome/test/render_view_test.h" | 11 #include "chrome/test/base/render_view_test.h" |
12 #include "content/common/view_messages.h" | 12 #include "content/common/view_messages.h" |
13 #include "testing/gtest/include/gtest/gtest.h" | 13 #include "testing/gtest/include/gtest/gtest.h" |
14 | 14 |
15 static void DispatchOnConnect(int source_port_id, const std::string& name, | 15 static void DispatchOnConnect(int source_port_id, const std::string& name, |
16 const std::string& tab_json) { | 16 const std::string& tab_json) { |
17 ListValue args; | 17 ListValue args; |
18 args.Set(0, Value::CreateIntegerValue(source_port_id)); | 18 args.Set(0, Value::CreateIntegerValue(source_port_id)); |
19 args.Set(1, Value::CreateStringValue(name)); | 19 args.Set(1, Value::CreateStringValue(name)); |
20 args.Set(2, Value::CreateStringValue(tab_json)); | 20 args.Set(2, Value::CreateStringValue(tab_json)); |
21 // Testing extensionId. Set in EventBindings::HandleContextCreated. | 21 // Testing extensionId. Set in EventBindings::HandleContextCreated. |
(...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
146 | 146 |
147 // Verify that we got it. | 147 // Verify that we got it. |
148 alert_msg = | 148 alert_msg = |
149 render_thread_.sink().GetUniqueMessageMatching( | 149 render_thread_.sink().GetUniqueMessageMatching( |
150 ViewHostMsg_RunJavaScriptMessage::ID); | 150 ViewHostMsg_RunJavaScriptMessage::ID); |
151 ASSERT_TRUE(alert_msg); | 151 ASSERT_TRUE(alert_msg); |
152 iter = IPC::SyncMessage::GetDataIterator(alert_msg); | 152 iter = IPC::SyncMessage::GetDataIterator(alert_msg); |
153 ASSERT_TRUE(IPC::ReadParam(alert_msg, &iter, &alert_param)); | 153 ASSERT_TRUE(IPC::ReadParam(alert_msg, &iter, &alert_param)); |
154 EXPECT_EQ(ASCIIToUTF16("disconnected: 24"), alert_param.a); | 154 EXPECT_EQ(ASCIIToUTF16("disconnected: 24"), alert_param.a); |
155 } | 155 } |
OLD | NEW |