| OLD | NEW |
| 1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 "build/build_config.h" | 5 #include "build/build_config.h" |
| 6 | 6 |
| 7 #if defined(OS_WIN) | 7 #if defined(OS_WIN) |
| 8 // windows headers | 8 // windows headers |
| 9 #include <comutil.h> | 9 #include <comutil.h> |
| 10 #include <shellapi.h> | 10 #include <shellapi.h> |
| 11 #include <shlobj.h> | 11 #include <shlobj.h> |
| (...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 95 // original pointer is returned and not a proxy. If this fails the plugin | 95 // original pointer is returned and not a proxy. If this fails the plugin |
| 96 // will crash. | 96 // will crash. |
| 97 TEST_F(NPAPITester, NPObjectProxy) { | 97 TEST_F(NPAPITester, NPObjectProxy) { |
| 98 const FilePath test_case(FILE_PATH_LITERAL("npobject_proxy.html")); | 98 const FilePath test_case(FILE_PATH_LITERAL("npobject_proxy.html")); |
| 99 GURL url = ui_test_utils::GetTestUrl(FilePath(kTestDir), test_case); | 99 GURL url = ui_test_utils::GetTestUrl(FilePath(kTestDir), test_case); |
| 100 ASSERT_NO_FATAL_FAILURE(NavigateToURL(url)); | 100 ASSERT_NO_FATAL_FAILURE(NavigateToURL(url)); |
| 101 WaitForFinish("npobject_proxy", "1", url, kTestCompleteCookie, | 101 WaitForFinish("npobject_proxy", "1", url, kTestCompleteCookie, |
| 102 kTestCompleteSuccess, action_max_timeout_ms()); | 102 kTestCompleteSuccess, action_max_timeout_ms()); |
| 103 } | 103 } |
| 104 | 104 |
| 105 // Tests if a plugin executing a self deleting script using NPN_GetURL | |
| 106 // works without crashing or hanging | |
| 107 TEST_F(NPAPITester, SelfDeletePluginGetUrl) { | |
| 108 const FilePath test_case(FILE_PATH_LITERAL("self_delete_plugin_geturl.html")); | |
| 109 GURL url = ui_test_utils::GetTestUrl(FilePath(kTestDir), test_case); | |
| 110 ASSERT_NO_FATAL_FAILURE(NavigateToURL(url)); | |
| 111 WaitForFinish("self_delete_plugin_geturl", "1", url, | |
| 112 kTestCompleteCookie, kTestCompleteSuccess, | |
| 113 action_max_timeout_ms()); | |
| 114 } | |
| 115 | |
| 116 // Tests if a plugin executing a self deleting script using Invoke | |
| 117 // works without crashing or hanging | |
| 118 // Flaky. See http://crbug.com/30702 | |
| 119 TEST_F(NPAPITester, FLAKY_SelfDeletePluginInvoke) { | |
| 120 const FilePath test_case(FILE_PATH_LITERAL("self_delete_plugin_invoke.html")); | |
| 121 GURL url = ui_test_utils::GetTestUrl(FilePath(kTestDir), test_case); | |
| 122 ASSERT_NO_FATAL_FAILURE(NavigateToURL(url)); | |
| 123 WaitForFinish("self_delete_plugin_invoke", "1", url, | |
| 124 kTestCompleteCookie, kTestCompleteSuccess, | |
| 125 action_max_timeout_ms()); | |
| 126 } | |
| 127 | |
| 128 #if defined(OS_WIN) || defined(OS_MACOSX) | 105 #if defined(OS_WIN) || defined(OS_MACOSX) |
| 129 // Tests if a plugin executing a self deleting script in the context of | 106 // Tests if a plugin executing a self deleting script in the context of |
| 130 // a synchronous paint event works correctly | 107 // a synchronous paint event works correctly |
| 131 // http://crbug.com/44960 | 108 // http://crbug.com/44960 |
| 132 TEST_F(NPAPIVisiblePluginTester, | 109 TEST_F(NPAPIVisiblePluginTester, |
| 133 FLAKY_SelfDeletePluginInvokeInSynchronousPaint) { | 110 FLAKY_SelfDeletePluginInvokeInSynchronousPaint) { |
| 134 if (UITest::in_process_renderer()) | 111 if (UITest::in_process_renderer()) |
| 135 return; | 112 return; |
| 136 | 113 |
| 137 show_window_ = true; | 114 show_window_ = true; |
| (...skipping 219 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 357 GURL url = ui_test_utils::GetTestUrl(FilePath(kTestDir), test_case); | 334 GURL url = ui_test_utils::GetTestUrl(FilePath(kTestDir), test_case); |
| 358 NavigateToURL(url); | 335 NavigateToURL(url); |
| 359 WaitForFinish("no_hang_if_init_crashes", "1", url, | 336 WaitForFinish("no_hang_if_init_crashes", "1", url, |
| 360 kTestCompleteCookie, kTestCompleteSuccess, | 337 kTestCompleteCookie, kTestCompleteSuccess, |
| 361 action_max_timeout_ms()); | 338 action_max_timeout_ms()); |
| 362 CloseHandle(crash_event); | 339 CloseHandle(crash_event); |
| 363 } | 340 } |
| 364 | 341 |
| 365 #endif | 342 #endif |
| 366 | 343 |
| 367 TEST_F(NPAPITester, NPObjectReleasedOnDestruction) { | |
| 368 if (UITest::in_process_renderer()) | |
| 369 return; | |
| 370 | |
| 371 const FilePath test_case( | |
| 372 FILE_PATH_LITERAL("npobject_released_on_destruction.html")); | |
| 373 GURL url = ui_test_utils::GetTestUrl(FilePath(kTestDir), test_case); | |
| 374 ASSERT_NO_FATAL_FAILURE(NavigateToURL(url)); | |
| 375 | |
| 376 scoped_refptr<BrowserProxy> window_proxy(automation()->GetBrowserWindow(0)); | |
| 377 ASSERT_TRUE(window_proxy); | |
| 378 ASSERT_TRUE(window_proxy->AppendTab(GURL(chrome::kAboutBlankURL))); | |
| 379 | |
| 380 scoped_refptr<TabProxy> tab_proxy(window_proxy->GetTab(0)); | |
| 381 ASSERT_TRUE(tab_proxy.get()); | |
| 382 ASSERT_TRUE(tab_proxy->Close(true)); | |
| 383 } | |
| 384 | |
| 385 // Test that a dialog is properly created when a plugin throws an | |
| 386 // exception. Should be run for in and out of process plugins, but | |
| 387 // the more interesting case is out of process, where we must route | |
| 388 // the exception to the correct renderer. | |
| 389 TEST_F(NPAPITester, NPObjectSetException) { | |
| 390 const FilePath test_case(FILE_PATH_LITERAL("npobject_set_exception.html")); | |
| 391 GURL url = ui_test_utils::GetTestUrl(FilePath(kTestDir), test_case); | |
| 392 ASSERT_NO_FATAL_FAILURE(NavigateToURL(url)); | |
| 393 WaitForFinish("npobject_set_exception", "1", url, | |
| 394 kTestCompleteCookie, kTestCompleteSuccess, | |
| 395 action_max_timeout_ms()); | |
| 396 } | |
| 397 | |
| 398 TEST_F(NPAPIVisiblePluginTester, PluginReferrerTest) { | 344 TEST_F(NPAPIVisiblePluginTester, PluginReferrerTest) { |
| 399 if (UITest::in_process_renderer()) | 345 if (UITest::in_process_renderer()) |
| 400 return; | 346 return; |
| 401 | 347 |
| 402 GURL url(URLRequestMockHTTPJob::GetMockUrl( | 348 GURL url(URLRequestMockHTTPJob::GetMockUrl( |
| 403 FilePath(FILE_PATH_LITERAL( | 349 FilePath(FILE_PATH_LITERAL( |
| 404 "npapi/plugin_url_request_referrer_test.html")))); | 350 "npapi/plugin_url_request_referrer_test.html")))); |
| 405 | 351 |
| 406 ASSERT_NO_FATAL_FAILURE(NavigateToURL(url)); | 352 ASSERT_NO_FATAL_FAILURE(NavigateToURL(url)); |
| 407 | 353 |
| (...skipping 16 matching lines...) Expand all Loading... |
| 424 FilePath(FILE_PATH_LITERAL("npapi/convert_point.html")))); | 370 FilePath(FILE_PATH_LITERAL("npapi/convert_point.html")))); |
| 425 ASSERT_NO_FATAL_FAILURE(NavigateToURL(url)); | 371 ASSERT_NO_FATAL_FAILURE(NavigateToURL(url)); |
| 426 | 372 |
| 427 // TODO(stuartmorgan): When the automation system supports sending clicks, | 373 // TODO(stuartmorgan): When the automation system supports sending clicks, |
| 428 // change the test to trigger on mouse-down rather than window focus. | 374 // change the test to trigger on mouse-down rather than window focus. |
| 429 ASSERT_TRUE(browser->BringToFront()); | 375 ASSERT_TRUE(browser->BringToFront()); |
| 430 WaitForFinish("convert_point", "1", url, kTestCompleteCookie, | 376 WaitForFinish("convert_point", "1", url, kTestCompleteCookie, |
| 431 kTestCompleteSuccess, action_max_timeout_ms()); | 377 kTestCompleteSuccess, action_max_timeout_ms()); |
| 432 } | 378 } |
| 433 #endif | 379 #endif |
| OLD | NEW |