OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 "content/renderer/browser_plugin/browser_plugin_browsertest.h" | 5 #include "content/renderer/browser_plugin/browser_plugin_browsertest.h" |
6 | 6 |
7 #include "base/file_path.h" | 7 #include "base/file_path.h" |
8 #include "base/file_util.h" | 8 #include "base/file_util.h" |
9 #include "base/path_service.h" | 9 #include "base/path_service.h" |
10 #include "content/common/browser_plugin_messages.h" | 10 #include "content/common/browser_plugin_messages.h" |
(...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
123 // src attribute. | 123 // src attribute. |
124 { | 124 { |
125 const IPC::Message* msg = | 125 const IPC::Message* msg = |
126 browser_plugin_manager()->sink().GetUniqueMessageMatching( | 126 browser_plugin_manager()->sink().GetUniqueMessageMatching( |
127 BrowserPluginHostMsg_NavigateGuest::ID); | 127 BrowserPluginHostMsg_NavigateGuest::ID); |
128 ASSERT_TRUE(msg); | 128 ASSERT_TRUE(msg); |
129 | 129 |
130 int instance_id; | 130 int instance_id; |
131 long long frame_id; | 131 long long frame_id; |
132 std::string src; | 132 std::string src; |
133 gfx::Size size; | 133 BrowserPluginHostMsg_ResizeGuest_Params resize_params; |
134 BrowserPluginHostMsg_NavigateGuest::Read( | 134 BrowserPluginHostMsg_NavigateGuest::Read( |
135 msg, | 135 msg, |
136 &instance_id, | 136 &instance_id, |
137 &frame_id, | 137 &frame_id, |
138 &src, | 138 &src, |
139 &size); | 139 &resize_params); |
140 EXPECT_EQ("foo", src); | 140 EXPECT_EQ("foo", src); |
141 } | 141 } |
142 | 142 |
143 browser_plugin_manager()->sink().ClearMessages(); | 143 browser_plugin_manager()->sink().ClearMessages(); |
144 // Navigate to bar and observe the associated | 144 // Navigate to bar and observe the associated |
145 // BrowserPluginHostMsg_NavigateGuest message. | 145 // BrowserPluginHostMsg_NavigateGuest message. |
146 // Verify that the src attribute is updated as well. | 146 // Verify that the src attribute is updated as well. |
147 ExecuteJavaScript("document.getElementById('browserplugin').src = 'bar'"); | 147 ExecuteJavaScript("document.getElementById('browserplugin').src = 'bar'"); |
148 { | 148 { |
149 const IPC::Message* msg = | 149 const IPC::Message* msg = |
150 browser_plugin_manager()->sink().GetUniqueMessageMatching( | 150 browser_plugin_manager()->sink().GetUniqueMessageMatching( |
151 BrowserPluginHostMsg_NavigateGuest::ID); | 151 BrowserPluginHostMsg_NavigateGuest::ID); |
152 ASSERT_TRUE(msg); | 152 ASSERT_TRUE(msg); |
153 | 153 |
154 int instance_id; | 154 int instance_id; |
155 long long frame_id; | 155 long long frame_id; |
156 std::string src; | 156 std::string src; |
157 gfx::Size size; | 157 BrowserPluginHostMsg_ResizeGuest_Params resize_params; |
158 BrowserPluginHostMsg_NavigateGuest::Read( | 158 BrowserPluginHostMsg_NavigateGuest::Read( |
159 msg, | 159 msg, |
160 &instance_id, | 160 &instance_id, |
161 &frame_id, | 161 &frame_id, |
162 &src, | 162 &src, |
163 &size); | 163 &resize_params); |
164 EXPECT_EQ("bar", src); | 164 EXPECT_EQ("bar", src); |
165 std::string src_value = | 165 std::string src_value = |
166 ExecuteScriptAndReturnString( | 166 ExecuteScriptAndReturnString( |
167 "document.getElementById('browserplugin').src"); | 167 "document.getElementById('browserplugin').src"); |
168 EXPECT_EQ("bar", src_value); | 168 EXPECT_EQ("bar", src_value); |
169 } | 169 } |
170 } | 170 } |
171 | 171 |
172 TEST_F(BrowserPluginTest, ResizeFlowControl) { | 172 TEST_F(BrowserPluginTest, ResizeFlowControl) { |
173 LoadHTML(GetHTMLForBrowserPluginObject().c_str()); | 173 LoadHTML(GetHTMLForBrowserPluginObject().c_str()); |
(...skipping 175 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
349 TEST_F(BrowserPluginTest, ReloadMethod) { | 349 TEST_F(BrowserPluginTest, ReloadMethod) { |
350 const char* kCallReload = | 350 const char* kCallReload = |
351 "document.getElementById('browserplugin').reload();"; | 351 "document.getElementById('browserplugin').reload();"; |
352 LoadHTML(GetHTMLForBrowserPluginObject().c_str()); | 352 LoadHTML(GetHTMLForBrowserPluginObject().c_str()); |
353 ExecuteJavaScript(kCallReload); | 353 ExecuteJavaScript(kCallReload); |
354 EXPECT_TRUE(browser_plugin_manager()->sink().GetUniqueMessageMatching( | 354 EXPECT_TRUE(browser_plugin_manager()->sink().GetUniqueMessageMatching( |
355 BrowserPluginHostMsg_Reload::ID)); | 355 BrowserPluginHostMsg_Reload::ID)); |
356 } | 356 } |
357 | 357 |
358 } // namespace content | 358 } // namespace content |
OLD | NEW |