| Index: chrome/test/ui/layout_plugin_uitest.cc
|
| diff --git a/chrome/test/ui/layout_plugin_uitest.cc b/chrome/test/ui/layout_plugin_uitest.cc
|
| index 7ebe677738e8e16eeb72b7025d6651d74ebca360..efe8fa33cc77fa57c8ab772b7863b85524611be4 100644
|
| --- a/chrome/test/ui/layout_plugin_uitest.cc
|
| +++ b/chrome/test/ui/layout_plugin_uitest.cc
|
| @@ -7,11 +7,18 @@
|
| #include "base/file_path.h"
|
| #include "base/path_service.h"
|
| #include "chrome/common/chrome_paths.h"
|
| +#include "chrome/common/url_constants.h"
|
| +#include "chrome/test/ui_test_utils.h"
|
| #include "chrome/test/automation/tab_proxy.h"
|
| #include "chrome/test/ui/npapi_test_helper.h"
|
| #include "googleurl/src/gurl.h"
|
| #include "net/base/net_util.h"
|
|
|
| +using npapi_test::kTestCompleteCookie;
|
| +using npapi_test::kTestCompleteSuccess;
|
| +
|
| +static const FilePath::CharType* kTestDir = FILE_PATH_LITERAL("npapi");
|
| +
|
| #if defined(OS_WIN)
|
| static const char kTestPluginName[] = "npapi_layout_test_plugin.dll";
|
| #elif defined(OS_MACOSX)
|
| @@ -43,3 +50,57 @@ TEST_F(LayoutPluginTester, UnloadNoCrash) {
|
| EXPECT_TRUE(tab->GetTabTitle(&title));
|
| EXPECT_EQ(L"", title);
|
| }
|
| +
|
| +// Tests if a plugin executing a self deleting script using NPN_GetURL
|
| +// works without crashing or hanging
|
| +TEST_F(LayoutPluginTester, SelfDeletePluginGetUrl) {
|
| + const FilePath test_case(FILE_PATH_LITERAL("self_delete_plugin_geturl.html"));
|
| + GURL url = ui_test_utils::GetTestUrl(FilePath(kTestDir), test_case);
|
| + ASSERT_NO_FATAL_FAILURE(NavigateToURL(url));
|
| + WaitForFinish("self_delete_plugin_geturl", "1", url,
|
| + kTestCompleteCookie, kTestCompleteSuccess,
|
| + action_max_timeout_ms());
|
| +}
|
| +
|
| +// Tests if a plugin executing a self deleting script using Invoke
|
| +// works without crashing or hanging
|
| +// Flaky. See http://crbug.com/30702
|
| +TEST_F(LayoutPluginTester, FLAKY_SelfDeletePluginInvoke) {
|
| + const FilePath test_case(FILE_PATH_LITERAL("self_delete_plugin_invoke.html"));
|
| + GURL url = ui_test_utils::GetTestUrl(FilePath(kTestDir), test_case);
|
| + ASSERT_NO_FATAL_FAILURE(NavigateToURL(url));
|
| + WaitForFinish("self_delete_plugin_invoke", "1", url,
|
| + kTestCompleteCookie, kTestCompleteSuccess,
|
| + action_max_timeout_ms());
|
| +}
|
| +
|
| +TEST_F(LayoutPluginTester, NPObjectReleasedOnDestruction) {
|
| + if (UITest::in_process_renderer())
|
| + return;
|
| +
|
| + const FilePath test_case(
|
| + FILE_PATH_LITERAL("npobject_released_on_destruction.html"));
|
| + GURL url = ui_test_utils::GetTestUrl(FilePath(kTestDir), test_case);
|
| + ASSERT_NO_FATAL_FAILURE(NavigateToURL(url));
|
| +
|
| + scoped_refptr<BrowserProxy> window_proxy(automation()->GetBrowserWindow(0));
|
| + ASSERT_TRUE(window_proxy);
|
| + ASSERT_TRUE(window_proxy->AppendTab(GURL(chrome::kAboutBlankURL)));
|
| +
|
| + scoped_refptr<TabProxy> tab_proxy(window_proxy->GetTab(0));
|
| + ASSERT_TRUE(tab_proxy.get());
|
| + ASSERT_TRUE(tab_proxy->Close(true));
|
| +}
|
| +
|
| +// Test that a dialog is properly created when a plugin throws an
|
| +// exception. Should be run for in and out of process plugins, but
|
| +// the more interesting case is out of process, where we must route
|
| +// the exception to the correct renderer.
|
| +TEST_F(LayoutPluginTester, NPObjectSetException) {
|
| + const FilePath test_case(FILE_PATH_LITERAL("npobject_set_exception.html"));
|
| + GURL url = ui_test_utils::GetTestUrl(FilePath(kTestDir), test_case);
|
| + ASSERT_NO_FATAL_FAILURE(NavigateToURL(url));
|
| + WaitForFinish("npobject_set_exception", "1", url,
|
| + kTestCompleteCookie, kTestCompleteSuccess,
|
| + action_max_timeout_ms());
|
| +}
|
|
|