| OLD | NEW |
| 1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2008 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 <string> | 5 #include <string> |
| 6 | 6 |
| 7 #include "base/file_util.h" | 7 #include "base/file_util.h" |
| 8 #include "base/path_service.h" | 8 #include "base/path_service.h" |
| 9 #include "base/string_util.h" | 9 #include "base/string_util.h" |
| 10 #include "net/base/escape.h" |
| 10 #include "testing/gtest/include/gtest/gtest.h" | 11 #include "testing/gtest/include/gtest/gtest.h" |
| 11 #include "third_party/WebKit/WebKit/chromium/public/WebScriptSource.h" | 12 #include "third_party/WebKit/WebKit/chromium/public/WebScriptSource.h" |
| 13 #include "third_party/WebKit/WebKit/chromium/public/WebInputEvent.h" |
| 12 #include "webkit/glue/webframe.h" | 14 #include "webkit/glue/webframe.h" |
| 13 #include "webkit/glue/webview.h" | 15 #include "webkit/glue/webview.h" |
| 14 #include "webkit/tools/test_shell/test_shell.h" | 16 #include "webkit/tools/test_shell/test_shell.h" |
| 15 #include "webkit/tools/test_shell/test_shell_test.h" | 17 #include "webkit/tools/test_shell/test_shell_test.h" |
| 16 | 18 |
| 17 using WebKit::WebScriptSource; | 19 using WebKit::WebScriptSource; |
| 18 using WebKit::WebString; | 20 using WebKit::WebString; |
| 19 | 21 |
| 20 // Provides functionality for creating plugin tests. | 22 // Provides functionality for creating plugin tests. |
| 21 class PluginTest : public TestShellTest { | 23 class PluginTest : public TestShellTest { |
| (...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 116 | 118 |
| 117 test_shell_->webView()->GetMainFrame()->LoadHTMLString( | 119 test_shell_->webView()->GetMainFrame()->LoadHTMLString( |
| 118 html, GURL("about:blank")); | 120 html, GURL("about:blank")); |
| 119 test_shell_->WaitTestFinished(); | 121 test_shell_->WaitTestFinished(); |
| 120 | 122 |
| 121 std::wstring text; | 123 std::wstring text; |
| 122 test_shell_->webView()->GetMainFrame()->GetContentAsPlainText(10000, &text); | 124 test_shell_->webView()->GetMainFrame()->GetContentAsPlainText(10000, &text); |
| 123 | 125 |
| 124 ASSERT_EQ(true, StartsWith(text, L"DONE", true)); | 126 ASSERT_EQ(true, StartsWith(text, L"DONE", true)); |
| 125 } | 127 } |
| 128 |
| 129 // Tests that if a frame is deleted as a result of calling NPP_HandleEvent, we |
| 130 // don't crash. |
| 131 TEST_F(PluginTest, DeleteFrameDuringEvent) { |
| 132 FilePath test_html = data_dir_; |
| 133 test_html = test_html.AppendASCII("plugins"); |
| 134 test_html = test_html.AppendASCII("delete_frame.html"); |
| 135 test_shell_->LoadURL(test_html.ToWStringHack().c_str()); |
| 136 test_shell_->WaitTestFinished(); |
| 137 |
| 138 WebKit::WebMouseEvent input; |
| 139 input.button = WebKit::WebMouseEvent::ButtonLeft; |
| 140 input.x = 50; |
| 141 input.y = 50; |
| 142 input.type = WebKit::WebInputEvent::MouseUp; |
| 143 test_shell_->webView()->HandleInputEvent(&input); |
| 144 |
| 145 // No crash means we passed. |
| 146 } |
| OLD | NEW |