OLD | NEW |
1 // Copyright 2008, Google Inc. | 1 // Copyright 2008, Google Inc. |
2 // All rights reserved. | 2 // All rights reserved. |
3 // | 3 // |
4 // Redistribution and use in source and binary forms, with or without | 4 // Redistribution and use in source and binary forms, with or without |
5 // modification, are permitted provided that the following conditions are | 5 // modification, are permitted provided that the following conditions are |
6 // met: | 6 // met: |
7 // | 7 // |
8 // * Redistributions of source code must retain the above copyright | 8 // * Redistributions of source code must retain the above copyright |
9 // notice, this list of conditions and the following disclaimer. | 9 // notice, this list of conditions and the following disclaimer. |
10 // * Redistributions in binary form must reproduce the above | 10 // * Redistributions in binary form must reproduce the above |
(...skipping 16 matching lines...) Expand all Loading... |
27 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | 27 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
28 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 28 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
29 | 29 |
30 // | 30 // |
31 // NPAPI interactive UI tests. | 31 // NPAPI interactive UI tests. |
32 // | 32 // |
33 | 33 |
34 #include "app/keyboard_codes.h" | 34 #include "app/keyboard_codes.h" |
35 #include "base/file_path.h" | 35 #include "base/file_path.h" |
36 #include "chrome/browser/net/url_request_mock_http_job.h" | 36 #include "chrome/browser/net/url_request_mock_http_job.h" |
37 #include "chrome/test/automation/tab_proxy.h" | |
38 #include "chrome/test/automation/window_proxy.h" | 37 #include "chrome/test/automation/window_proxy.h" |
39 #include "chrome/test/ui/npapi_test_helper.h" | 38 #include "chrome/test/ui/npapi_test_helper.h" |
40 #include "chrome/test/ui_test_utils.h" | 39 #include "chrome/test/ui_test_utils.h" |
41 | 40 |
42 const char kTestCompleteCookie[] = "status"; | 41 const char kTestCompleteCookie[] = "status"; |
43 const char kTestCompleteSuccess[] = "OK"; | 42 const char kTestCompleteSuccess[] = "OK"; |
44 static const FilePath::CharType* kTestDir = FILE_PATH_LITERAL("npapi"); | 43 static const FilePath::CharType* kTestDir = FILE_PATH_LITERAL("npapi"); |
45 | 44 |
46 // Tests if a plugin executing a self deleting script in the context of | 45 // Tests if a plugin executing a self deleting script in the context of |
47 // a synchronous mousemove works correctly | 46 // a synchronous mousemove works correctly |
48 TEST_F(NPAPIVisiblePluginTester, SelfDeletePluginInvokeInSynchronousMouseMove) { | 47 TEST_F(NPAPIVisiblePluginTester, SelfDeletePluginInvokeInSynchronousMouseMove) { |
49 if (!UITest::in_process_renderer()) { | 48 if (UITest::in_process_renderer()) |
50 scoped_refptr<TabProxy> tab_proxy(GetActiveTab()); | 49 return; |
51 HWND tab_window = NULL; | |
52 tab_proxy->GetHWND(&tab_window); | |
53 | 50 |
54 EXPECT_TRUE(IsWindow(tab_window)); | 51 show_window_ = true; |
| 52 const FilePath kTestDir(FILE_PATH_LITERAL("npapi")); |
| 53 const FilePath test_case( |
| 54 FILE_PATH_LITERAL("execute_script_delete_in_mouse_move.html")); |
| 55 GURL url = ui_test_utils::GetTestUrl(kTestDir, test_case); |
| 56 NavigateToURL(url); |
55 | 57 |
56 show_window_ = true; | 58 scoped_refptr<WindowProxy> window(automation()->GetActiveWindow()); |
57 const FilePath kTestDir(FILE_PATH_LITERAL("npapi")); | |
58 const FilePath test_case( | |
59 FILE_PATH_LITERAL("execute_script_delete_in_mouse_move.html")); | |
60 GURL url = ui_test_utils::GetTestUrl(kTestDir, test_case); | |
61 NavigateToURL(url); | |
62 | 59 |
63 POINT cursor_position = {130, 130}; | 60 gfx::Point cursor_position(150, 250); |
64 ClientToScreen(tab_window, &cursor_position); | 61 window->SimulateOSMouseMove(cursor_position); |
65 | 62 |
66 double screen_width = ::GetSystemMetrics(SM_CXSCREEN) - 1; | 63 WaitForFinish("execute_script_delete_in_mouse_move", "1", url, |
67 double screen_height = ::GetSystemMetrics(SM_CYSCREEN) - 1; | 64 kTestCompleteCookie, kTestCompleteSuccess, |
68 double location_x = cursor_position.x * (65535.0f / screen_width); | 65 action_max_timeout_ms()); |
69 double location_y = cursor_position.y * (65535.0f / screen_height); | |
70 | |
71 INPUT input_info = {0}; | |
72 input_info.type = INPUT_MOUSE; | |
73 input_info.mi.dwFlags = MOUSEEVENTF_MOVE | MOUSEEVENTF_ABSOLUTE; | |
74 input_info.mi.dx = static_cast<long>(location_x); | |
75 input_info.mi.dy = static_cast<long>(location_y); | |
76 ::SendInput(1, &input_info, sizeof(INPUT)); | |
77 | |
78 WaitForFinish("execute_script_delete_in_mouse_move", "1", url, | |
79 kTestCompleteCookie, kTestCompleteSuccess, | |
80 action_max_timeout_ms()); | |
81 } | |
82 } | 66 } |
83 | 67 |
84 // Flaky, http://crbug.com/60071. | 68 // Flaky, http://crbug.com/60071. |
85 TEST_F(NPAPIVisiblePluginTester, FLAKY_GetURLRequest404Response) { | 69 TEST_F(NPAPIVisiblePluginTester, FLAKY_GetURLRequest404Response) { |
86 if (UITest::in_process_renderer()) | 70 if (UITest::in_process_renderer()) |
87 return; | 71 return; |
88 | 72 |
89 GURL url(URLRequestMockHTTPJob::GetMockUrl( | 73 GURL url(URLRequestMockHTTPJob::GetMockUrl( |
90 FilePath(FILE_PATH_LITERAL( | 74 FilePath(FILE_PATH_LITERAL( |
91 "npapi/plugin_url_request_404.html")))); | 75 "npapi/plugin_url_request_404.html")))); |
(...skipping 22 matching lines...) Expand all Loading... |
114 // Wait for the alert dialog and then close it. | 98 // Wait for the alert dialog and then close it. |
115 ASSERT_TRUE(automation()->WaitForAppModalDialog()); | 99 ASSERT_TRUE(automation()->WaitForAppModalDialog()); |
116 scoped_refptr<WindowProxy> window(automation()->GetActiveWindow()); | 100 scoped_refptr<WindowProxy> window(automation()->GetActiveWindow()); |
117 ASSERT_TRUE(window.get()); | 101 ASSERT_TRUE(window.get()); |
118 ASSERT_TRUE(window->SimulateOSKeyPress(app::VKEY_ESCAPE, 0)); | 102 ASSERT_TRUE(window->SimulateOSKeyPress(app::VKEY_ESCAPE, 0)); |
119 | 103 |
120 WaitForFinish("self_delete_plugin_invoke_alert", "1", url, | 104 WaitForFinish("self_delete_plugin_invoke_alert", "1", url, |
121 kTestCompleteCookie, kTestCompleteSuccess, | 105 kTestCompleteCookie, kTestCompleteSuccess, |
122 action_max_timeout_ms()); | 106 action_max_timeout_ms()); |
123 } | 107 } |
OLD | NEW |