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