diff options
author | jam@chromium.org <jam@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-10-06 19:11:22 +0000 |
---|---|---|
committer | jam@chromium.org <jam@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-10-06 19:11:22 +0000 |
commit | 49f69aeb0f507096666e58e037a389712be4e585 (patch) | |
tree | 36d2b291928e0e1a539467b26d7186d096956dcf /chrome/test/ui/npapi_uitest.cc | |
parent | 519c21a5a3aefe5afc4123bda99d4e76d2a012bb (diff) | |
download | chromium_src-49f69aeb0f507096666e58e037a389712be4e585.zip chromium_src-49f69aeb0f507096666e58e037a389712be4e585.tar.gz chromium_src-49f69aeb0f507096666e58e037a389712be4e585.tar.bz2 |
Fix scripting during NPP_Destroy. Note that if the plugin is making a call to the renderer so this instance is in the callstack, destruction will have to be asynchronous and so scripting still won't work. This change also fixes use of PluginChannel after it's deleted (if this was the last instance).
BUG=23713, 23706
TEST=added ui test
Review URL: http://codereview.chromium.org/258026
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@28141 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/test/ui/npapi_uitest.cc')
-rw-r--r-- | chrome/test/ui/npapi_uitest.cc | 85 |
1 files changed, 50 insertions, 35 deletions
diff --git a/chrome/test/ui/npapi_uitest.cc b/chrome/test/ui/npapi_uitest.cc index ae93190..d379426 100644 --- a/chrome/test/ui/npapi_uitest.cc +++ b/chrome/test/ui/npapi_uitest.cc @@ -159,27 +159,29 @@ TEST_F(NPAPITester, DISABLED_SelfDeletePluginInvokeAlert) { // Tests if a plugin executing a self deleting script in the context of // a synchronous paint event works correctly TEST_F(NPAPIVisiblePluginTester, SelfDeletePluginInvokeInSynchronousPaint) { - if (!UITest::in_process_renderer()) { - show_window_ = true; - std::wstring test_case = L"execute_script_delete_in_paint.html"; - GURL url = GetTestUrl(L"npapi", test_case); - NavigateToURL(url); - WaitForFinish("execute_script_delete_in_paint", "1", url, - kTestCompleteCookie, kTestCompleteSuccess, - kShortWaitTimeout); - } + if (UITest::in_process_renderer()) + return; + + show_window_ = true; + std::wstring test_case = L"execute_script_delete_in_paint.html"; + GURL url = GetTestUrl(L"npapi", test_case); + NavigateToURL(url); + WaitForFinish("execute_script_delete_in_paint", "1", url, + kTestCompleteCookie, kTestCompleteSuccess, + kShortWaitTimeout); } TEST_F(NPAPIVisiblePluginTester, SelfDeletePluginInNewStream) { - if (!UITest::in_process_renderer()) { - show_window_ = true; - std::wstring test_case = L"self_delete_plugin_stream.html"; - GURL url = GetTestUrl(L"npapi", test_case); - NavigateToURL(url); - WaitForFinish("self_delete_plugin_stream", "1", url, - kTestCompleteCookie, kTestCompleteSuccess, - kShortWaitTimeout); - } + if (UITest::in_process_renderer()) + return; + + show_window_ = true; + std::wstring test_case = L"self_delete_plugin_stream.html"; + GURL url = GetTestUrl(L"npapi", test_case); + NavigateToURL(url); + WaitForFinish("self_delete_plugin_stream", "1", url, + kTestCompleteCookie, kTestCompleteSuccess, + kShortWaitTimeout); } // Tests if a plugin has a non zero window rect. @@ -235,15 +237,16 @@ TEST_F(NPAPIVisiblePluginTester, AlertInWindowMessage) { #endif TEST_F(NPAPIVisiblePluginTester, VerifyNPObjectLifetimeTest) { - if (!UITest::in_process_renderer()) { - show_window_ = true; - std::wstring test_case = L"npobject_lifetime_test.html"; - GURL url = GetTestUrl(L"npapi", test_case); - NavigateToURL(url); - WaitForFinish("npobject_lifetime_test", "1", url, - kTestCompleteCookie, kTestCompleteSuccess, - kShortWaitTimeout); - } + if (UITest::in_process_renderer()) + return; + + show_window_ = true; + std::wstring test_case = L"npobject_lifetime_test.html"; + GURL url = GetTestUrl(L"npapi", test_case); + NavigateToURL(url); + WaitForFinish("npobject_lifetime_test", "1", url, + kTestCompleteCookie, kTestCompleteSuccess, + kShortWaitTimeout); } // Tests that we don't crash or assert if NPP_New fails @@ -255,14 +258,15 @@ TEST_F(NPAPIVisiblePluginTester, NewFails) { } TEST_F(NPAPIVisiblePluginTester, SelfDeletePluginInNPNEvaluate) { - if (!UITest::in_process_renderer()) { - GURL url = GetTestUrl(L"npapi", - L"execute_script_delete_in_npn_evaluate.html"); - NavigateToURL(url); - WaitForFinish("npobject_delete_plugin_in_evaluate", "1", url, - kTestCompleteCookie, kTestCompleteSuccess, - kShortWaitTimeout); - } + if (UITest::in_process_renderer()) + return; + + GURL url = GetTestUrl(L"npapi", + L"execute_script_delete_in_npn_evaluate.html"); + NavigateToURL(url); + WaitForFinish("npobject_delete_plugin_in_evaluate", "1", url, + kTestCompleteCookie, kTestCompleteSuccess, + kShortWaitTimeout); } // Flaky. See http://crbug.com/17645 @@ -321,3 +325,14 @@ TEST_F(NPAPIVisiblePluginTester, GetURLRequestFailWrite) { WaitForFinish("geturl_fail_write", "1", url, kTestCompleteCookie, kTestCompleteSuccess, kShortWaitTimeout); } + +TEST_F(NPAPITester, EnsureScriptingWorksInDestroy) { + if (UITest::in_process_renderer()) + return; + + GURL url = GetTestUrl(L"npapi", L"ensure_scripting_works_in_destroy.html"); + NavigateToURL(url); + WaitForFinish("ensure_scripting_works_in_destroy", "1", url, + kTestCompleteCookie, kTestCompleteSuccess, + kShortWaitTimeout); +} |