| 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 256 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 267 // Send an event and verify that the event is deported. | 267 // Send an event and verify that the event is deported. |
| 268 browser_plugin->handleInputEvent(WebKit::WebMouseEvent(), | 268 browser_plugin->handleInputEvent(WebKit::WebMouseEvent(), |
| 269 cursor_info); | 269 cursor_info); |
| 270 EXPECT_TRUE(browser_plugin_manager()->sink().GetUniqueMessageMatching( | 270 EXPECT_TRUE(browser_plugin_manager()->sink().GetUniqueMessageMatching( |
| 271 BrowserPluginHostMsg_HandleInputEvent::ID)); | 271 BrowserPluginHostMsg_HandleInputEvent::ID)); |
| 272 browser_plugin_manager()->sink().ClearMessages(); | 272 browser_plugin_manager()->sink().ClearMessages(); |
| 273 | 273 |
| 274 const char* kAddEventListener = | 274 const char* kAddEventListener = |
| 275 "var msg;" | 275 "var msg;" |
| 276 "function exitListener(e) {" | 276 "function exitListener(e) {" |
| 277 " msg = e.type;" | 277 " msg = e.reason;" |
| 278 "}" | 278 "}" |
| 279 "document.getElementById('browserplugin')." | 279 "document.getElementById('browserplugin')." |
| 280 " addEventListener('exit', exitListener);"; | 280 " addEventListener('exit', exitListener);"; |
| 281 | 281 |
| 282 ExecuteJavaScript(kAddEventListener); | 282 ExecuteJavaScript(kAddEventListener); |
| 283 | 283 |
| 284 // Pretend that the guest has terminated normally. | 284 // Pretend that the guest has terminated normally. |
| 285 browser_plugin->GuestGone(0, base::TERMINATION_STATUS_NORMAL_TERMINATION); | 285 browser_plugin->GuestGone(0, base::TERMINATION_STATUS_NORMAL_TERMINATION); |
| 286 | 286 |
| 287 // Verify that our event listener has fired. | 287 // Verify that our event listener has fired. |
| (...skipping 321 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 609 ASSERT_TRUE(IPC::ReadParam(msg, &iter, &resize_params)); | 609 ASSERT_TRUE(IPC::ReadParam(msg, &iter, &resize_params)); |
| 610 int instance_id = resize_params.a; | 610 int instance_id = resize_params.a; |
| 611 | 611 |
| 612 MockBrowserPlugin* browser_plugin = | 612 MockBrowserPlugin* browser_plugin = |
| 613 static_cast<MockBrowserPlugin*>( | 613 static_cast<MockBrowserPlugin*>( |
| 614 browser_plugin_manager()->GetBrowserPlugin(instance_id)); | 614 browser_plugin_manager()->GetBrowserPlugin(instance_id)); |
| 615 ASSERT_TRUE(browser_plugin); | 615 ASSERT_TRUE(browser_plugin); |
| 616 | 616 |
| 617 const char* kAddEventListener = | 617 const char* kAddEventListener = |
| 618 "function exitListener(e) {" | 618 "function exitListener(e) {" |
| 619 " if (e.type == 'killed') {" | 619 " if (e.reason == 'killed') {" |
| 620 " var bp = document.getElementById('browserplugin');" | 620 " var bp = document.getElementById('browserplugin');" |
| 621 " bp.parentNode.removeChild(bp);" | 621 " bp.parentNode.removeChild(bp);" |
| 622 " }" | 622 " }" |
| 623 "}" | 623 "}" |
| 624 "document.getElementById('browserplugin')." | 624 "document.getElementById('browserplugin')." |
| 625 " addEventListener('exit', exitListener);"; | 625 " addEventListener('exit', exitListener);"; |
| 626 | 626 |
| 627 ExecuteJavaScript(kAddEventListener); | 627 ExecuteJavaScript(kAddEventListener); |
| 628 | 628 |
| 629 // Pretend that the guest has crashed. | 629 // Pretend that the guest has crashed. |
| (...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 690 ¶ms); | 690 ¶ms); |
| 691 EXPECT_FALSE(params.enable); | 691 EXPECT_FALSE(params.enable); |
| 692 EXPECT_EQ(42, params.min_width); | 692 EXPECT_EQ(42, params.min_width); |
| 693 EXPECT_EQ(43, params.min_height); | 693 EXPECT_EQ(43, params.min_height); |
| 694 EXPECT_EQ(1337, params.max_width); | 694 EXPECT_EQ(1337, params.max_width); |
| 695 EXPECT_EQ(1338, params.max_height); | 695 EXPECT_EQ(1338, params.max_height); |
| 696 } | 696 } |
| 697 } | 697 } |
| 698 | 698 |
| 699 } // namespace content | 699 } // namespace content |
| OLD | NEW |