| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 "base/command_line.h" | 5 #include "base/command_line.h" |
| 6 #include "base/file_util.h" | 6 #include "base/file_util.h" |
| 7 #include "base/path_service.h" | 7 #include "base/path_service.h" |
| 8 #include "base/utf_string_conversions.h" | 8 #include "base/utf_string_conversions.h" |
| 9 #include "content/public/browser/browser_thread.h" | 9 #include "content/public/browser/browser_thread.h" |
| 10 #include "content/public/common/content_switches.h" | 10 #include "content/public/common/content_switches.h" |
| (...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 129 // Make sure that navigating away from a plugin referenced by JS doesn't | 129 // Make sure that navigating away from a plugin referenced by JS doesn't |
| 130 // crash. | 130 // crash. |
| 131 IN_PROC_BROWSER_TEST_F(PluginTest, UnloadNoCrash) { | 131 IN_PROC_BROWSER_TEST_F(PluginTest, UnloadNoCrash) { |
| 132 LoadAndWait(GetURL("layout_test_plugin.html")); | 132 LoadAndWait(GetURL("layout_test_plugin.html")); |
| 133 NavigateAway(); | 133 NavigateAway(); |
| 134 } | 134 } |
| 135 | 135 |
| 136 // Tests if a plugin executing a self deleting script using NPN_GetURL | 136 // Tests if a plugin executing a self deleting script using NPN_GetURL |
| 137 // works without crashing or hanging | 137 // works without crashing or hanging |
| 138 // Flaky: http://crbug.com/59327 | 138 // Flaky: http://crbug.com/59327 |
| 139 IN_PROC_BROWSER_TEST_F(PluginTest, SelfDeletePluginGetUrl) { | 139 IN_PROC_BROWSER_TEST_F(PluginTest, MAYBE(SelfDeletePluginGetUrl)) { |
| 140 LoadAndWait(GetURL("self_delete_plugin_geturl.html")); | 140 LoadAndWait(GetURL("self_delete_plugin_geturl.html")); |
| 141 } | 141 } |
| 142 | 142 |
| 143 // Tests if a plugin executing a self deleting script using Invoke | 143 // Tests if a plugin executing a self deleting script using Invoke |
| 144 // works without crashing or hanging | 144 // works without crashing or hanging |
| 145 // Flaky. See http://crbug.com/30702 | 145 // Flaky. See http://crbug.com/30702 |
| 146 IN_PROC_BROWSER_TEST_F(PluginTest, SelfDeletePluginInvoke) { | 146 IN_PROC_BROWSER_TEST_F(PluginTest, MAYBE(SelfDeletePluginInvoke)) { |
| 147 LoadAndWait(GetURL("self_delete_plugin_invoke.html")); | 147 LoadAndWait(GetURL("self_delete_plugin_invoke.html")); |
| 148 } | 148 } |
| 149 | 149 |
| 150 IN_PROC_BROWSER_TEST_F(PluginTest, NPObjectReleasedOnDestruction) { | 150 IN_PROC_BROWSER_TEST_F(PluginTest, NPObjectReleasedOnDestruction) { |
| 151 NavigateToURL(shell(), GetURL("npobject_released_on_destruction.html")); | 151 NavigateToURL(shell(), GetURL("npobject_released_on_destruction.html")); |
| 152 NavigateAway(); | 152 NavigateAway(); |
| 153 } | 153 } |
| 154 | 154 |
| 155 // Test that a dialog is properly created when a plugin throws an | 155 // Test that a dialog is properly created when a plugin throws an |
| 156 // exception. Should be run for in and out of process plugins, but | 156 // exception. Should be run for in and out of process plugins, but |
| 157 // the more interesting case is out of process, where we must route | 157 // the more interesting case is out of process, where we must route |
| 158 // the exception to the correct renderer. | 158 // the exception to the correct renderer. |
| 159 IN_PROC_BROWSER_TEST_F(PluginTest, NPObjectSetException) { | 159 IN_PROC_BROWSER_TEST_F(PluginTest, NPObjectSetException) { |
| 160 LoadAndWait(GetURL("npobject_set_exception.html")); | 160 LoadAndWait(GetURL("npobject_set_exception.html")); |
| 161 } | 161 } |
| 162 | 162 |
| 163 #if defined(OS_WIN) | 163 #if defined(OS_WIN) |
| 164 // Tests if a plugin executing a self deleting script in the context of | 164 // Tests if a plugin executing a self deleting script in the context of |
| 165 // a synchronous mouseup works correctly. | 165 // a synchronous mouseup works correctly. |
| 166 // This was never ported to Mac. The only thing remaining is to make | 166 // This was never ported to Mac. The only thing remaining is to make |
| 167 // SimulateMouseClick get to Mac plugins, currently it doesn't work. | 167 // SimulateMouseClick get to Mac plugins, currently it doesn't work. |
| 168 IN_PROC_BROWSER_TEST_F(PluginTest, | 168 IN_PROC_BROWSER_TEST_F(PluginTest, |
| 169 SelfDeletePluginInvokeInSynchronousMouseUp) { | 169 MAYBE(SelfDeletePluginInvokeInSynchronousMouseUp)) { |
| 170 NavigateToURL(shell(), GetURL("execute_script_delete_in_mouse_up.html")); | 170 NavigateToURL(shell(), GetURL("execute_script_delete_in_mouse_up.html")); |
| 171 | 171 |
| 172 string16 expected_title(ASCIIToUTF16("OK")); | 172 string16 expected_title(ASCIIToUTF16("OK")); |
| 173 TitleWatcher title_watcher(shell()->web_contents(), expected_title); | 173 TitleWatcher title_watcher(shell()->web_contents(), expected_title); |
| 174 title_watcher.AlsoWaitForTitle(ASCIIToUTF16("FAIL")); | 174 title_watcher.AlsoWaitForTitle(ASCIIToUTF16("FAIL")); |
| 175 SimulateMouseClick(shell()->web_contents(), 0, | 175 SimulateMouseClick(shell()->web_contents(), 0, |
| 176 WebKit::WebMouseEvent::ButtonLeft); | 176 WebKit::WebMouseEvent::ButtonLeft); |
| 177 EXPECT_EQ(expected_title, title_watcher.WaitAndGetTitle()); | 177 EXPECT_EQ(expected_title, title_watcher.WaitAndGetTitle()); |
| 178 } | 178 } |
| 179 #endif | 179 #endif |
| 180 | 180 |
| 181 // Flaky, http://crbug.com/60071. | 181 // Flaky, http://crbug.com/60071. |
| 182 IN_PROC_BROWSER_TEST_F(PluginTest, GetURLRequest404Response) { | 182 IN_PROC_BROWSER_TEST_F(PluginTest, MAYBE(GetURLRequest404Response)) { |
| 183 GURL url(URLRequestMockHTTPJob::GetMockUrl( | 183 GURL url(URLRequestMockHTTPJob::GetMockUrl( |
| 184 base::FilePath().AppendASCII("npapi"). | 184 base::FilePath().AppendASCII("npapi"). |
| 185 AppendASCII("plugin_url_request_404.html"))); | 185 AppendASCII("plugin_url_request_404.html"))); |
| 186 LoadAndWait(url); | 186 LoadAndWait(url); |
| 187 } | 187 } |
| 188 | 188 |
| 189 // Tests if a plugin executing a self deleting script using Invoke with | 189 // Tests if a plugin executing a self deleting script using Invoke with |
| 190 // a modal dialog showing works without crashing or hanging | 190 // a modal dialog showing works without crashing or hanging |
| 191 // Disabled, flakily exceeds timeout, http://crbug.com/46257. | 191 // Disabled, flakily exceeds timeout, http://crbug.com/46257. |
| 192 IN_PROC_BROWSER_TEST_F(PluginTest, SelfDeletePluginInvokeAlert) { | 192 IN_PROC_BROWSER_TEST_F(PluginTest, MAYBE(SelfDeletePluginInvokeAlert)) { |
| 193 // Navigate asynchronously because if we waitd until it completes, there's a | 193 // Navigate asynchronously because if we waitd until it completes, there's a |
| 194 // race condition where the alert can come up before we start watching for it. | 194 // race condition where the alert can come up before we start watching for it. |
| 195 shell()->LoadURL(GetURL("self_delete_plugin_invoke_alert.html")); | 195 shell()->LoadURL(GetURL("self_delete_plugin_invoke_alert.html")); |
| 196 | 196 |
| 197 string16 expected_title(ASCIIToUTF16("OK")); | 197 string16 expected_title(ASCIIToUTF16("OK")); |
| 198 TitleWatcher title_watcher(shell()->web_contents(), expected_title); | 198 TitleWatcher title_watcher(shell()->web_contents(), expected_title); |
| 199 title_watcher.AlsoWaitForTitle(ASCIIToUTF16("FAIL")); | 199 title_watcher.AlsoWaitForTitle(ASCIIToUTF16("FAIL")); |
| 200 | 200 |
| 201 WaitForAppModalDialog(shell()); | 201 WaitForAppModalDialog(shell()); |
| 202 | 202 |
| 203 EXPECT_EQ(expected_title, title_watcher.WaitAndGetTitle()); | 203 EXPECT_EQ(expected_title, title_watcher.WaitAndGetTitle()); |
| 204 } | 204 } |
| 205 | 205 |
| 206 // Test passing arguments to a plugin. | 206 // Test passing arguments to a plugin. |
| 207 IN_PROC_BROWSER_TEST_F(PluginTest, Arguments) { | 207 IN_PROC_BROWSER_TEST_F(PluginTest, MAYBE(Arguments)) { |
| 208 LoadAndWait(GetURL("arguments.html")); | 208 LoadAndWait(GetURL("arguments.html")); |
| 209 } | 209 } |
| 210 | 210 |
| 211 // Test invoking many plugins within a single page. | 211 // Test invoking many plugins within a single page. |
| 212 IN_PROC_BROWSER_TEST_F(PluginTest, ManyPlugins) { | 212 IN_PROC_BROWSER_TEST_F(PluginTest, ManyPlugins) { |
| 213 LoadAndWait(GetURL("many_plugins.html")); | 213 LoadAndWait(GetURL("many_plugins.html")); |
| 214 } | 214 } |
| 215 | 215 |
| 216 // Test various calls to GetURL from a plugin. | 216 // Test various calls to GetURL from a plugin. |
| 217 IN_PROC_BROWSER_TEST_F(PluginTest, GetURL) { | 217 IN_PROC_BROWSER_TEST_F(PluginTest, GetURL) { |
| (...skipping 240 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 458 IN_PROC_BROWSER_TEST_F(PluginTest, DISABLED_Java) { | 458 IN_PROC_BROWSER_TEST_F(PluginTest, DISABLED_Java) { |
| 459 TestPlugin("Java.html"); | 459 TestPlugin("Java.html"); |
| 460 } | 460 } |
| 461 | 461 |
| 462 IN_PROC_BROWSER_TEST_F(PluginTest, Silverlight) { | 462 IN_PROC_BROWSER_TEST_F(PluginTest, Silverlight) { |
| 463 TestPlugin("silverlight.html"); | 463 TestPlugin("silverlight.html"); |
| 464 } | 464 } |
| 465 #endif // defined(OS_WIN) | 465 #endif // defined(OS_WIN) |
| 466 | 466 |
| 467 } // namespace content | 467 } // namespace content |
| OLD | NEW |