| OLD | NEW |
| (Empty) |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | |
| 2 // Use of this source code is governed by a BSD-style license that can be | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 // NPAPI interactive UI tests. | |
| 6 | |
| 7 #include "base/file_path.h" | |
| 8 #include "base/test/test_timeouts.h" | |
| 9 #include "chrome/test/automation/automation_proxy.h" | |
| 10 #include "chrome/test/automation/window_proxy.h" | |
| 11 #include "chrome/test/base/ui_test_utils.h" | |
| 12 #include "chrome/test/ui/npapi_test_helper.h" | |
| 13 #include "content/browser/net/url_request_mock_http_job.h" | |
| 14 #include "ui/base/keycodes/keyboard_codes.h" | |
| 15 | |
| 16 const char kTestCompleteCookie[] = "status"; | |
| 17 const char kTestCompleteSuccess[] = "OK"; | |
| 18 static const FilePath::CharType* kTestDir = FILE_PATH_LITERAL("npapi"); | |
| 19 | |
| 20 // Tests if a plugin executing a self deleting script in the context of | |
| 21 // a synchronous mousemove works correctly | |
| 22 TEST_F(NPAPIVisiblePluginTester, SelfDeletePluginInvokeInSynchronousMouseMove) { | |
| 23 if (ProxyLauncher::in_process_renderer()) | |
| 24 return; | |
| 25 | |
| 26 show_window_ = true; | |
| 27 const FilePath kTestDir(FILE_PATH_LITERAL("npapi")); | |
| 28 const FilePath test_case( | |
| 29 FILE_PATH_LITERAL("execute_script_delete_in_mouse_move.html")); | |
| 30 GURL url = ui_test_utils::GetTestUrl(kTestDir, test_case); | |
| 31 NavigateToURL(url); | |
| 32 | |
| 33 scoped_refptr<WindowProxy> window(automation()->GetActiveWindow()); | |
| 34 | |
| 35 gfx::Point cursor_position(150, 250); | |
| 36 window->SimulateOSMouseMove(cursor_position); | |
| 37 | |
| 38 WaitForFinish("execute_script_delete_in_mouse_move", "1", url, | |
| 39 kTestCompleteCookie, kTestCompleteSuccess, | |
| 40 TestTimeouts::action_max_timeout_ms()); | |
| 41 } | |
| 42 | |
| 43 // Flaky, http://crbug.com/60071. | |
| 44 TEST_F(NPAPIVisiblePluginTester, FLAKY_GetURLRequest404Response) { | |
| 45 if (ProxyLauncher::in_process_renderer()) | |
| 46 return; | |
| 47 | |
| 48 GURL url(URLRequestMockHTTPJob::GetMockUrl( | |
| 49 FilePath(FILE_PATH_LITERAL( | |
| 50 "npapi/plugin_url_request_404.html")))); | |
| 51 | |
| 52 NavigateToURL(url); | |
| 53 | |
| 54 // Wait for the alert dialog and then close it. | |
| 55 automation()->WaitForAppModalDialog(); | |
| 56 scoped_refptr<WindowProxy> window(automation()->GetActiveWindow()); | |
| 57 ASSERT_TRUE(window.get()); | |
| 58 ASSERT_TRUE(window->SimulateOSKeyPress(ui::VKEY_ESCAPE, 0)); | |
| 59 | |
| 60 WaitForFinish("geturl_404_response", "1", url, kTestCompleteCookie, | |
| 61 kTestCompleteSuccess, TestTimeouts::action_max_timeout_ms()); | |
| 62 } | |
| 63 | |
| 64 // Tests if a plugin executing a self deleting script using Invoke with | |
| 65 // a modal dialog showing works without crashing or hanging | |
| 66 // Disabled, flakily exceeds timeout, http://crbug.com/46257. | |
| 67 TEST_F(NPAPIVisiblePluginTester, DISABLED_SelfDeletePluginInvokeAlert) { | |
| 68 const FilePath test_case( | |
| 69 FILE_PATH_LITERAL("self_delete_plugin_invoke_alert.html")); | |
| 70 GURL url = ui_test_utils::GetTestUrl(FilePath(kTestDir), test_case); | |
| 71 ASSERT_NO_FATAL_FAILURE(NavigateToURL(url)); | |
| 72 | |
| 73 // Wait for the alert dialog and then close it. | |
| 74 ASSERT_TRUE(automation()->WaitForAppModalDialog()); | |
| 75 scoped_refptr<WindowProxy> window(automation()->GetActiveWindow()); | |
| 76 ASSERT_TRUE(window.get()); | |
| 77 ASSERT_TRUE(window->SimulateOSKeyPress(ui::VKEY_ESCAPE, 0)); | |
| 78 | |
| 79 WaitForFinish("self_delete_plugin_invoke_alert", "1", url, | |
| 80 kTestCompleteCookie, kTestCompleteSuccess, | |
| 81 TestTimeouts::action_max_timeout_ms()); | |
| 82 } | |
| OLD | NEW |