OLD | NEW |
1 // Copyright 2008, Google Inc. | 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. |
2 // All rights reserved. | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // | 3 // found in the LICENSE file. |
4 // Redistribution and use in source and binary forms, with or without | |
5 // modification, are permitted provided that the following conditions are | |
6 // met: | |
7 // | |
8 // * Redistributions of source code must retain the above copyright | |
9 // notice, this list of conditions and the following disclaimer. | |
10 // * Redistributions in binary form must reproduce the above | |
11 // copyright notice, this list of conditions and the following disclaimer | |
12 // in the documentation and/or other materials provided with the | |
13 // distribution. | |
14 // * Neither the name of Google Inc. nor the names of its | |
15 // contributors may be used to endorse or promote products derived from | |
16 // this software without specific prior written permission. | |
17 // | |
18 // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS | |
19 // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT | |
20 // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR | |
21 // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT | |
22 // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, | |
23 // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT | |
24 // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, | |
25 // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY | |
26 // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | |
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. | |
29 | 4 |
30 // | 5 // |
31 // NPAPI interactive UI tests. | 6 // NPAPI interactive UI tests. |
32 // | 7 // |
33 | 8 |
34 #include "app/keyboard_codes.h" | |
35 #include "base/file_path.h" | 9 #include "base/file_path.h" |
36 #include "chrome/browser/net/url_request_mock_http_job.h" | 10 #include "chrome/browser/net/url_request_mock_http_job.h" |
37 #include "chrome/test/automation/window_proxy.h" | 11 #include "chrome/test/automation/window_proxy.h" |
38 #include "chrome/test/ui/npapi_test_helper.h" | 12 #include "chrome/test/ui/npapi_test_helper.h" |
39 #include "chrome/test/ui_test_utils.h" | 13 #include "chrome/test/ui_test_utils.h" |
| 14 #include "ui/base/keycodes/keyboard_codes.h" |
40 | 15 |
41 const char kTestCompleteCookie[] = "status"; | 16 const char kTestCompleteCookie[] = "status"; |
42 const char kTestCompleteSuccess[] = "OK"; | 17 const char kTestCompleteSuccess[] = "OK"; |
43 static const FilePath::CharType* kTestDir = FILE_PATH_LITERAL("npapi"); | 18 static const FilePath::CharType* kTestDir = FILE_PATH_LITERAL("npapi"); |
44 | 19 |
45 // Tests if a plugin executing a self deleting script in the context of | 20 // Tests if a plugin executing a self deleting script in the context of |
46 // a synchronous mousemove works correctly | 21 // a synchronous mousemove works correctly |
47 TEST_F(NPAPIVisiblePluginTester, SelfDeletePluginInvokeInSynchronousMouseMove) { | 22 TEST_F(NPAPIVisiblePluginTester, SelfDeletePluginInvokeInSynchronousMouseMove) { |
48 if (ProxyLauncher::in_process_renderer()) | 23 if (ProxyLauncher::in_process_renderer()) |
49 return; | 24 return; |
(...skipping 23 matching lines...) Expand all Loading... |
73 GURL url(URLRequestMockHTTPJob::GetMockUrl( | 48 GURL url(URLRequestMockHTTPJob::GetMockUrl( |
74 FilePath(FILE_PATH_LITERAL( | 49 FilePath(FILE_PATH_LITERAL( |
75 "npapi/plugin_url_request_404.html")))); | 50 "npapi/plugin_url_request_404.html")))); |
76 | 51 |
77 NavigateToURL(url); | 52 NavigateToURL(url); |
78 | 53 |
79 // Wait for the alert dialog and then close it. | 54 // Wait for the alert dialog and then close it. |
80 automation()->WaitForAppModalDialog(); | 55 automation()->WaitForAppModalDialog(); |
81 scoped_refptr<WindowProxy> window(automation()->GetActiveWindow()); | 56 scoped_refptr<WindowProxy> window(automation()->GetActiveWindow()); |
82 ASSERT_TRUE(window.get()); | 57 ASSERT_TRUE(window.get()); |
83 ASSERT_TRUE(window->SimulateOSKeyPress(app::VKEY_ESCAPE, 0)); | 58 ASSERT_TRUE(window->SimulateOSKeyPress(ui::VKEY_ESCAPE, 0)); |
84 | 59 |
85 WaitForFinish("geturl_404_response", "1", url, kTestCompleteCookie, | 60 WaitForFinish("geturl_404_response", "1", url, kTestCompleteCookie, |
86 kTestCompleteSuccess, action_max_timeout_ms()); | 61 kTestCompleteSuccess, action_max_timeout_ms()); |
87 } | 62 } |
88 | 63 |
89 // Tests if a plugin executing a self deleting script using Invoke with | 64 // Tests if a plugin executing a self deleting script using Invoke with |
90 // a modal dialog showing works without crashing or hanging | 65 // a modal dialog showing works without crashing or hanging |
91 // Disabled, flakily exceeds timeout, http://crbug.com/46257. | 66 // Disabled, flakily exceeds timeout, http://crbug.com/46257. |
92 TEST_F(NPAPIVisiblePluginTester, DISABLED_SelfDeletePluginInvokeAlert) { | 67 TEST_F(NPAPIVisiblePluginTester, DISABLED_SelfDeletePluginInvokeAlert) { |
93 const FilePath test_case( | 68 const FilePath test_case( |
94 FILE_PATH_LITERAL("self_delete_plugin_invoke_alert.html")); | 69 FILE_PATH_LITERAL("self_delete_plugin_invoke_alert.html")); |
95 GURL url = ui_test_utils::GetTestUrl(FilePath(kTestDir), test_case); | 70 GURL url = ui_test_utils::GetTestUrl(FilePath(kTestDir), test_case); |
96 ASSERT_NO_FATAL_FAILURE(NavigateToURL(url)); | 71 ASSERT_NO_FATAL_FAILURE(NavigateToURL(url)); |
97 | 72 |
98 // Wait for the alert dialog and then close it. | 73 // Wait for the alert dialog and then close it. |
99 ASSERT_TRUE(automation()->WaitForAppModalDialog()); | 74 ASSERT_TRUE(automation()->WaitForAppModalDialog()); |
100 scoped_refptr<WindowProxy> window(automation()->GetActiveWindow()); | 75 scoped_refptr<WindowProxy> window(automation()->GetActiveWindow()); |
101 ASSERT_TRUE(window.get()); | 76 ASSERT_TRUE(window.get()); |
102 ASSERT_TRUE(window->SimulateOSKeyPress(app::VKEY_ESCAPE, 0)); | 77 ASSERT_TRUE(window->SimulateOSKeyPress(ui::VKEY_ESCAPE, 0)); |
103 | 78 |
104 WaitForFinish("self_delete_plugin_invoke_alert", "1", url, | 79 WaitForFinish("self_delete_plugin_invoke_alert", "1", url, |
105 kTestCompleteCookie, kTestCompleteSuccess, | 80 kTestCompleteCookie, kTestCompleteSuccess, |
106 action_max_timeout_ms()); | 81 action_max_timeout_ms()); |
107 } | 82 } |
OLD | NEW |