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 102 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
113 // src attribute. | 113 // src attribute. |
114 { | 114 { |
115 const IPC::Message* msg = | 115 const IPC::Message* msg = |
116 browser_plugin_manager()->sink().GetUniqueMessageMatching( | 116 browser_plugin_manager()->sink().GetUniqueMessageMatching( |
117 BrowserPluginHostMsg_NavigateOrCreateGuest::ID); | 117 BrowserPluginHostMsg_NavigateOrCreateGuest::ID); |
118 ASSERT_TRUE(msg); | 118 ASSERT_TRUE(msg); |
119 | 119 |
120 int instance_id; | 120 int instance_id; |
121 long long frame_id; | 121 long long frame_id; |
122 std::string src; | 122 std::string src; |
| 123 gfx::Size size; |
123 BrowserPluginHostMsg_NavigateOrCreateGuest::Read( | 124 BrowserPluginHostMsg_NavigateOrCreateGuest::Read( |
124 msg, | 125 msg, |
125 &instance_id, | 126 &instance_id, |
126 &frame_id, | 127 &frame_id, |
127 &src); | 128 &src, |
| 129 &size); |
128 EXPECT_EQ("foo", src); | 130 EXPECT_EQ("foo", src); |
129 } | 131 } |
130 | 132 |
131 browser_plugin_manager()->sink().ClearMessages(); | 133 browser_plugin_manager()->sink().ClearMessages(); |
132 // Navigate to bar and observe the associated | 134 // Navigate to bar and observe the associated |
133 // BrowserPluginHostMsg_NavigateOrCreateGuest message. | 135 // BrowserPluginHostMsg_NavigateOrCreateGuest message. |
134 // Verify that the src attribute is updated as well. | 136 // Verify that the src attribute is updated as well. |
135 ExecuteJavaScript("document.getElementById('browserplugin').src = 'bar'"); | 137 ExecuteJavaScript("document.getElementById('browserplugin').src = 'bar'"); |
136 { | 138 { |
137 const IPC::Message* msg = | 139 const IPC::Message* msg = |
138 browser_plugin_manager()->sink().GetUniqueMessageMatching( | 140 browser_plugin_manager()->sink().GetUniqueMessageMatching( |
139 BrowserPluginHostMsg_NavigateOrCreateGuest::ID); | 141 BrowserPluginHostMsg_NavigateOrCreateGuest::ID); |
140 ASSERT_TRUE(msg); | 142 ASSERT_TRUE(msg); |
141 | 143 |
142 int instance_id; | 144 int instance_id; |
143 long long frame_id; | 145 long long frame_id; |
144 std::string src; | 146 std::string src; |
| 147 gfx::Size size; |
145 BrowserPluginHostMsg_NavigateOrCreateGuest::Read( | 148 BrowserPluginHostMsg_NavigateOrCreateGuest::Read( |
146 msg, | 149 msg, |
147 &instance_id, | 150 &instance_id, |
148 &frame_id, | 151 &frame_id, |
149 &src); | 152 &src, |
| 153 &size); |
150 EXPECT_EQ("bar", src); | 154 EXPECT_EQ("bar", src); |
151 std::string src_value = | 155 std::string src_value = |
152 ExecuteScriptAndReturnString( | 156 ExecuteScriptAndReturnString( |
153 "document.getElementById('browserplugin').src"); | 157 "document.getElementById('browserplugin').src"); |
154 EXPECT_EQ("bar", src_value); | 158 EXPECT_EQ("bar", src_value); |
155 } | 159 } |
156 } | 160 } |
157 | 161 |
158 TEST_F(BrowserPluginTest, ResizeFlowControl) { | 162 TEST_F(BrowserPluginTest, ResizeFlowControl) { |
159 LoadHTML(GetHTMLForBrowserPluginObject().c_str()); | 163 LoadHTML(GetHTMLForBrowserPluginObject().c_str()); |
(...skipping 153 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
313 EXPECT_EQ(kGoogleURL, ExecuteScriptAndReturnString("url")); | 317 EXPECT_EQ(kGoogleURL, ExecuteScriptAndReturnString("url")); |
314 | 318 |
315 ExecuteJavaScript(kRemoveEventListener); | 319 ExecuteJavaScript(kRemoveEventListener); |
316 browser_plugin->DidNavigate(GURL(kGoogleNewsURL)); | 320 browser_plugin->DidNavigate(GURL(kGoogleNewsURL)); |
317 // The URL variable should not change because we've removed the event | 321 // The URL variable should not change because we've removed the event |
318 // listener. | 322 // listener. |
319 EXPECT_EQ(kGoogleURL, ExecuteScriptAndReturnString("url")); | 323 EXPECT_EQ(kGoogleURL, ExecuteScriptAndReturnString("url")); |
320 } | 324 } |
321 | 325 |
322 } // namespace content | 326 } // namespace content |
OLD | NEW |