diff options
author | jam@chromium.org <jam@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-07-23 23:14:59 +0000 |
---|---|---|
committer | jam@chromium.org <jam@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-07-23 23:14:59 +0000 |
commit | 95b2791c43c87191139175592c5e43ad17972d2a (patch) | |
tree | 717e46b1e28abbef00243c2d3dc6a39a910f0805 | |
parent | 70e7aeaa9fadc8709a3265fc6b0c035405af591d (diff) | |
download | chromium_src-95b2791c43c87191139175592c5e43ad17972d2a.zip chromium_src-95b2791c43c87191139175592c5e43ad17972d2a.tar.gz chromium_src-95b2791c43c87191139175592c5e43ad17972d2a.tar.bz2 |
Move plugin_browsertests.cc from browser_tests to content_browsertests.
BUG=90448
Review URL: https://chromiumcodereview.appspot.com/10806056
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@147983 0039d316-1c4b-4281-b951-d872f2087c98
79 files changed, 200 insertions, 1586 deletions
diff --git a/chrome/browser/fast_shutdown_browsertest.cc b/chrome/browser/fast_shutdown_browsertest.cc index 0a491ed..945ac62 100644 --- a/chrome/browser/fast_shutdown_browsertest.cc +++ b/chrome/browser/fast_shutdown_browsertest.cc @@ -10,6 +10,7 @@ #include "chrome/browser/ui/browser.h" #include "chrome/browser/ui/browser_commands.h" #include "chrome/browser/ui/browser_list.h" +#include "chrome/common/chrome_switches.h" #include "chrome/common/chrome_notification_types.h" #include "chrome/test/automation/automation_proxy.h" #include "chrome/test/automation/browser_proxy.h" @@ -18,7 +19,6 @@ #include "chrome/test/base/ui_test_utils.h" #include "content/public/browser/browser_thread.h" #include "content/public/browser/notification_service.h" -#include "content/public/common/content_switches.h" #include "net/cookies/cookie_store.h" #include "net/url_request/url_request_context.h" #include "net/url_request/url_request_context_getter.h" diff --git a/chrome/browser_tests.isolate b/chrome/browser_tests.isolate index aa0c0a8..376b442 100644 --- a/chrome/browser_tests.isolate +++ b/chrome/browser_tests.isolate @@ -598,38 +598,6 @@ 'test/data/nosniff-test.html.mock-http-headers', 'test/data/notifications/notifications_request_function.html', 'test/data/notifications/notifications_request_inline.html', - 'test/data/npapi/arguments.html', - 'test/data/npapi/get_javascript_open_popup_with_plugin.html', - 'test/data/npapi/get_javascript_url.html', - 'test/data/npapi/get_javascript_url2.html', - 'test/data/npapi/get_javascript_url2_frame.html', - 'test/data/npapi/geturl.html', - 'test/data/npapi/geturl_redirect_notify.html', - 'test/data/npapi/layout_test_plugin.html', - 'test/data/npapi/many_plugins.html', - 'test/data/npapi/npapi.js', - 'test/data/npapi/npobject_identity.html', - 'test/data/npapi/npobject_proxy.html', - 'test/data/npapi/npobject_released_on_destruction.html', - 'test/data/npapi/npobject_set_exception.html', - 'test/data/npapi/plugin_delete_in_deallocate.html', - 'test/data/npapi/plugin_read_page.html', - 'test/data/npapi/plugin_read_page.html.mock-http-headers', - 'test/data/npapi/plugin_read_page_redirect_src.html', - 'test/data/npapi/plugin_read_page_redirect_src.html.mock-http-headers', - 'test/data/npapi/plugin_ref_target_page.html', - 'test/data/npapi/plugin_ref_target_page.html.mock-http-headers', - 'test/data/npapi/plugin_thread_async_call.html', - 'test/data/npapi/plugin_url_request_404.html', - 'test/data/npapi/plugin_url_request_fail_write.html', - 'test/data/npapi/plugin_url_request_referrer_test.html', - 'test/data/npapi/popup_window_with_target_plugin.html', - 'test/data/npapi/private.html', - 'test/data/npapi/schedule_timer.html', - 'test/data/npapi/self_delete_plugin_geturl.html', - 'test/data/npapi/self_delete_plugin_invoke.html', - 'test/data/npapi/self_delete_plugin_invoke_alert.html', - 'test/data/npapi/self_delete_plugin_stream.html', 'test/data/page_cycler/animate2.gif', 'test/data/page_cycler/basic_css.html', 'test/data/page_cycler/basic_html.html', diff --git a/chrome/chrome_tests.gypi b/chrome/chrome_tests.gypi index f95471a9a36..d0a882a 100644 --- a/chrome/chrome_tests.gypi +++ b/chrome/chrome_tests.gypi @@ -2638,7 +2638,6 @@ # Runtime dependencies '../ppapi/ppapi_internal.gyp:ppapi_tests', '../third_party/mesa/mesa.gyp:osmesa', - '../webkit/webkit.gyp:pull_in_copy_TestNetscapePlugIn', ], 'include_dirs': [ '..', @@ -3067,7 +3066,6 @@ '../content/browser/in_process_webkit/indexed_db_layout_browsertest.cc', '../content/browser/indexed_db/idbbindingutilities_browsertest.cc', '../content/browser/media_browsertest.cc', - '../content/browser/plugin_browsertest.cc', '../content/browser/plugin_data_remover_impl_browsertest.cc', '../content/browser/plugin_service_impl_browsertest.cc', '../content/browser/renderer_host/render_process_host_browsertest.cc', @@ -3351,8 +3349,6 @@ 'dependencies': [ # build time dependency. '../v8/tools/gyp/v8.gyp:v8_shell#host', - # run time dependency - '../webkit/webkit.gyp:copy_npapi_test_plugin', ], }], ['component=="shared_library" and incremental_chrome_dll!=1', { @@ -3366,7 +3362,6 @@ ], ['use_aura==1', { 'sources!': [ - '../content/browser/plugin_browsertest.cc', '../content/browser/accessibility/dump_accessibility_tree_browsertest.cc', '../content/browser/accessibility/dump_accessibility_tree_helper_win.cc', '../content/browser/accessibility/dump_accessibility_tree_helper.cc', @@ -3440,7 +3435,6 @@ '../webkit/webkit.gyp:test_shell_test_support', # Runtime dependencies '../third_party/mesa/mesa.gyp:osmesa', - '../webkit/webkit.gyp:pull_in_copy_TestNetscapePlugIn', ], 'include_dirs': [ '..', diff --git a/chrome/common/chrome_switches.cc b/chrome/common/chrome_switches.cc index f24754f..a981722 100644 --- a/chrome/common/chrome_switches.cc +++ b/chrome/common/chrome_switches.cc @@ -358,6 +358,9 @@ const char kDisableLoginAnimations[] = "disable-login-animations"; // Disables the menu on the NTP for accessing sessions from other devices. const char kDisableNTPOtherSessionsMenu[] = "disable-ntp-other-sessions-menu"; +// Disable pop-up blocking. +const char kDisablePopupBlocking[] = "disable-popup-blocking"; + // Disable speculative TCP/IP preconnection. const char kDisablePreconnect[] = "disable-preconnect"; diff --git a/chrome/common/chrome_switches.h b/chrome/common/chrome_switches.h index 02f8eae..bbbb7a7 100644 --- a/chrome/common/chrome_switches.h +++ b/chrome/common/chrome_switches.h @@ -103,6 +103,7 @@ extern const char kDisableIPPooling[]; extern const char kDisableNonFullscreenMouseLock[]; extern const char kDisableNTPOtherSessionsMenu[]; extern const char kDisableLoginAnimations[]; +extern const char kDisablePopupBlocking[]; extern const char kDisablePreconnect[]; extern const char kDisablePromptOnRepost[]; extern const char kDisableRestoreBackgroundContents[]; diff --git a/chrome/test/base/in_process_browser_test.h b/chrome/test/base/in_process_browser_test.h index 39596cc..256e113 100644 --- a/chrome/test/base/in_process_browser_test.h +++ b/chrome/test/base/in_process_browser_test.h @@ -110,11 +110,6 @@ class InProcessBrowserTest : public BrowserTestBase { void AddTabAtIndex(int index, const GURL& url, content::PageTransition transition); - // Override this to add any custom setup code that needs to be done on the - // main thread after the browser is created and just before calling - // RunTestOnMainThread(). - virtual void SetUpOnMainThread() {} - // Initializes the contents of the user data directory. Called by SetUp() // after creating the user data directory, but before any browser is launched. // If a test wishes to set up some initial non-empty state in the user data @@ -122,9 +117,6 @@ class InProcessBrowserTest : public BrowserTestBase { // successful. virtual bool SetUpUserDataDirectory() WARN_UNUSED_RESULT; - // Override this to add command line flags specific to your test. - virtual void SetUpCommandLine(CommandLine* command_line) {} - // Override this to add any custom cleanup code that needs to be done on the // main thread before the browser is torn down. virtual void CleanUpOnMainThread() {} diff --git a/chrome/test/base/test_launcher_utils.cc b/chrome/test/base/test_launcher_utils.cc index 2885a2b..ac1c97e 100644 --- a/chrome/test/base/test_launcher_utils.cc +++ b/chrome/test/base/test_launcher_utils.cc @@ -49,9 +49,6 @@ void PrepareBrowserCommandLineForTests(CommandLine* command_line) { // auto-update. command_line->AppendSwitch(switches::kSkipGpuDataLoading); - // The tests assume that file:// URIs can freely access other file:// URIs. - command_line->AppendSwitch(switches::kAllowFileAccessFromFiles); - #if defined(USE_ASH) // Disable window animations under Ash as the animations effect the // coordinates returned and result in flake. diff --git a/chrome/test/base/ui_test_utils.cc b/chrome/test/base/ui_test_utils.cc index 3a54d78..ab3d344 100644 --- a/chrome/test/base/ui_test_utils.cc +++ b/chrome/test/base/ui_test_utils.cc @@ -566,11 +566,6 @@ AppModalDialog* WaitForAppModalDialog() { return content::Source<AppModalDialog>(observer.source()).ptr(); } -void WaitForAppModalDialogAndCloseIt() { - AppModalDialog* dialog = WaitForAppModalDialog(); - dialog->CloseModalDialog(); -} - void CrashTab(WebContents* tab) { content::RenderProcessHost* rph = tab->GetRenderProcessHost(); content::WindowedNotificationObserver observer( diff --git a/chrome/test/base/ui_test_utils.h b/chrome/test/base/ui_test_utils.h index fa7ff6ad..232997c 100644 --- a/chrome/test/base/ui_test_utils.h +++ b/chrome/test/base/ui_test_utils.h @@ -195,7 +195,6 @@ GURL GetFileUrlWithQuery(const FilePath& path, const std::string& query_string); // Blocks until an application modal dialog is showns and returns it. AppModalDialog* WaitForAppModalDialog(); -void WaitForAppModalDialogAndCloseIt(); // Causes the specified tab to crash. Blocks until it is crashed. void CrashTab(content::WebContents* tab); @@ -213,10 +212,6 @@ int FindInPage(TabContents* tab, // no InfoBar open when the test starts may need to use this. void CloseAllInfoBars(TabContents* tab); -#if defined OS_MACOSX -void SetWindowBounds(gfx::NativeWindow window, const gfx::Rect& bounds); -#endif - // Returns true if the View is focused. bool IsViewFocused(const Browser* browser, ViewID vid); @@ -238,10 +233,6 @@ void WaitForTemplateURLServiceToLoad(TemplateURLService* service); // Blocks until the |history_service|'s history finishes loading. void WaitForHistoryToLoad(HistoryService* history_service); -// Puts the native window for |browser| in |native_window|. Returns true on -// success. -bool GetNativeWindow(const Browser* browser, gfx::NativeWindow* native_window); - // Brings the native window for |browser| to the foreground. Returns true on // success. bool BringBrowserWindowToFront(const Browser* browser) WARN_UNUSED_RESULT; diff --git a/chrome/test/base/ui_test_utils_mac.mm b/chrome/test/base/ui_test_utils_mac.mm index a4dac9f..816a151 100644 --- a/chrome/test/base/ui_test_utils_mac.mm +++ b/chrome/test/base/ui_test_utils_mac.mm @@ -17,17 +17,6 @@ namespace ui_test_utils { -void SetWindowBounds(gfx::NativeWindow window, const gfx::Rect& bounds) { - NSRect new_bounds = NSRectFromCGRect(bounds.ToCGRect()); - if ([[NSScreen screens] count] > 0) { - new_bounds.origin.y = - [[[NSScreen screens] objectAtIndex:0] frame].size.height - - new_bounds.origin.y - new_bounds.size.height; - } - - [window setFrame:new_bounds display:NO]; -} - bool IsViewFocused(const Browser* browser, ViewID vid) { NSWindow* window = browser->window()->GetNativeWindow(); DCHECK(window); diff --git a/chrome/test/data/npapi/alert_in_window_message.html b/chrome/test/data/npapi/alert_in_window_message.html deleted file mode 100644 index 5e343859..0000000 --- a/chrome/test/data/npapi/alert_in_window_message.html +++ /dev/null @@ -1,37 +0,0 @@ -<html> - -<head> -<script src="npapi.js"></script> -</head> - -<body> -<div id="statusPanel" style="border: 1px solid red; width: 100%"> -Test running.... -</div> - - -Alert in Window message<p> - -Tests that there's no deadlock when a plugin creates an alert in response to a synchronous Windows message from the browser process. - -<DIV ID="PluginDiv"> -<embed type="application/vnd.npapi-test" - src="foo" - name="alert_in_window_message" - id="1" - mode="np_embed" -> -</DIV> - -<DIV id="PluginDiv2"></DIV> - -<script> - -function CallAlert() { - alert('testalert'); - return; -} -</script> - -</body> -</html> diff --git a/chrome/test/data/npapi/arguments.html b/chrome/test/data/npapi/arguments.html deleted file mode 100644 index 835473c..0000000 --- a/chrome/test/data/npapi/arguments.html +++ /dev/null @@ -1,40 +0,0 @@ -<html> - -<head> -<script src="npapi.js"></script> -</head> - - -<body> -<div id="statusPanel" style="border: 1px solid red; width: 100%"> -Test running.... -</div> - - -NPAPI Loading and Argument Tests<p> -Tests our ability to pass arguments to the plugin via the embed -tag.<P> - -<embed type="application/vnd.npapi-test" - src="foo" - name="arguments" - id="1" - mode="np_embed" - count="12" - size="10" - val1="0123456789" - val2="01234567890123456789" - val3="012345678901234567890123456789" - val4="0123456789012345678901234567890123456789" - val5="01234567890123456789012345678901234567890123456789" - val6="012345678901234567890123456789012345678901234567890123456789" - val7="0123456789012345678901234567890123456789012345678901234567890123456789" - val8="01234567890123456789012345678901234567890123456789012345678901234567890123456789" - val9="012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789" - val10="0123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789" - val11="01234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789" - val12="012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789" -> - -</body> -</html> diff --git a/chrome/test/data/npapi/convert_point.html b/chrome/test/data/npapi/convert_point.html deleted file mode 100644 index aee07c5..0000000 --- a/chrome/test/data/npapi/convert_point.html +++ /dev/null @@ -1,27 +0,0 @@ -<html> - -<head> -<script src="npapi.js"></script> -</head> - - -<body> -<div id="statusPanel" style="border: 1px solid red; width: 100%"> -Test running.... -</div> - - -NPAPI ConvertPoint test<p> -Tests that NPN_ConvertPoint works.<P> - -<div style="position:absolute; left: 50px; top: 50px"> -<embed type="application/vnd.npapi-test" - src="foo" - name="convert_point" - id="1" - mode="np_embed" -> -</div> - -</body> -</html> diff --git a/chrome/test/data/npapi/create_instance_in_paint.html b/chrome/test/data/npapi/create_instance_in_paint.html deleted file mode 100644 index 80e8935..0000000 --- a/chrome/test/data/npapi/create_instance_in_paint.html +++ /dev/null @@ -1,44 +0,0 @@ -<html> - -<head> -<script src="npapi.js"></script> -</head> - -<body> -<div id="statusPanel" style="border: 1px solid red; width: 100%"> -Test running.... -</div> - - -Plugin Instance In Paint Test<p> - -Tests that there's no deadlock when a plugin instance is created while handling a paint message. - -<DIV ID="PluginDiv"> -<embed type="application/vnd.npapi-test" - src="foo" - name="create_instance_in_paint" - id="1" - mode="np_embed" -> -</DIV> - -<DIV id="PluginDiv2"></DIV> - -<script> -var height = document.body.offsetHeight; - - -function CreateNewInstance() { - var obj = document.createElement('embed');
- obj.setAttribute('type', 'application/vnd.npapi-test');
- obj.setAttribute('src', 'bar');
- obj.setAttribute('name', 'create_instance_in_paint');
- obj.setAttribute('id', '2'); - obj.setAttribute('mode', 'np_embed'); - document.getElementById("PluginDiv2").appendChild(obj); -} -</script> - -</body> -</html> diff --git a/chrome/test/data/npapi/ensure_scripting_works_in_destroy.html b/chrome/test/data/npapi/ensure_scripting_works_in_destroy.html deleted file mode 100644 index 80b9f65..0000000 --- a/chrome/test/data/npapi/ensure_scripting_works_in_destroy.html +++ /dev/null @@ -1,21 +0,0 @@ -<html> -<head> -<script src="npapi.js"></script> -<script> -function onloadfunction() { - document.getElementById("theiframe").src = "about:blank"; -} -</script> -</head> - -<body onload="setTimeout(onloadfunction(), 0)"> -<div id="statusPanel" style="border: 1px solid red; width: 100%"> -Test running.... -</div> - -Tests that scripting works during NPP_Destroy. - -<iframe src="ensure_scripting_works_in_destroy_iframe.html" id="theiframe"> -</iframe> -</body> -</html> diff --git a/chrome/test/data/npapi/ensure_scripting_works_in_destroy_iframe.html b/chrome/test/data/npapi/ensure_scripting_works_in_destroy_iframe.html deleted file mode 100644 index 0bb491d..0000000 --- a/chrome/test/data/npapi/ensure_scripting_works_in_destroy_iframe.html +++ /dev/null @@ -1,33 +0,0 @@ -<html> -<head> -<script src="npapi.js"></script> -<script> -function GetMagicNumber() { - return 42; -} - -function onSuccess(name, id) { - parent.onSuccess(name, id); -} - -function onFailure(name, id, status) { - parent.onFailure(name, id, status); -} -</script> -</head> - -<body> -<div id=PluginDiv> -<embed type="application/vnd.npapi-test" - src="foo" - name="ensure_scripting_works_in_destroy" - id="1" - mode="np_embed" -> -</DIV> -<script> - var height = document.body.offsetHeight; -</script> - -</body> -</html> diff --git a/chrome/test/data/npapi/execute_script_delete_in_mouse_up.html b/chrome/test/data/npapi/execute_script_delete_in_mouse_up.html deleted file mode 100644 index f23c088..0000000 --- a/chrome/test/data/npapi/execute_script_delete_in_mouse_up.html +++ /dev/null @@ -1,41 +0,0 @@ -<html> - -<head> -<script src="npapi.js"></script> - -<script> -function DeletePluginWithinScript() { - var plugin_div = document.getElementById("PluginDiv"); - plugin_div.innerHTML = "Object Deleted"; - onSuccess("execute_script_delete_in_mouse_up", 1); -} -</script> -</head> - -<body> -<div id="statusPanel" style="border: 1px solid red; width: 100%"> -Test running.... -</div> - - -NPObject Proxy Test<p> - -Tests the case where a plugin instance is deleted in the context -of a synchronous mouse event. - -<DIV ID=PluginDiv> -<embed type="application/vnd.npapi-test" - src="foo" - name="execute_script_delete_in_mouse_up" - id="1" - mode="np_embed" - width="100%" - height="100%" -> -</DIV> -<script> - var height = document.body.offsetHeight; -</script> - -</body> -</html> diff --git a/chrome/test/data/npapi/execute_script_delete_in_npn_evaluate.html b/chrome/test/data/npapi/execute_script_delete_in_npn_evaluate.html deleted file mode 100644 index f2e2bbe..0000000 --- a/chrome/test/data/npapi/execute_script_delete_in_npn_evaluate.html +++ /dev/null @@ -1,39 +0,0 @@ -<html> - -<head> -<script src="npapi.js"></script> - -<script> -function DeletePluginWithinScript() { - var plugin_div = document.getElementById("PluginDiv"); - plugin_div.innerHTML = "Object Deleted"; - onSuccess("npobject_delete_plugin_in_evaluate", 1); -} -</script> -</head> - -<body> -<div id="statusPanel" style="border: 1px solid red; width: 100%"> -Test running.... -</div> - - -NPObject Proxy Test<p> - -Tests the case where a plugin instance is deleted in the context -of NPN_Evaluate - -<DIV ID=PluginDiv> -<embed type="application/vnd.npapi-test" - src="foo" - name="npobject_delete_plugin_in_evaluate" - id="1" - mode="np_embed" -> -</DIV> -<script> - var height = document.body.offsetHeight; -</script> - -</body> -</html> diff --git a/chrome/test/data/npapi/execute_script_delete_in_paint.html b/chrome/test/data/npapi/execute_script_delete_in_paint.html deleted file mode 100644 index fa9ff21..0000000 --- a/chrome/test/data/npapi/execute_script_delete_in_paint.html +++ /dev/null @@ -1,39 +0,0 @@ -<html> - -<head> -<script src="npapi.js"></script> - -<script> -function DeletePluginWithinScript() { - var plugin_div = document.getElementById("PluginDiv"); - plugin_div.innerHTML = "Object Deleted"; - onSuccess("execute_script_delete_in_paint", 1); -} -</script> -</head> - -<body> -<div id="statusPanel" style="border: 1px solid red; width: 100%"> -Test running.... -</div> - - -NPObject Proxy Test<p> - -Tests the case where a plugin instance is deleted in the context -of a synchronous paint. - -<DIV ID=PluginDiv> -<embed type="application/vnd.npapi-test" - src="foo" - name="execute_script_delete_in_paint" - id="1" - mode="np_embed" -> -</DIV> -<script> - var height = document.body.offsetHeight; -</script> - -</body> -</html> diff --git a/chrome/test/data/npapi/get_javascript_open_popup_with_plugin.html b/chrome/test/data/npapi/get_javascript_open_popup_with_plugin.html deleted file mode 100644 index 8f2f01a..0000000 --- a/chrome/test/data/npapi/get_javascript_open_popup_with_plugin.html +++ /dev/null @@ -1,27 +0,0 @@ -<html> - -<head> -<script src="npapi.js"></script> -</head> - - -<body> -<div id="statusPanel" style="border: 1px solid red; width: 100%"> -Test running.... -</div> - - -Open Popup window with plugin Test<p> -This test instantiates a plugin which executes the window.open call to open a popup <br /> -window with a windowed plugin instance. The test verifies that the plugin instance in <br /> -the popup window always has a valid parent window. <br /> - -<embed type="application/vnd.npapi-test" - src="foo" - name="plugin_javascript_open_popup_with_plugin" - id="1" - mode="np_embed" -> - -</body> -</html> diff --git a/chrome/test/data/npapi/get_javascript_url.html b/chrome/test/data/npapi/get_javascript_url.html deleted file mode 100644 index 404613b..0000000 --- a/chrome/test/data/npapi/get_javascript_url.html +++ /dev/null @@ -1,26 +0,0 @@ -<html> - -<head> -<script src="npapi.js"></script> -</head> - - -<body> -<div id="statusPanel" style="border: 1px solid red; width: 100%"> -Test running.... -</div> - - -GetJavscriptURL Test<p> -This test fetches a javascript URL via the plugin with _top as the -target frame, and verifies that the call succeeds. - -<embed type="application/vnd.npapi-test" - src="foo" - name="getjavascripturl" - id="1" - mode="np_embed" -> - -</body> -</html> diff --git a/chrome/test/data/npapi/get_javascript_url2.html b/chrome/test/data/npapi/get_javascript_url2.html deleted file mode 100644 index 0fd4470f..0000000 --- a/chrome/test/data/npapi/get_javascript_url2.html +++ /dev/null @@ -1,5 +0,0 @@ -<html> -<body> -<iframe style="width: 80%; height: 40%" src="get_javascript_url2_frame.html"></iframe> -</body> -</html> diff --git a/chrome/test/data/npapi/get_javascript_url2_frame.html b/chrome/test/data/npapi/get_javascript_url2_frame.html deleted file mode 100644 index dacf9c3..0000000 --- a/chrome/test/data/npapi/get_javascript_url2_frame.html +++ /dev/null @@ -1,26 +0,0 @@ -<html> -<head> -<script> -function onSuccess(name, id) { - parent.document.title = "OK"; -} -</script> -</head> -<body> -<div id="statusPanel" style="border: 1px solid red; width: 100%"> -Test running.... -</div> - -GetJavscriptURL2 Test<p> -This test fetches a javascript URL via the plugin with _self as the -target frame, and verifies that the call succeeds. The plugin runs -within a subframe. - -<embed type="application/vnd.npapi-test" - src="foo" - name="getjavascripturl2" - id="1" - mode="np_embed" -> -</body> -</html> diff --git a/chrome/test/data/npapi/geturl.html b/chrome/test/data/npapi/geturl.html deleted file mode 100644 index 002b63b..0000000 --- a/chrome/test/data/npapi/geturl.html +++ /dev/null @@ -1,26 +0,0 @@ -<html> - -<head> -<script src="npapi.js"></script> -</head> - - -<body> -<div id="statusPanel" style="border: 1px solid red; width: 100%"> -Test running.... -</div> - - -GetURL Test<p> -This test fetches an URL via the plugin, and verifies that the -callbacks are expected and that the retrieved content is correct. - -<embed type="application/vnd.npapi-test" - src="foo" - name="geturl" - id="1" - mode="np_embed" -> - -</body> -</html> diff --git a/chrome/test/data/npapi/geturl_redirect_notify.html b/chrome/test/data/npapi/geturl_redirect_notify.html deleted file mode 100644 index 568834d..0000000 --- a/chrome/test/data/npapi/geturl_redirect_notify.html +++ /dev/null @@ -1,26 +0,0 @@ -<html> - -<head> -<script src="npapi.js"></script> -</head> - - -<body> -<div id="statusPanel" style="border: 1px solid red; width: 100%"> -Test running.... -</div> - - -GetURL Test<p> -This test fetches a URL via the plugin and validates that the plugin does -receive notification about the redirect which is then denied. - -<embed type="application/vnd.npapi-test" - src="foo" - name="geturlredirectnotify" - id="1" - mode="np_embed" -> - -</body> -</html> diff --git a/chrome/test/data/npapi/layout_test_plugin.html b/chrome/test/data/npapi/layout_test_plugin.html deleted file mode 100644 index 7ee5492de..0000000 --- a/chrome/test/data/npapi/layout_test_plugin.html +++ /dev/null @@ -1,17 +0,0 @@ -<html> -<head> -<title>OK</title> -</head> -<body> -<embed name="plg" type="application/x-webkit-test-netscape"></embed> -<script> -// Test for bug 711411: http://b/issue?id=711411 -// There was a crash because of the plugin dll being unloaded before the JS -// interpreter got a chance to drop references. -window.plg.eventLoggingEnabled = true; -</script> - -<!-- Make sure unknown plugin types don't crash either --> -<embed name="no-plg" type="application/not-installed"></embed> -</body> -</html> diff --git a/chrome/test/data/npapi/many_plugins.html b/chrome/test/data/npapi/many_plugins.html deleted file mode 100644 index 4a3b74a..0000000 --- a/chrome/test/data/npapi/many_plugins.html +++ /dev/null @@ -1,101 +0,0 @@ -<html> - -<head> -<script> -count = 0; -function onSuccess(name, id) { - count++; - if (count == 15) - document.title = "OK"; -} -</script> -</head> - - -<body> -<div id="statusPanel" style="border: 1px solid red; width: 100%"> -Test running.... -</div> - - -Loading many plugins<p> -Tests our ability to load multiple plugins in a single page.<P> - -<embed type="application/vnd.npapi-test" - name="arguments" - mode="np_embed" - id="1" -> -<embed type="application/vnd.npapi-test" - name="arguments" - mode="np_embed" - id="2" -> -<embed type="application/vnd.npapi-test" - name="arguments" - mode="np_embed" - id="3" -> -<embed type="application/vnd.npapi-test" - name="arguments" - mode="np_embed" - id="4" -> -<embed type="application/vnd.npapi-test" - name="arguments" - mode="np_embed" - id="5" -> -<embed type="application/vnd.npapi-test" - name="arguments" - mode="np_embed" - id="6" -> -<embed type="application/vnd.npapi-test" - name="arguments" - mode="np_embed" - id="7" -> -<embed type="application/vnd.npapi-test" - name="arguments" - mode="np_embed" - id="8" -> -<embed type="application/vnd.npapi-test" - name="arguments" - mode="np_embed" - id="9" -> -<embed type="application/vnd.npapi-test" - name="arguments" - mode="np_embed" - id="10" -> -<embed type="application/vnd.npapi-test" - name="arguments" - mode="np_embed" - id="11" -> -<embed type="application/vnd.npapi-test" - name="arguments" - mode="np_embed" - id="12" -> -<embed type="application/vnd.npapi-test" - name="arguments" - mode="np_embed" - id="13" -> -<embed type="application/vnd.npapi-test" - name="arguments" - mode="np_embed" - id="14" -> -<embed type="application/vnd.npapi-test" - name="arguments" - mode="np_embed" - id="15" -> - -</body> -</html> diff --git a/chrome/test/data/npapi/multiple_instances_sync_calls.html b/chrome/test/data/npapi/multiple_instances_sync_calls.html deleted file mode 100644 index 5658a12..0000000 --- a/chrome/test/data/npapi/multiple_instances_sync_calls.html +++ /dev/null @@ -1,38 +0,0 @@ -<html> - <head> - <script src="npapi.js"></script> - <script> - function TestCallback() { - onSuccess("multiple_instances_sync_calls", 1); - } - </script> - </head> - <body> - <div id="statusPanel" style="border: 1px solid red; width: 100%"> - Test running.... - </div> - - NPObject Proxy Test<p> - - Tests the case that involves two plugin instances with second
- instance making sync calls to the renderer while the first one - is still servicing an incoming sync request - - <DIV ID="plugin"> - <embed type="application/vnd.npapi-test" - src="foo" - name="multiple_instances_sync_calls" - id="1" - width="100" - height="100" - mode="np_embed"></embed> - <embed type="application/vnd.npapi-test" - src="foo" - name="multiple_instances_sync_calls" - id="2" - width="100" - height="100" - mode="np_embed"></embed> - </DIV> - </body> -</html> diff --git a/chrome/test/data/npapi/new_fails.html b/chrome/test/data/npapi/new_fails.html deleted file mode 100644 index a4b7de9..0000000 --- a/chrome/test/data/npapi/new_fails.html +++ /dev/null @@ -1,30 +0,0 @@ -<html> - -<head> -<script src="npapi.js"></script> -</head> - - -<body> -<div id="statusPanel" style="border: 1px solid red; width: 100%"> -Test running.... -</div> - - -NPP_NEW test<p> -This test ensures we don't crash or assert if NPP_New fails. - -<embed type="application/vnd.npapi-test" - src="foo" - name="new_fails" - id="1" - mode="np_embed" -> - -<script> - var height = document.body.offsetHeight; - onSuccess("new_fails", 1); -</script> - -</body> -</html> diff --git a/chrome/test/data/npapi/no_hang_if_init_crashes.html b/chrome/test/data/npapi/no_hang_if_init_crashes.html deleted file mode 100644 index 00e76a9..0000000 --- a/chrome/test/data/npapi/no_hang_if_init_crashes.html +++ /dev/null @@ -1,28 +0,0 @@ -<html> - -<head> -<script src="npapi.js"></script> -</head> - - -<body> -<div id="statusPanel" style="border: 1px solid red; width: 100%"> -Test running.... -</div> - - -No Hang If Init Crashes<p> - -Tests that if a plugin crashes during NP_Initialize the renderer doesn't hang. - -<embed type="application/vnd.npapi-test" - src="foo" - name="no_hang_if_init_crashes" - id="1" - mode="np_embed" -> -<script> -setTimeout('onSuccess("no_hang_if_init_crashes", 1);', 0); -</script> -</body> -</html> diff --git a/chrome/test/data/npapi/npapi.js b/chrome/test/data/npapi/npapi.js deleted file mode 100644 index 6c3ef8d..0000000 --- a/chrome/test/data/npapi/npapi.js +++ /dev/null @@ -1,30 +0,0 @@ -// -// This script provides some mechanics for testing NPAPI -// - -/* public */ function onSuccess(name, id) -{ - setTimeout(onFinished, 0, name, id, "OK"); -} - -/* public */ function onFailure(name, id, status) -{ - setTimeout(onFinished, 0, name, id, status); -} - - - -// Finish running a test by setting the status -// and the cookie. -/* private */ function onFinished(name, id, result) -{ - var statusPanel = document.getElementById("statusPanel"); - if (statusPanel) { - statusPanel.innerHTML = result; - } - - if (result == "OK") - document.title = "OK"; - else - document.title = "FAIL"; -} diff --git a/chrome/test/data/npapi/npn_plugin_delete_create_in_evaluate.html b/chrome/test/data/npapi/npn_plugin_delete_create_in_evaluate.html deleted file mode 100644 index 12f0e4d..0000000 --- a/chrome/test/data/npapi/npn_plugin_delete_create_in_evaluate.html +++ /dev/null @@ -1,40 +0,0 @@ -<html> -<head> -<script src="npapi.js"></script> -<script> -
- function DeletePluginWithinScript() { - var plugin_div = document.getElementById("PluginDiv");
- var html = plugin_div.innerHTML;
- html = html.replace("npobject_delete_create_plugin_in_evaluate",
- "invoke_js_function_on_create");
- plugin_div.innerHTML = "Object Deleted";
- plugin_div.innerHTML = html;
- } - - function PluginCreated() { - onSuccess("npobject_delete_create_plugin_in_evaluate", 1); - } - -</script> -</head> - -<body> -<div id="statusPanel" style="border: 1px solid red; width: 100%"> -Test running.... -</div> - -Tests the case where a plugin instance is deleted and created in the context -of the NPN_Evaluate call. - -<DIV ID=PluginDiv> -<embed type="application/vnd.npapi-test" - src="foo" - name="npobject_delete_create_plugin_in_evaluate" - id="1" - mode="np_embed" -> -</DIV> - -</body> -</html> diff --git a/chrome/test/data/npapi/npobject_identity.html b/chrome/test/data/npapi/npobject_identity.html deleted file mode 100644 index ac5e43d..0000000 --- a/chrome/test/data/npapi/npobject_identity.html +++ /dev/null @@ -1,31 +0,0 @@ -<html> - -<head> -<script src="npapi.js"></script> -<script> - function areTheseTheSame(a, b) { - return a === b; - } -</script> -</head> - - -<body> -<div id="statusPanel" style="border: 1px solid red; width: 100%"> -Test running.... -</div> - - -NPObject Identity Test<p> - -Tests that identity is preserved for NPObjects passed from a plugin into JavaScript. - -<embed type="application/vnd.npapi-test" - src="foo" - name="npobject_identity" - id="1" - mode="np_embed" -> - -</body> -</html> diff --git a/chrome/test/data/npapi/npobject_lifetime_test.html b/chrome/test/data/npapi/npobject_lifetime_test.html deleted file mode 100644 index 634fad8..0000000 --- a/chrome/test/data/npapi/npobject_lifetime_test.html +++ /dev/null @@ -1,58 +0,0 @@ -<html> - -<head> -<script src="npapi.js"></script> -</head> - - -<body> -<div id="statusPanel" style="border: 1px solid red; width: 100%"> -Test running.... -</div> - - -NPObject Lifetime test<p> - -Tests the case where a plugin holds on to an NPObject reference -to another plugin in a different frame in the page and whether -the npobject is callable when the frame is destroyed. - -<div ID=npobject_lifetime_test_instance2> -<iframe src="npobject_lifetime_test_second_instance.html" name="plugin_frame"> -</iframe> -</div> - -<embed type="application/vnd.npapi-test" - src="foo" - name="npobject_lifetime_test" - id="1" - mode="np_embed"> - -<script> - -function GetSecondPluginInstance() { - var plugin_frame = window.frames["plugin_frame"]; - if (!plugin_frame) { - alert("failed to find frame in frames list"); - return; - } - - var plugin = plugin_frame.document.getElementById(2); - if (!plugin) { - alert("Failed to locate second plugin"); - return; - } - return plugin; -} - -function DeleteSecondPluginInstance() { - var frame_div = document.getElementById("npobject_lifetime_test_instance2"); - if (frame_div.parentNode && frame_div.parentNode.removeChild) { - frame_div.parentNode.removeChild(frame_div); - } -} -</script> - -</body> -</html> - diff --git a/chrome/test/data/npapi/npobject_lifetime_test_second_instance.html b/chrome/test/data/npapi/npobject_lifetime_test_second_instance.html deleted file mode 100644 index 5876f8e..0000000 --- a/chrome/test/data/npapi/npobject_lifetime_test_second_instance.html +++ /dev/null @@ -1,20 +0,0 @@ -<html> - -<body> -<div id="statusPanel" style="border: 1px solid red; width: 100%"> -Second instance. -</div> - -NPObject Lifetime test second plugin instance<p> - -Tests the case where a plugin holds on to an NPObject reference -to another plugin in a different frame in the page and whether -the npobject is callable when the frame is destroyed. - -<embed type="application/vnd.npapi-test" - name="npobject_lifetime_test_second_instance" - id="2" - mode="np_embed"> </embed> - -</body> -</html> diff --git a/chrome/test/data/npapi/npobject_proxy.html b/chrome/test/data/npapi/npobject_proxy.html deleted file mode 100644 index ef85ee7..0000000 --- a/chrome/test/data/npapi/npobject_proxy.html +++ /dev/null @@ -1,28 +0,0 @@ -<html> - -<head> -<script src="npapi.js"></script> -</head> - - -<body> -<div id="statusPanel" style="border: 1px solid red; width: 100%"> -Test running.... -</div> - - -NPObject Proxy Test<p> - -Tests that if an NPObject is proxies back to its original process, the -original pointer is returned and not a proxy. If this fails the plugin -will crash. - -<embed type="application/vnd.npapi-test" - src="foo" - name="npobject_proxy" - id="1" - mode="np_embed" -> - -</body> -</html> diff --git a/chrome/test/data/npapi/npobject_released_on_destruction.html b/chrome/test/data/npapi/npobject_released_on_destruction.html deleted file mode 100644 index b98779f..0000000 --- a/chrome/test/data/npapi/npobject_released_on_destruction.html +++ /dev/null @@ -1,49 +0,0 @@ -<html> - -<head> -<script src="npapi.js"></script> -<script> - -function returnedMethod() { -} - -function dummyMethod() { - return returnedMethod; -} - -var test_object; -function Init() { - var plg = window.document["plg"]; - // Create the NPObjectStub in the plugin process first. This object's - // deallocate function will release the NPObject below. - - // Then create an NPObjectProxy in the plugin process that holds on to the - // dummyMethod function above. - plg.remember(dummyMethod); -} -</script> -</head> - - -<body> -<div id="statusPanel" style="border: 1px solid red; width: 100%"> -Test running.... -</div> - - -NPObject released on destruction<p> - -Tests that if a plugin creates an NPObject and releases it on destruction, -there's no crash when the plugin goes away. - - -<DIV ID=PluginDiv> -<embed name="plg" type="application/x-webkit-test-netscape"></embed> -</DIV> -<script> - Init(); -</script> - -</body> -</html> - diff --git a/chrome/test/data/npapi/npobject_set_exception.html b/chrome/test/data/npapi/npobject_set_exception.html deleted file mode 100644 index 1eeacbf..0000000 --- a/chrome/test/data/npapi/npobject_set_exception.html +++ /dev/null @@ -1,24 +0,0 @@ -<html> -<head> -<title>Set Exception Test</title> -<script src="npapi.js"></script> -</head> - -<body> - -<h2>Test that if NPN_SetException is called by an out of process plugin, the - exception is sent to the proper renderer.</h2> - -<div id="PluginDiv"> -<embed name="plg" type="application/x-webkit-test-netscape"></embed> -</div> -<script> - var plg = window.document["plg"]; - try { - plg.testThrowException(); - } catch (e) { - onSuccess("npobject_set_exception", 1); - } -</script> -</body> -</html> diff --git a/chrome/test/data/npapi/plugin_delete_in_deallocate.html b/chrome/test/data/npapi/plugin_delete_in_deallocate.html deleted file mode 100644 index 4904469..0000000 --- a/chrome/test/data/npapi/plugin_delete_in_deallocate.html +++ /dev/null @@ -1,55 +0,0 @@ -<html> -<head> -<script src="npapi.js"></script> -<script> -function setTestObject(object) { - window.testObject = object; - setTimeout("deleteTestObject()", 0); - var statusPanel = document.getElementById("statusPanel"); - statusPanel.innerText = "Received test object..."; -} - -function deleteTestObject() { - window.testObject = null; - var statusPanel = document.getElementById("statusPanel"); - statusPanel.innerText = "Deleted test object..."; - gc(); -} - -function deletePlugin() { - var statusPanel = document.getElementById("statusPanel"); - statusPanel.innerText = "Deleting plugin..."; - var plugin = document.getElementById("delete_plugin_in_deallocate_test"); - if (plugin.parentNode && plugin.parentNode.removeChild) { - plugin.parentNode.removeChild(plugin); - } -} -</script> -</head> - -<body> -<div id="statusPanel" style="border: 1px solid red; width: 100%"> -Test running.... -</div> - -NPObject Delete in Deallocate<p> - -Tests the case where deallocation of an NPObject belonging to the plugin -triggers scripting which causes the whole plugin to be torn down, and verifies -that the object being deallocated is not deallocated a second time. - - -<embed type="application/vnd.npapi-test" - src="foo" - name="delete_plugin_in_deallocate_test" - id="signaller" - mode="np_embed"> - -<embed type="application/vnd.npapi-test" - src="foo" - name="delete_plugin_in_deallocate_test" - id="delete_plugin_in_deallocate_test" - mode="np_embed"> - -</body> -</html> diff --git a/chrome/test/data/npapi/plugin_read_page.html b/chrome/test/data/npapi/plugin_read_page.html deleted file mode 100644 index 17bcef8..0000000 --- a/chrome/test/data/npapi/plugin_read_page.html +++ /dev/null @@ -1,4 +0,0 @@ -<html> -<head><title>Test page read by plugin</title></head> -<body>This page has a title.</body> -</html> diff --git a/chrome/test/data/npapi/plugin_read_page_redirect_src.html b/chrome/test/data/npapi/plugin_read_page_redirect_src.html deleted file mode 100644 index d359a54..0000000 --- a/chrome/test/data/npapi/plugin_read_page_redirect_src.html +++ /dev/null @@ -1,4 +0,0 @@ -<html> -<head><title>Test redirect page</title></head> -<body>Redirect page. This page redirects to another page.</body> -</html> diff --git a/chrome/test/data/npapi/plugin_read_page_redirect_src.html.mock-http-headers b/chrome/test/data/npapi/plugin_read_page_redirect_src.html.mock-http-headers deleted file mode 100644 index 0818be1..0000000 --- a/chrome/test/data/npapi/plugin_read_page_redirect_src.html.mock-http-headers +++ /dev/null @@ -1,3 +0,0 @@ -HTTP/1.1 301 Moved Permanently -Location: http://mock.http/npapi/plugin_read_page.html -Content-type: text/html diff --git a/chrome/test/data/npapi/plugin_ref_target_page.html b/chrome/test/data/npapi/plugin_ref_target_page.html deleted file mode 100644 index b4a6e9f..0000000 --- a/chrome/test/data/npapi/plugin_ref_target_page.html +++ /dev/null @@ -1,19 +0,0 @@ -<html> -<head><title>Target page for validating referrers in URL requests issued by <br /> -plugins -</title> - -<script> -function onLoad() { - if (document.referrer == "http://mock.http/dummy_plugin_referrer") { - window.opener.document.title = "OK"; - } else { - onFailure("plugin_referrer_test", 1, "Unexpected referrer value"); - window.opener.document.title = "FAIL"; - } -} -</script> -</head> - -<body onload="onLoad()">Plugin referrer test page.</body> -</html> diff --git a/chrome/test/data/npapi/plugin_ref_target_page.html.mock-http-headers b/chrome/test/data/npapi/plugin_ref_target_page.html.mock-http-headers deleted file mode 100644 index 57fae25..0000000 --- a/chrome/test/data/npapi/plugin_ref_target_page.html.mock-http-headers +++ /dev/null @@ -1,2 +0,0 @@ -HTTP/1.0 200 OK -Content-type: text/html diff --git a/chrome/test/data/npapi/plugin_thread_async_call.html b/chrome/test/data/npapi/plugin_thread_async_call.html deleted file mode 100644 index 156c844..0000000 --- a/chrome/test/data/npapi/plugin_thread_async_call.html +++ /dev/null @@ -1,42 +0,0 @@ -<html> - -<head> -<script src="npapi.js"></script> -<script> - function deleteShortLivedInstance() { - var shortLivedDiv = document.getElementById("short_lived_div"); - shortLivedDiv.innerHTML = "Instance deleted"; - } -</script> -</head> - - -<body> -<div id="statusPanel" style="border: 1px solid red; width: 100%"> -Test running.... -</div> - - -NPAPI NPN_PluginThreadAsyncCall test<p> -Tests that a plugin can schedule async callbacks.<P> - -<embed type="application/vnd.npapi-test" - src="foo" - name="plugin_thread_async_call" - id="1" - short_lived="false" - mode="np_embed" -> - -<div id="short_lived_div"> - <embed type="application/vnd.npapi-test" - src="foo" - name="plugin_thread_async_call" - id="2" - short_lived="true" - mode="np_embed" - > -</div> - -</body> -</html> diff --git a/chrome/test/data/npapi/plugin_url_request_404.html b/chrome/test/data/npapi/plugin_url_request_404.html deleted file mode 100644 index deb200e..0000000 --- a/chrome/test/data/npapi/plugin_url_request_404.html +++ /dev/null @@ -1,26 +0,0 @@ -<html> - -<head> -<script src="npapi.js"></script> -</head> - - -<body> -<div id="statusPanel" style="border: 1px solid red; width: 100%"> -Test running.... -</div> - - -GetURL 404 Response Test<p> -This test fetches a URL which results in the server sending back a 404 -response in the header. The plugin should expect a valid response followed -by a failure. - -<embed type="application/vnd.npapi-test" - page_not_found_url="http://mock.http/page404.html" - name="geturl_404_response" - id="1" - mode="np_embed" -> -</body> -</html> diff --git a/chrome/test/data/npapi/plugin_url_request_fail_write.html b/chrome/test/data/npapi/plugin_url_request_fail_write.html deleted file mode 100644 index ee55af6..0000000 --- a/chrome/test/data/npapi/plugin_url_request_fail_write.html +++ /dev/null @@ -1,26 +0,0 @@ -<html> - -<head> -<script src="npapi.js"></script> -</head> - - -<body> -<div id="statusPanel" style="border: 1px solid red; width: 100%"> -Test running.... -</div> - - -GetURL Plugin Fails NPP_Write Test<p> -This test fetches a URL and passes data off to the plugin. The plugin returns -an error from the NPP_Write call. This test verifies that we do not crash -as a result. - -<embed type="application/vnd.npapi-test" - fail_write_url="http://mock.http/npapi/plugin_read_page.html" - name="geturl_fail_write" - id="1" - mode="np_embed" -> -</body> -</html> diff --git a/chrome/test/data/npapi/plugin_url_request_referrer_test.html b/chrome/test/data/npapi/plugin_url_request_referrer_test.html deleted file mode 100644 index e5589e6..0000000 --- a/chrome/test/data/npapi/plugin_url_request_referrer_test.html +++ /dev/null @@ -1,26 +0,0 @@ -<html> - -<head> -<script src="npapi.js"></script> -</head> - - -<body> -<div id="statusPanel" style="border: 1px solid red; width: 100%"> -Test running.... -</div> - - -Plugin URL request referrer test<p> -This test verifies that the HTTP referrer value is set correctly in HTTP<br> -requests issued by plugins. - -<embed type="application/vnd.npapi-test" - ref_target="http://mock.http/npapi/plugin_ref_target_page.html" - name="plugin_referrer_test" - id="1" - mode="np_embed" - src="http://mock.http/dummy_plugin_referrer" -> -</body> -</html> diff --git a/chrome/test/data/npapi/popup_window_with_target_plugin.html b/chrome/test/data/npapi/popup_window_with_target_plugin.html deleted file mode 100644 index a7942a8..0000000 --- a/chrome/test/data/npapi/popup_window_with_target_plugin.html +++ /dev/null @@ -1,31 +0,0 @@ -<html> - -<head> -<script> -function onSuccess(name, id) { - window.opener.document.title = "OK"; -} -</script> -</head> - - -<body> -<div id="statusPanel" style="border: 1px solid red; width: 100%"> -Test running.... -</div> - - -Open Popup window with plugin Test<p> -This test instantiates a plugin which executes the window.open call to open a popup <br /> -window with a windowed plugin instance. The test verifies that the plugin instance in <br /> -the popup window always has a valid parent window.<br /> - -<embed type="application/vnd.npapi-test" - src="foo" - name="plugin_popup_with_plugin_target" - id="1" - mode="np_embed" -> - -</body> -</html> diff --git a/chrome/test/data/npapi/private.html b/chrome/test/data/npapi/private.html deleted file mode 100644 index 46cacde..0000000 --- a/chrome/test/data/npapi/private.html +++ /dev/null @@ -1,25 +0,0 @@ -<html> - -<head> -<script src="npapi.js"></script> -</head> - - -<body> -<div id="statusPanel" style="border: 1px solid red; width: 100%"> -Test running.... -</div> - - -NPAPI Private Mode test<p> -Tests that a plugin can query the private browsing mode.<P> - -<embed type="application/vnd.npapi-test" - src="foo" - name="private" - id="1" - mode="np_embed" -> - -</body> -</html> diff --git a/chrome/test/data/npapi/schedule_timer.html b/chrome/test/data/npapi/schedule_timer.html deleted file mode 100644 index 2546bb9..0000000 --- a/chrome/test/data/npapi/schedule_timer.html +++ /dev/null @@ -1,25 +0,0 @@ -<html> - -<head> -<script src="npapi.js"></script> -</head> - - -<body> -<div id="statusPanel" style="border: 1px solid red; width: 100%"> -Test running.... -</div> - - -NPAPI NPN_ScheduleTimer test<p> -Tests that a plugin can schedule and unschedule timers.<P> - -<embed type="application/vnd.npapi-test" - src="foo" - name="schedule_timer" - id="1" - mode="np_embed" -> - -</body> -</html> diff --git a/chrome/test/data/npapi/self_delete_plugin_geturl.html b/chrome/test/data/npapi/self_delete_plugin_geturl.html deleted file mode 100644 index 2d14340..0000000 --- a/chrome/test/data/npapi/self_delete_plugin_geturl.html +++ /dev/null @@ -1,37 +0,0 @@ -<html> -<head> -<title>Self Deleting Plugin Test - GetURL</title> -<script src="npapi.js"></script> -<script> -function DeletePluginWithinScript() { - var plugin_div = document.getElementById("PluginDiv"); - plugin_div.innerHTML = "Object Deleted"; -} - -function CallGetUrl() { - var plg = window.document["plg"]; - plg.getURL("javascript:DeletePluginWithinScript()"); -} -</script> -</head> - -<body> - -<h2>Test to delete a plugin during script execution</h2> - -<p> -This test is for a corner case when a plugin executes a script -that deletes the invoking plugin itself. -</p> - -<DIV ID=PluginDiv> -<embed name="plg" type="application/x-webkit-test-netscape"></embed> -</DIV> -<script> - CallGetUrl(); - onSuccess("self_delete_plugin_geturl", 1); -</script> - -</body> -</html> - diff --git a/chrome/test/data/npapi/self_delete_plugin_invoke.html b/chrome/test/data/npapi/self_delete_plugin_invoke.html deleted file mode 100644 index 73b940f..0000000 --- a/chrome/test/data/npapi/self_delete_plugin_invoke.html +++ /dev/null @@ -1,33 +0,0 @@ -<html> -<head> -<title>Self Deleting Plugin Test - Invoke</title> -<script src="npapi.js"></script> -<script> -function DeletePluginWithinScript() { - var plugin_div = document.getElementById("PluginDiv"); - plugin_div.innerHTML = "Object Deleted"; -} -</script> -</head> - -<body> - -<h2>Test to delete a plugin during script execution</h2> - -<p> -This test is for a corner case when a plugin executes a script -that deletes the invoking plugin itself. -</p> - -<DIV ID=PluginDiv> -<embed name="plg" type="application/x-webkit-test-netscape"></embed> -</DIV> -<script> - var plg = window.document["plg"]; - plg.testCallback("DeletePluginWithinScript"); - onSuccess("self_delete_plugin_invoke", 1); -</script> - -</body> -</html> - diff --git a/chrome/test/data/npapi/self_delete_plugin_invoke_alert.html b/chrome/test/data/npapi/self_delete_plugin_invoke_alert.html deleted file mode 100644 index 4176d2c..0000000 --- a/chrome/test/data/npapi/self_delete_plugin_invoke_alert.html +++ /dev/null @@ -1,43 +0,0 @@ -<html> -<head> -<title>Self Deleting Plugin Test - Invoke</title> -<script src="npapi.js"></script> -<script> -function DeletePluginWithinScript() { - var plugin_div = document.getElementById("PluginDiv"); - plugin_div.innerHTML = "Object Deleted"; - alert('plugin deleted'); -} -function SuccessCallback() { - onSuccess("self_delete_plugin_invoke_alert", 1); -} -function TimeoutCallback() { - var plg = window.document["plg"]; - var plg2 = window.document["plg2"]; - plg.testCallback("DeletePluginWithinScript"); - plg2.testCallback("SuccessCallback"); // will fail if the plugin crashed -} -</script> -</head> - -<body> - -<h2>Test to delete a plugin during script execution</h2> - -<p> -This test is for a corner case when a plugin executes a script -that deletes the invoking plugin itself then shows a modal dialog. -See http://code.google.com/p/chromium/issues/detail?id=4270. -</p> - -<DIV ID=PluginDiv> -<embed name="plg" type="application/x-webkit-test-netscape"></embed> -</DIV> -<embed name="plg2" type="application/x-webkit-test-netscape"></embed> -<script> - setTimeout('TimeoutCallback()', 0); -</script> - -</body> -</html> - diff --git a/chrome/test/data/npapi/self_delete_plugin_stream.html b/chrome/test/data/npapi/self_delete_plugin_stream.html deleted file mode 100644 index a43c38a..0000000 --- a/chrome/test/data/npapi/self_delete_plugin_stream.html +++ /dev/null @@ -1,34 +0,0 @@ -<html> - -<head> -<script src="npapi.js"></script> - -<script> -function DeletePluginWithinScript() { - var plugin_div = document.getElementById("PluginDiv"); - plugin_div.innerHTML = "Object Deleted"; - onSuccess("self_delete_plugin_stream", 1); -} -</script> -</head> - -<body> -<div id="statusPanel" style="border: 1px solid red; width: 100%"> -Test running.... -</div> - - -<DIV ID=PluginDiv> -<embed type="application/vnd.npapi-test" - src="foo" - name="self_delete_plugin_stream" - id="1" - mode="np_embed" -> -</DIV> -<script> - var height = document.body.offsetHeight; -</script> - -</body> -</html> diff --git a/chrome/test/data/npapi/verify_plugin_window_rect.html b/chrome/test/data/npapi/verify_plugin_window_rect.html deleted file mode 100644 index 7dca47a..0000000 --- a/chrome/test/data/npapi/verify_plugin_window_rect.html +++ /dev/null @@ -1,30 +0,0 @@ -<html> - -<head> -<script src="npapi.js"></script> -</head> - -<body> -<div id="statusPanel" style="border: 1px solid red; width: 100%"> -Test running.... -</div> - - -Plugin Window Rect Test<p> - -Tests whether the plugin window has a non zero client rect. - -<DIV ID=PluginDiv> -<embed type="application/vnd.npapi-test" - src="foo" - name="checkwindowrect" - id="1" - mode="np_embed" -> -</DIV> -<script> - var height = document.body.offsetHeight; -</script> - -</body> -</html> diff --git a/content/DEPS b/content/DEPS index 90ffa21..68599e0 100644 --- a/content/DEPS +++ b/content/DEPS @@ -3,7 +3,6 @@ include_rules = [ "+crypto", - "-chrome", # Until we move most of our testing infrastructure in a way that content can # make use of it. "+chrome/test", @@ -14,6 +13,7 @@ include_rules = [ "+content/common", "+content/public/common", "+content/public/test", + "+content/shell", # for content_browsertests "+content/test", "+grit/content_resources.h", diff --git a/content/browser/plugin_browsertest.cc b/content/browser/plugin_browsertest.cc index 2584229..85d395b 100644 --- a/content/browser/plugin_browsertest.cc +++ b/content/browser/plugin_browsertest.cc @@ -3,24 +3,24 @@ // found in the LICENSE file. #include "base/command_line.h" +#include "base/file_util.h" #include "base/path_service.h" #include "base/utf_string_conversions.h" -#include "chrome/browser/ui/browser.h" -#include "chrome/browser/ui/browser_tabstrip.h" -#include "chrome/test/base/in_process_browser_test.h" -#include "chrome/test/base/ui_test_utils.h" #include "content/public/browser/browser_thread.h" #include "content/public/common/content_switches.h" #include "content/public/test/browser_test_utils.h" +#include "content/shell/shell.h" +#include "content/shell/shell_switches.h" +#include "content/test/content_browser_test.h" +#include "content/test/content_browser_test_utils.h" #include "content/test/net/url_request_mock_http_job.h" +#include "ui/gfx/rect.h" #include "webkit/plugins/plugin_switches.h" #if defined(OS_WIN) #include "base/win/registry.h" #endif -using content::BrowserThread; - namespace { void SetUrlRequestMock(const FilePath& path) { @@ -29,19 +29,23 @@ void SetUrlRequestMock(const FilePath& path) { } -class PluginTest : public InProcessBrowserTest { +namespace content { + +class PluginTest : public ContentBrowserTest { protected: PluginTest() {} virtual void SetUpCommandLine(CommandLine* command_line) { // Some NPAPI tests schedule garbage collection to force object tear-down. command_line->AppendSwitchASCII(switches::kJavaScriptFlags, "--expose_gc"); - // For OpenPopupWindowWithPlugin. - command_line->AppendSwitch(switches::kDisablePopupBlocking); -#if defined(OS_WIN) + const testing::TestInfo* const test_info = testing::UnitTest::GetInstance()->current_test_info(); - if (strcmp(test_info->name(), "MediaPlayerNew") == 0) { + if (strcmp(test_info->name(), "PrivateEnabled") == 0) { + command_line->AppendSwitch(switches::kOffTheRecord); + } +#if defined(OS_WIN) + else if (strcmp(test_info->name(), "MediaPlayerNew") == 0) { // The installer adds our process names to the registry key below. Since // the installer might not have run on this machine, add it manually. base::win::RegKey regkey; @@ -66,30 +70,20 @@ class PluginTest : public InProcessBrowserTest { // explicitly registered. command_line->AppendSwitchPath(switches::kExtraPluginDir, plugin_dir); #endif - - // TODO(jam): since these plugin tests are running under Chrome, we need to - // tell it to disable its security features for old plugins. Once this is - // running under content_browsertests, these flags won't be needed. - // http://crbug.com/90448 - // switches::kAllowOutdatedPlugins - command_line->AppendSwitch("allow-outdated-plugins"); - // switches::kAlwaysAuthorizePlugins - command_line->AppendSwitch("always-authorize-plugins"); } virtual void SetUpOnMainThread() OVERRIDE { - FilePath path = ui_test_utils::GetTestFilePath(FilePath(), FilePath()); + FilePath path = GetTestFilePath("", ""); BrowserThread::PostTask( BrowserThread::IO, FROM_HERE, base::Bind(&SetUrlRequestMock, path)); } void LoadAndWait(const GURL& url) { string16 expected_title(ASCIIToUTF16("OK")); - content::TitleWatcher title_watcher( - chrome::GetActiveWebContents(browser()), expected_title); + TitleWatcher title_watcher(shell()->web_contents(), expected_title); title_watcher.AlsoWaitForTitle(ASCIIToUTF16("FAIL")); title_watcher.AlsoWaitForTitle(ASCIIToUTF16("plugin_not_found")); - ui_test_utils::NavigateToURL(browser(), url); + NavigateToURL(shell(), url); string16 title = title_watcher.WaitAndGetTitle(); if (title == ASCIIToUTF16("plugin_not_found")) { const testing::TestInfo* const test_info = @@ -102,19 +96,16 @@ class PluginTest : public InProcessBrowserTest { } GURL GetURL(const char* filename) { - return ui_test_utils::GetTestUrl( - FilePath().AppendASCII("npapi"), FilePath().AppendASCII(filename)); + return GetTestUrl("npapi", filename); } void NavigateAway() { - GURL url = ui_test_utils::GetTestUrl( - FilePath(), FilePath().AppendASCII("simple.html")); + GURL url = GetTestUrl(".", "simple_page.html"); LoadAndWait(url); } void TestPlugin(const char* filename) { - FilePath path = ui_test_utils::GetTestFilePath( - FilePath().AppendASCII("plugin"), FilePath().AppendASCII(filename)); + FilePath path = GetTestFilePath("plugin", filename); if (!file_util::PathExists(path)) { const testing::TestInfo* const test_info = testing::UnitTest::GetInstance()->current_test_info(); @@ -123,8 +114,7 @@ class PluginTest : public InProcessBrowserTest { return; } - GURL url = ui_test_utils::GetTestUrl( - FilePath().AppendASCII("plugin"), FilePath().AppendASCII(filename)); + GURL url = GetTestUrl("plugin", filename); LoadAndWait(url); } }; @@ -151,8 +141,7 @@ IN_PROC_BROWSER_TEST_F(PluginTest, SelfDeletePluginInvoke) { } IN_PROC_BROWSER_TEST_F(PluginTest, NPObjectReleasedOnDestruction) { - ui_test_utils::NavigateToURL( - browser(), GetURL("npobject_released_on_destruction.html")); + NavigateToURL(shell(), GetURL("npobject_released_on_destruction.html")); NavigateAway(); } @@ -171,14 +160,12 @@ IN_PROC_BROWSER_TEST_F(PluginTest, NPObjectSetException) { // SimulateMouseClick get to Mac plugins, currently it doesn't work. IN_PROC_BROWSER_TEST_F(PluginTest, SelfDeletePluginInvokeInSynchronousMouseUp) { - ui_test_utils::NavigateToURL( - browser(), GetURL("execute_script_delete_in_mouse_up.html")); + NavigateToURL(shell(), GetURL("execute_script_delete_in_mouse_up.html")); string16 expected_title(ASCIIToUTF16("OK")); - content::TitleWatcher title_watcher( - chrome::GetActiveWebContents(browser()), expected_title); + TitleWatcher title_watcher(shell()->web_contents(), expected_title); title_watcher.AlsoWaitForTitle(ASCIIToUTF16("FAIL")); - SimulateMouseClick(chrome::GetActiveWebContents(browser())); + SimulateMouseClick(shell()->web_contents()); EXPECT_EQ(expected_title, title_watcher.WaitAndGetTitle()); } #endif @@ -197,16 +184,13 @@ IN_PROC_BROWSER_TEST_F(PluginTest, GetURLRequest404Response) { IN_PROC_BROWSER_TEST_F(PluginTest, SelfDeletePluginInvokeAlert) { // Navigate asynchronously because if we waitd until it completes, there's a // race condition where the alert can come up before we start watching for it. - ui_test_utils::NavigateToURLWithDisposition( - browser(), GetURL("self_delete_plugin_invoke_alert.html"), CURRENT_TAB, - 0); + shell()->LoadURL(GetURL("self_delete_plugin_invoke_alert.html")); string16 expected_title(ASCIIToUTF16("OK")); - content::TitleWatcher title_watcher( - chrome::GetActiveWebContents(browser()), expected_title); + TitleWatcher title_watcher(shell()->web_contents(), expected_title); title_watcher.AlsoWaitForTitle(ASCIIToUTF16("FAIL")); - ui_test_utils::WaitForAppModalDialogAndCloseIt(); + WaitForAppModalDialog(shell()); EXPECT_EQ(expected_title, title_watcher.WaitAndGetTitle()); } @@ -296,11 +280,10 @@ IN_PROC_BROWSER_TEST_F(PluginTest, CreateInstanceInPaint) { #define MAYBE_AlertInWindowMessage AlertInWindowMessage #endif IN_PROC_BROWSER_TEST_F(PluginTest, MAYBE_AlertInWindowMessage) { - ui_test_utils::NavigateToURL( - browser(), GetURL("alert_in_window_message.html")); + NavigateToURL(shell(), GetURL("alert_in_window_message.html")); - ui_test_utils::WaitForAppModalDialogAndCloseIt(); - ui_test_utils::WaitForAppModalDialogAndCloseIt(); + WaitForAppModalDialog(shell()); + WaitForAppModalDialog(shell()); } IN_PROC_BROWSER_TEST_F(PluginTest, VerifyNPObjectLifetimeTest) { @@ -348,7 +331,9 @@ IN_PROC_BROWSER_TEST_F(PluginTest, PluginThreadAsyncCall) { // Test checking the privacy mode is on. // If this flakes on Linux, use http://crbug.com/104380 IN_PROC_BROWSER_TEST_F(PluginTest, PrivateEnabled) { - LoadAndWait(GetURL("private.html")); + GURL url = GetURL("private.html"); + url = GURL(url.spec() + "?private"); + LoadAndWait(url); } #if defined(OS_WIN) || defined(OS_MACOSX) @@ -392,21 +377,21 @@ IN_PROC_BROWSER_TEST_F(PluginTest, PluginReferrerTest) { #if defined(OS_MACOSX) // Test is flaky, see http://crbug.com/134515. IN_PROC_BROWSER_TEST_F(PluginTest, DISABLED_PluginConvertPointTest) { - gfx::NativeWindow window = NULL; gfx::Rect bounds(50, 50, 400, 400); - ui_test_utils::GetNativeWindow(browser(), &window); - ui_test_utils::SetWindowBounds(window, bounds); + SetWindowBounds(shell()->window(), bounds); - ui_test_utils::NavigateToURL(browser(), GetURL("convert_point.html")); + NavigateToURL(shell(), GetURL("convert_point.html")); string16 expected_title(ASCIIToUTF16("OK")); - content::TitleWatcher title_watcher( - chrome::GetActiveWebContents(browser()), expected_title); + TitleWatcher title_watcher(shell()->web_contents(), expected_title); title_watcher.AlsoWaitForTitle(ASCIIToUTF16("FAIL")); // TODO(stuartmorgan): When the automation system supports sending clicks, // change the test to trigger on mouse-down rather than window focus. - static_cast<content::WebContentsDelegate*>(browser())-> - ActivateContents(chrome::GetActiveWebContents(browser())); + + // TODO: is this code still needed? It was here when it used to run in + // browser_tests. + //static_cast<WebContentsDelegate*>(shell())-> + // ActivateContents(shell()->web_contents()); EXPECT_EQ(expected_title, title_watcher.WaitAndGetTitle()); } #endif @@ -467,3 +452,5 @@ IN_PROC_BROWSER_TEST_F(PluginTest, Silverlight) { TestPlugin("silverlight.html"); } #endif // defined(OS_WIN) + +} // namespace content diff --git a/content/content_tests.gypi b/content/content_tests.gypi index 1b7627f..33be60f 100644 --- a/content/content_tests.gypi +++ b/content/content_tests.gypi @@ -547,10 +547,12 @@ 'HAS_OUT_OF_PROC_TEST_RUNNER', ], 'sources': [ + 'browser/plugin_browsertest.cc', 'test/content_browser_test.h', 'test/content_browser_test.cc', 'test/content_browser_test_utils.cc', 'test/content_browser_test_utils.h', + 'test/content_browser_test_utils_mac.mm', 'test/content_browser_test_test.cc', 'test/content_test_launcher.cc', ], @@ -597,6 +599,18 @@ 'content_shell', # Needed for Content Shell.app's Helper. ], }], + ['use_aura==1', { + 'sources!': [ + 'browser/plugin_browsertest.cc', + ], + }], + ['target_arch!="arm"', { + 'dependencies': [ + # Runtime dependencies + '../webkit/webkit.gyp:copy_npapi_test_plugin', + '../webkit/webkit.gyp:pull_in_copy_TestNetscapePlugIn', + ], + }], ], }, ], diff --git a/content/public/common/content_switches.cc b/content/public/common/content_switches.cc index 95984e0..7aa9d25 100644 --- a/content/public/common/content_switches.cc +++ b/content/public/common/content_switches.cc @@ -163,9 +163,6 @@ const char kDisablePlugins[] = "disable-plugins"; // Disable the JavaScript Pointer Lock API. const char kDisablePointerLock[] = "disable-pointer-lock"; -// Disable pop-up blocking. -const char kDisablePopupBlocking[] = "disable-popup-blocking"; - // Disables remote web font support. SVG font should always work whether this // option is specified or not. const char kDisableRemoteFonts[] = "disable-remote-fonts"; diff --git a/content/public/common/content_switches.h b/content/public/common/content_switches.h index 226dc19..cabe4d4 100644 --- a/content/public/common/content_switches.h +++ b/content/public/common/content_switches.h @@ -62,7 +62,6 @@ CONTENT_EXPORT extern const char kDisableLogging[]; CONTENT_EXPORT extern const char kDisableSmoothScrolling[]; CONTENT_EXPORT extern const char kDisablePlugins[]; extern const char kDisablePointerLock[]; -CONTENT_EXPORT extern const char kDisablePopupBlocking[]; extern const char kDisableRemoteFonts[]; extern const char kDisableRendererAccessibility[]; extern const char kDisableSSLFalseStart[]; diff --git a/content/public/test/test_utils.h b/content/public/test/test_utils.h index bf90806..8b92c31 100644 --- a/content/public/test/test_utils.h +++ b/content/public/test/test_utils.h @@ -41,8 +41,8 @@ class MessageLoopRunner : public base::RefCounted<MessageLoopRunner> { // Hand this closure off to code that uses callbacks to notify completion. // Example: // scoped_refptr<MessageLoopRunner> runner = new MessageLoopRunner; - // kick_off_some_api(runner.QuitNowClosure()); - // runner.Run(); + // kick_off_some_api(runner->QuitClosure()); + // runner->Run(); base::Closure QuitClosure(); private: diff --git a/content/shell/shell.h b/content/shell/shell.h index 53e473f..1ac10fc 100644 --- a/content/shell/shell.h +++ b/content/shell/shell.h @@ -74,6 +74,7 @@ class Shell : public WebContentsDelegate, static void PlatformExit(); WebContents* web_contents() const { return web_contents_.get(); } + gfx::NativeWindow window() { return window_; } #if defined(OS_MACOSX) // Public to be called by an ObjC bridge object. @@ -84,6 +85,28 @@ class Shell : public WebContentsDelegate, static bool Register(JNIEnv* env); #endif + // WebContentsDelegate + virtual void LoadingStateChanged(WebContents* source) OVERRIDE; +#if defined(OS_ANDROID) + virtual void LoadProgressChanged(double progress) OVERRIDE; +#endif + virtual void WebContentsCreated(WebContents* source_contents, + int64 source_frame_id, + const GURL& target_url, + WebContents* new_contents) OVERRIDE; + virtual void DidNavigateMainFramePostCommit( + WebContents* web_contents) OVERRIDE; + virtual JavaScriptDialogCreator* GetJavaScriptDialogCreator() OVERRIDE; +#if defined(OS_MACOSX) + virtual void HandleKeyboardEvent( + const NativeWebKeyboardEvent& event) OVERRIDE; +#endif + virtual bool AddMessageToConsole(WebContents* source, + int32 level, + const string16& message, + int32 line_no, + const string16& source_id) OVERRIDE; + private: enum UIControl { BACK_BUTTON, @@ -122,28 +145,6 @@ class Shell : public WebContentsDelegate, gfx::NativeView GetContentView(); - // WebContentsDelegate - virtual void LoadingStateChanged(WebContents* source) OVERRIDE; -#if defined(OS_ANDROID) - virtual void LoadProgressChanged(double progress) OVERRIDE; -#endif - virtual void WebContentsCreated(WebContents* source_contents, - int64 source_frame_id, - const GURL& target_url, - WebContents* new_contents) OVERRIDE; - virtual void DidNavigateMainFramePostCommit( - WebContents* web_contents) OVERRIDE; - virtual JavaScriptDialogCreator* GetJavaScriptDialogCreator() OVERRIDE; -#if defined(OS_MACOSX) - virtual void HandleKeyboardEvent( - const NativeWebKeyboardEvent& event) OVERRIDE; -#endif - virtual bool AddMessageToConsole(WebContents* source, - int32 level, - const string16& message, - int32 line_no, - const string16& source_id) OVERRIDE; - // NotificationObserver virtual void Observe(int type, const NotificationSource& source, diff --git a/content/shell/shell_browser_context.cc b/content/shell/shell_browser_context.cc index 05a4e37..bb39e8c 100644 --- a/content/shell/shell_browser_context.cc +++ b/content/shell/shell_browser_context.cc @@ -75,7 +75,7 @@ FilePath ShellBrowserContext::GetPath() { } bool ShellBrowserContext::IsOffTheRecord() const { - return false; + return CommandLine::ForCurrentProcess()->HasSwitch(switches::kOffTheRecord); } DownloadManagerDelegate* ShellBrowserContext::GetDownloadManagerDelegate() { diff --git a/content/shell/shell_javascript_dialog_creator.cc b/content/shell/shell_javascript_dialog_creator.cc index 045d0f1..ceb1a8b 100644 --- a/content/shell/shell_javascript_dialog_creator.cc +++ b/content/shell/shell_javascript_dialog_creator.cc @@ -44,6 +44,13 @@ void ShellJavaScriptDialogCreator::RunJavaScriptDialog( return; } + if (!dialog_request_callback_.is_null()) { + dialog_request_callback_.Run(); + callback.Run(true, string16()); + dialog_request_callback_.Reset(); + return; + } + #if defined(OS_MACOSX) || defined(OS_WIN) *did_suppress_message = false; @@ -85,6 +92,13 @@ void ShellJavaScriptDialogCreator::RunBeforeUnloadDialog( return; } + if (!dialog_request_callback_.is_null()) { + dialog_request_callback_.Run(); + callback.Run(true, string16()); + dialog_request_callback_.Reset(); + return; + } + #if defined(OS_MACOSX) || defined(OS_WIN) if (dialog_.get()) { // Seriously!? diff --git a/content/shell/shell_javascript_dialog_creator.h b/content/shell/shell_javascript_dialog_creator.h index 953a5a8..0dd67ce 100644 --- a/content/shell/shell_javascript_dialog_creator.h +++ b/content/shell/shell_javascript_dialog_creator.h @@ -6,6 +6,7 @@ #define CONTENT_SHELL_SHELL_JAVASCRIPT_DIALOG_CREATOR_H_ #include "base/compiler_specific.h" +#include "base/callback_forward.h" #include "base/memory/scoped_ptr.h" #include "content/public/browser/javascript_dialogs.h" @@ -40,6 +41,12 @@ class ShellJavaScriptDialogCreator : public JavaScriptDialogCreator { // Called by the ShellJavaScriptDialog when it closes. void DialogClosed(ShellJavaScriptDialog* dialog); + // Used for content_browsertests. + void set_dialog_request_callback( + base::Callback<void()> dialog_request_callback) { + dialog_request_callback_ = dialog_request_callback; + } + private: #if defined(OS_MACOSX) || defined(OS_WIN) // The dialog being shown. No queueing. @@ -48,6 +55,8 @@ class ShellJavaScriptDialogCreator : public JavaScriptDialogCreator { // TODO: implement ShellJavaScriptDialog for other platforms, drop this #if #endif + base::Callback<void()> dialog_request_callback_; + DISALLOW_COPY_AND_ASSIGN(ShellJavaScriptDialogCreator); }; diff --git a/content/shell/shell_switches.cc b/content/shell/shell_switches.cc index e3cffb3..0bd7175 100644 --- a/content/shell/shell_switches.cc +++ b/content/shell/shell_switches.cc @@ -15,4 +15,6 @@ const char kContentBrowserTest[] = "browser-test"; // Request pages to be dumped as text once they finished loading. const char kDumpRenderTree[] = "dump-render-tree"; +const char kOffTheRecord[] = "off-the-record"; + } // namespace switches diff --git a/content/shell/shell_switches.h b/content/shell/shell_switches.h index 342cedd..0c5810d 100644 --- a/content/shell/shell_switches.h +++ b/content/shell/shell_switches.h @@ -12,6 +12,7 @@ namespace switches { extern const char kCheckLayoutTestSysDeps[]; extern const char kContentBrowserTest[]; extern const char kDumpRenderTree[]; +extern const char kOffTheRecord[]; } // namespace switches diff --git a/content/test/browser_test_base.cc b/content/test/browser_test_base.cc index a2f1b9a..a6841e9 100644 --- a/content/test/browser_test_base.cc +++ b/content/test/browser_test_base.cc @@ -6,6 +6,7 @@ #include "base/bind.h" #include "base/command_line.h" +#include "content/public/common/content_switches.h" #include "content/public/common/main_function_params.h" #include "sandbox/win/src/dep.h" @@ -27,7 +28,12 @@ BrowserTestBase::~BrowserTestBase() { } void BrowserTestBase::SetUp() { - content::MainFunctionParams params(*CommandLine::ForCurrentProcess()); + CommandLine* command_line = CommandLine::ForCurrentProcess(); + + // The tests assume that file:// URIs can freely access other file:// URIs. + command_line->AppendSwitch(switches::kAllowFileAccessFromFiles); + + content::MainFunctionParams params(*command_line); params.ui_task = new base::Closure( base::Bind(&BrowserTestBase::ProxyRunTestOnMainThreadLoop, this)); diff --git a/content/test/browser_test_base.h b/content/test/browser_test_base.h index 7c39f1e..b9b24ae 100644 --- a/content/test/browser_test_base.h +++ b/content/test/browser_test_base.h @@ -8,6 +8,8 @@ #include "base/compiler_specific.h" #include "testing/gtest/include/gtest/gtest.h" +class CommandLine; + class BrowserTestBase : public testing::Test { public: BrowserTestBase(); @@ -25,6 +27,14 @@ class BrowserTestBase : public testing::Test { // Restores state configured in SetUp. virtual void TearDown() OVERRIDE; + // Override this to add any custom setup code that needs to be done on the + // main thread after the browser is created and just before calling + // RunTestOnMainThread(). + virtual void SetUpOnMainThread() {} + + // Override this to add command line flags specific to your test. + virtual void SetUpCommandLine(CommandLine* command_line) {} + protected: // We need these special methods because SetUp is the bottom of the stack // that winds up calling your test method, so it is not always an option diff --git a/content/test/content_browser_test.cc b/content/test/content_browser_test.cc index d3d6163..ff2bfd2 100644 --- a/content/test/content_browser_test.cc +++ b/content/test/content_browser_test.cc @@ -10,6 +10,7 @@ #include "base/logging.h" #include "base/message_loop.h" #include "base/path_service.h" +#include "content/public/browser/render_process_host.h" #include "content/public/common/content_switches.h" #include "content/shell/shell.h" #include "content/shell/shell_main_delegate.h" @@ -38,12 +39,14 @@ ContentBrowserTest::~ContentBrowserTest() { } void ContentBrowserTest::SetUp() { - shell_main_delegate_.reset(new content::ShellMainDelegate); + shell_main_delegate_.reset(new ShellMainDelegate); shell_main_delegate_->PreSandboxStartup(); CommandLine* command_line = CommandLine::ForCurrentProcess(); command_line->AppendSwitch(switches::kContentBrowserTest); + SetUpCommandLine(command_line); + #if defined(OS_MACOSX) // See InProcessBrowserTest::PrepareTestCommandLine(). FilePath subprocess_path; @@ -101,10 +104,17 @@ void ContentBrowserTest::RunTestOnMainThreadLoop() { pool.Recycle(); #endif + SetUpOnMainThread(); + RunTestOnMainThread(); #if defined(OS_MACOSX) pool.Recycle(); #endif + + for (RenderProcessHost::iterator i(RenderProcessHost::AllHostsIterator()); + !i.IsAtEnd(); i.Advance()) { + i.GetCurrentValue()->FastShutdownIfPossible(); + } } } // namespace content diff --git a/content/test/content_browser_test.h b/content/test/content_browser_test.h index 0d09774..e0acdf8 100644 --- a/content/test/content_browser_test.h +++ b/content/test/content_browser_test.h @@ -9,7 +9,6 @@ #include "content/public/test/browser_test.h" #include "content/test/browser_test_base.h" - namespace content { class Shell; class ShellMainDelegate; @@ -26,6 +25,7 @@ class ContentBrowserTest : public BrowserTestBase { // BrowserTestBase: virtual void RunTestOnMainThreadLoop() OVERRIDE; + protected: // Returns the window for the test. Shell* shell() const { return shell_; } diff --git a/content/test/content_browser_test_test.cc b/content/test/content_browser_test_test.cc index 47f6349..c176c2e 100644 --- a/content/test/content_browser_test_test.cc +++ b/content/test/content_browser_test_test.cc @@ -13,9 +13,9 @@ namespace content { IN_PROC_BROWSER_TEST_F(ContentBrowserTest, Basic) { - GURL url = GetTestUrl(("."), "simple_page.html"); + GURL url = GetTestUrl(".", "simple_page.html"); - string16 expected_title(ASCIIToUTF16("Simple Page")); + string16 expected_title(ASCIIToUTF16("OK")); TitleWatcher title_watcher(shell()->web_contents(), expected_title); NavigateToURL(shell(), url); string16 title = title_watcher.WaitAndGetTitle(); diff --git a/content/test/content_browser_test_utils.cc b/content/test/content_browser_test_utils.cc index fc55372..f46dcb5 100644 --- a/content/test/content_browser_test_utils.cc +++ b/content/test/content_browser_test_utils.cc @@ -15,6 +15,7 @@ #include "content/public/test/test_navigation_observer.h" #include "content/public/test/test_utils.h" #include "content/shell/shell.h" +#include "content/shell/shell_javascript_dialog_creator.h" #include "net/base/net_util.h" namespace content { @@ -45,4 +46,14 @@ void NavigateToURL(Shell* window, const GURL& url) { GetQuitTaskForRunLoop(&run_loop)); } +void WaitForAppModalDialog(Shell* window) { + ShellJavaScriptDialogCreator* dialog_creator = + static_cast<ShellJavaScriptDialogCreator*>( + window->GetJavaScriptDialogCreator()); + + scoped_refptr<MessageLoopRunner> runner = new MessageLoopRunner(); + dialog_creator->set_dialog_request_callback(runner->QuitClosure()); + runner->Run(); +} + } // namespace content diff --git a/content/test/content_browser_test_utils.h b/content/test/content_browser_test_utils.h index 5957d11..30912bd 100644 --- a/content/test/content_browser_test_utils.h +++ b/content/test/content_browser_test_utils.h @@ -6,9 +6,14 @@ #define CONTENT_TEST_CONTENT_BROWSER_TEST_UTILS_H_ #include "googleurl/src/gurl.h" +#include "ui/gfx/native_widget_types.h" class FilePath; +namespace gfx { +class Rect; +} + // A collections of functions designed for use with content_browsertests. // Note: if a function here also works with browser_tests, it should be in // content\public\test\browser_test_utils.h @@ -33,6 +38,13 @@ GURL GetTestUrl(const char* dir, const char* file); // navigation finishes. void NavigateToURL(Shell* window, const GURL& url); +// Wait until an application modal dialog is requested. +void WaitForAppModalDialog(Shell* window); + +#if defined OS_MACOSX +void SetWindowBounds(gfx::NativeWindow window, const gfx::Rect& bounds); +#endif + } // namespace content #endif // CONTENT_TEST_CONTENT_BROWSER_TEST_UTILS_H_ diff --git a/content/test/content_browser_test_utils_mac.mm b/content/test/content_browser_test_utils_mac.mm new file mode 100644 index 0000000..d850890 --- /dev/null +++ b/content/test/content_browser_test_utils_mac.mm @@ -0,0 +1,25 @@ +// Copyright (c) 2012 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include "content/test/content_browser_test_utils.h" + +#include <Carbon/Carbon.h> +#import <Cocoa/Cocoa.h> + +#include "ui/gfx/rect.h" + +namespace content { + +void SetWindowBounds(gfx::NativeWindow window, const gfx::Rect& bounds) { + NSRect new_bounds = NSRectFromCGRect(bounds.ToCGRect()); + if ([[NSScreen screens] count] > 0) { + new_bounds.origin.y = + [[[NSScreen screens] objectAtIndex:0] frame].size.height - + new_bounds.origin.y - new_bounds.size.height; + } + + [window setFrame:new_bounds display:NO]; +} + +} // namespace content diff --git a/content/test/data/page404.html b/content/test/data/page404.html new file mode 100644 index 0000000..e21ac55 --- /dev/null +++ b/content/test/data/page404.html @@ -0,0 +1,2 @@ +<title>SUCCESS</title> +
\ No newline at end of file diff --git a/chrome/test/data/npapi/plugin_read_page.html.mock-http-headers b/content/test/data/page404.html.mock-http-headers index 57fae25..0590363 100644 --- a/chrome/test/data/npapi/plugin_read_page.html.mock-http-headers +++ b/content/test/data/page404.html.mock-http-headers @@ -1,2 +1,2 @@ -HTTP/1.0 200 OK +HTTP/1.0 404 Not Found Content-type: text/html diff --git a/content/test/data/simple_page.html b/content/test/data/simple_page.html index 7283ba2..6170792 100644 --- a/content/test/data/simple_page.html +++ b/content/test/data/simple_page.html @@ -1,5 +1,5 @@ <html> -<head><title>Simple Page</title></head> +<head><title>OK</title></head> <body> Basic html test. </body> |