From 679480f79f2a9dcd6af15ffc30d966e5c33e3d12 Mon Sep 17 00:00:00 2001 From: "evan@chromium.org" Date: Mon, 30 Mar 2009 19:24:13 +0000 Subject: Rename some .cpp files to .cc. Review URL: http://codereview.chromium.org/57017 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@12793 0039d316-1c4b-4281-b951-d872f2087c98 --- chrome/test/ui/layout_plugin_uitest.cc | 76 +++++++++ chrome/test/ui/layout_plugin_uitest.cpp | 76 --------- chrome/test/ui/npapi_uitest.cc | 283 ++++++++++++++++++++++++++++++++ chrome/test/ui/npapi_uitest.cpp | 283 -------------------------------- chrome/test/ui/ui_tests.scons | 4 +- chrome/test/ui/ui_tests.vcproj | 4 +- 6 files changed, 363 insertions(+), 363 deletions(-) create mode 100644 chrome/test/ui/layout_plugin_uitest.cc delete mode 100644 chrome/test/ui/layout_plugin_uitest.cpp create mode 100644 chrome/test/ui/npapi_uitest.cc delete mode 100644 chrome/test/ui/npapi_uitest.cpp (limited to 'chrome/test') diff --git a/chrome/test/ui/layout_plugin_uitest.cc b/chrome/test/ui/layout_plugin_uitest.cc new file mode 100644 index 0000000..fa46e2a --- /dev/null +++ b/chrome/test/ui/layout_plugin_uitest.cc @@ -0,0 +1,76 @@ +// Copyright 2008, Google Inc. +// All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are +// met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above +// copyright notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the name of Google Inc. nor the names of its +// contributors may be used to endorse or promote products derived from +// this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +#include "chrome/test/ui/ui_test.h" + +#include "base/file_util.h" +#include "chrome/common/chrome_paths.h" +#include "chrome/test/automation/tab_proxy.h" +#include "googleurl/src/gurl.h" +#include "net/base/net_util.h" + +namespace { + +class LayoutPluginTester : public UITest { +}; + +} // namespace + +// Make sure that navigating away from a plugin referenced by JS doesn't +// crash. +TEST_F(LayoutPluginTester, UnloadNoCrash) { + // We need to copy our test-plugin into the plugins directory so that + // the browser can load it. + std::wstring plugins_directory = browser_directory_; + plugins_directory += L"\\plugins"; + std::wstring plugin_src = browser_directory_; + plugin_src += L"\\npapi_layout_test_plugin.dll"; + std::wstring plugin_dest = plugins_directory; + plugin_dest += L"\\npapi_layout_test_plugin.dll"; + + CreateDirectory(plugins_directory.c_str(), NULL); + CopyFile(plugin_src.c_str(), plugin_dest.c_str(), true /* overwrite */); + + std::wstring path; + PathService::Get(chrome::DIR_TEST_DATA, &path); + file_util::AppendToPath(&path, L"npapi/layout_test_plugin.html"); + NavigateToURL(net::FilePathToFileURL(path)); + + std::wstring title; + TabProxy* tab = GetActiveTab(); + ASSERT_TRUE(tab); + EXPECT_TRUE(tab->GetTabTitle(&title)); + EXPECT_EQ(L"Layout Test Plugin Test", title); + + ASSERT_TRUE(tab->GoBack()); + EXPECT_TRUE(tab->GetTabTitle(&title)); + EXPECT_EQ(L"", title); + + delete tab; +} diff --git a/chrome/test/ui/layout_plugin_uitest.cpp b/chrome/test/ui/layout_plugin_uitest.cpp deleted file mode 100644 index fa46e2a..0000000 --- a/chrome/test/ui/layout_plugin_uitest.cpp +++ /dev/null @@ -1,76 +0,0 @@ -// Copyright 2008, Google Inc. -// All rights reserved. -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above -// copyright notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the name of Google Inc. nor the names of its -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -#include "chrome/test/ui/ui_test.h" - -#include "base/file_util.h" -#include "chrome/common/chrome_paths.h" -#include "chrome/test/automation/tab_proxy.h" -#include "googleurl/src/gurl.h" -#include "net/base/net_util.h" - -namespace { - -class LayoutPluginTester : public UITest { -}; - -} // namespace - -// Make sure that navigating away from a plugin referenced by JS doesn't -// crash. -TEST_F(LayoutPluginTester, UnloadNoCrash) { - // We need to copy our test-plugin into the plugins directory so that - // the browser can load it. - std::wstring plugins_directory = browser_directory_; - plugins_directory += L"\\plugins"; - std::wstring plugin_src = browser_directory_; - plugin_src += L"\\npapi_layout_test_plugin.dll"; - std::wstring plugin_dest = plugins_directory; - plugin_dest += L"\\npapi_layout_test_plugin.dll"; - - CreateDirectory(plugins_directory.c_str(), NULL); - CopyFile(plugin_src.c_str(), plugin_dest.c_str(), true /* overwrite */); - - std::wstring path; - PathService::Get(chrome::DIR_TEST_DATA, &path); - file_util::AppendToPath(&path, L"npapi/layout_test_plugin.html"); - NavigateToURL(net::FilePathToFileURL(path)); - - std::wstring title; - TabProxy* tab = GetActiveTab(); - ASSERT_TRUE(tab); - EXPECT_TRUE(tab->GetTabTitle(&title)); - EXPECT_EQ(L"Layout Test Plugin Test", title); - - ASSERT_TRUE(tab->GoBack()); - EXPECT_TRUE(tab->GetTabTitle(&title)); - EXPECT_EQ(L"", title); - - delete tab; -} diff --git a/chrome/test/ui/npapi_uitest.cc b/chrome/test/ui/npapi_uitest.cc new file mode 100644 index 0000000..7826878 --- /dev/null +++ b/chrome/test/ui/npapi_uitest.cc @@ -0,0 +1,283 @@ +// Copyright 2008, Google Inc. +// All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are +// met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above +// copyright notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the name of Google Inc. nor the names of its +// contributors may be used to endorse or promote products derived from +// this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +// +// NPAPI UnitTests. +// + +// windows headers +#include +#include +#include +#include +#include + +// runtime headers +#include +#include +#include + +#include + +#include "base/file_util.h" +#include "chrome/common/chrome_paths.h" +#include "chrome/test/automation/tab_proxy.h" +#include "chrome/test/automation/window_proxy.h" +#include "chrome/test/ui/npapi_test_helper.h" +#include "net/base/net_util.h" + +const char kTestCompleteCookie[] = "status"; +const char kTestCompleteSuccess[] = "OK"; +const int kLongWaitTimeout = 30 * 1000; +const int kShortWaitTimeout = 5 * 1000; + +std::ostream& operator<<(std::ostream& out, const CComBSTR &str) +{ + // I love strings. I really do. That's why I make sure + // to need 4 different types of strings to stream one out. + TCHAR szFinal[1024]; + _bstr_t bstrIntermediate(str); + _stprintf_s(szFinal, _T("%s"), (LPCTSTR)bstrIntermediate); + return out << szFinal; +} + +// Test passing arguments to a plugin. +TEST_F(NPAPITester, Arguments) { + std::wstring test_case = L"arguments.html"; + GURL url = GetTestUrl(L"npapi", test_case); + NavigateToURL(url); + WaitForFinish("arguments", "1", url, kTestCompleteCookie, + kTestCompleteSuccess, kShortWaitTimeout); +} + +// Test invoking many plugins within a single page. +TEST_F(NPAPITester, ManyPlugins) { + std::wstring test_case = L"many_plugins.html"; + GURL url(GetTestUrl(L"npapi", test_case)); + NavigateToURL(url); + + WaitForFinish("arguments", "1", url, kTestCompleteCookie, + kTestCompleteSuccess, kShortWaitTimeout); + WaitForFinish("arguments", "2", url, kTestCompleteCookie, + kTestCompleteSuccess, kShortWaitTimeout); + WaitForFinish("arguments", "3", url, kTestCompleteCookie, + kTestCompleteSuccess, kShortWaitTimeout); + WaitForFinish("arguments", "4", url, kTestCompleteCookie, + kTestCompleteSuccess, kShortWaitTimeout); + WaitForFinish("arguments", "5", url, kTestCompleteCookie, + kTestCompleteSuccess, kShortWaitTimeout); + WaitForFinish("arguments", "6", url, kTestCompleteCookie, + kTestCompleteSuccess, kShortWaitTimeout); + WaitForFinish("arguments", "7", url, kTestCompleteCookie, + kTestCompleteSuccess, kShortWaitTimeout); + WaitForFinish("arguments", "8", url, kTestCompleteCookie, + kTestCompleteSuccess, kShortWaitTimeout); + WaitForFinish("arguments", "9", url, kTestCompleteCookie, + kTestCompleteSuccess, kShortWaitTimeout); + WaitForFinish("arguments", "10", url, kTestCompleteCookie, + kTestCompleteSuccess, kShortWaitTimeout); + WaitForFinish("arguments", "11", url, kTestCompleteCookie, + kTestCompleteSuccess, kShortWaitTimeout); + WaitForFinish("arguments", "12", url, kTestCompleteCookie, + kTestCompleteSuccess, kShortWaitTimeout); + WaitForFinish("arguments", "13", url, kTestCompleteCookie, + kTestCompleteSuccess, kShortWaitTimeout); + WaitForFinish("arguments", "14", url, kTestCompleteCookie, + kTestCompleteSuccess, kShortWaitTimeout); + WaitForFinish("arguments", "15", url, kTestCompleteCookie, + kTestCompleteSuccess, kShortWaitTimeout); +} + +// Test various calls to GetURL from a plugin. +TEST_F(NPAPITester, GetURL) { + std::wstring test_case = L"geturl.html"; + GURL url = GetTestUrl(L"npapi", test_case); + NavigateToURL(url); + WaitForFinish("geturl", "1", url, kTestCompleteCookie, + kTestCompleteSuccess, kShortWaitTimeout); +} + +// Test various calls to GetURL for javascript URLs with +// non NULL targets from a plugin. +TEST_F(NPAPITester, GetJavaScriptURL) { + std::wstring test_case = L"get_javascript_url.html"; + GURL url = GetTestUrl(L"npapi", test_case); + NavigateToURL(url); + WaitForFinish("getjavascripturl", "1", url, kTestCompleteCookie, + kTestCompleteSuccess, kShortWaitTimeout); +} + +// 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. +TEST_F(NPAPITester, NPObjectProxy) { + std::wstring test_case = L"npobject_proxy.html"; + GURL url = GetTestUrl(L"npapi", test_case); + NavigateToURL(url); + WaitForFinish("npobject_proxy", "1", url, kTestCompleteCookie, + kTestCompleteSuccess, kShortWaitTimeout); +} + +// Tests if a plugin executing a self deleting script using NPN_GetURL +// works without crashing or hanging +TEST_F(NPAPITester, SelfDeletePluginGetUrl) { + std::wstring test_case = L"self_delete_plugin_geturl.html"; + GURL url = GetTestUrl(L"npapi", test_case); + NavigateToURL(url); + WaitForFinish("self_delete_plugin_geturl", "1", url, + kTestCompleteCookie, kTestCompleteSuccess, + kShortWaitTimeout); +} + +// Tests if a plugin executing a self deleting script using Invoke +// works without crashing or hanging +TEST_F(NPAPITester, SelfDeletePluginInvoke) { + std::wstring test_case = L"self_delete_plugin_invoke.html"; + GURL url = GetTestUrl(L"npapi", test_case); + NavigateToURL(url); + WaitForFinish("self_delete_plugin_invoke", "1", url, + kTestCompleteCookie, kTestCompleteSuccess, + kShortWaitTimeout); +} + +// Tests if a plugin executing a self deleting script using Invoke with +// a modal dialog showing works without crashing or hanging +TEST_F(NPAPITester, DISABLED_SelfDeletePluginInvokeAlert) { + std::wstring test_case = L"self_delete_plugin_invoke_alert.html"; + GURL url = GetTestUrl(L"npapi", test_case); + NavigateToURL(url); + + // Wait for the alert dialog and then close it. + automation()->WaitForAppModalDialog(5000); + scoped_ptr window(automation()->GetActiveWindow()); + ASSERT_TRUE(window.get()); + ASSERT_TRUE(window->SimulateOSKeyPress(VK_ESCAPE, 0)); + + WaitForFinish("self_delete_plugin_invoke_alert", "1", url, + kTestCompleteCookie, kTestCompleteSuccess, + kShortWaitTimeout); +} + +// Tests if a plugin executing a self deleting script in the context of +// a synchronous paint event works correctly +TEST_F(NPAPIVisiblePluginTester, SelfDeletePluginInvokeInSynchronousPaint) { + if (!UITest::in_process_renderer()) { + show_window_ = true; + std::wstring test_case = L"execute_script_delete_in_paint.html"; + GURL url = GetTestUrl(L"npapi", test_case); + NavigateToURL(url); + WaitForFinish("execute_script_delete_in_paint", "1", url, + kTestCompleteCookie, kTestCompleteSuccess, + kShortWaitTimeout); + } +} + +TEST_F(NPAPIVisiblePluginTester, SelfDeletePluginInNewStream) { + if (!UITest::in_process_renderer()) { + show_window_ = true; + std::wstring test_case = L"self_delete_plugin_stream.html"; + GURL url = GetTestUrl(L"npapi", test_case); + NavigateToURL(url); + WaitForFinish("self_delete_plugin_stream", "1", url, + kTestCompleteCookie, kTestCompleteSuccess, + kShortWaitTimeout); + } +} + +// Tests if a plugin has a non zero window rect. +TEST_F(NPAPIVisiblePluginTester, VerifyPluginWindowRect) { + show_window_ = true; + std::wstring test_case = L"verify_plugin_window_rect.html"; + GURL url = GetTestUrl(L"npapi", test_case); + NavigateToURL(url); + WaitForFinish("checkwindowrect", "1", url, kTestCompleteCookie, + kTestCompleteSuccess, kShortWaitTimeout); +} + +TEST_F(NPAPIVisiblePluginTester, VerifyNPObjectLifetimeTest) { + if (!UITest::in_process_renderer()) { + show_window_ = true; + std::wstring test_case = L"npobject_lifetime_test.html"; + GURL url = GetTestUrl(L"npapi", test_case); + NavigateToURL(url); + WaitForFinish("npobject_lifetime_test", "1", url, + kTestCompleteCookie, kTestCompleteSuccess, + kShortWaitTimeout); + } +} + +// Tests that we don't crash or assert if NPP_New fails +TEST_F(NPAPIVisiblePluginTester, NewFails) { + GURL url = GetTestUrl(L"npapi", L"new_fails.html"); + NavigateToURL(url); + WaitForFinish("new_fails", "1", url, kTestCompleteCookie, + kTestCompleteSuccess, kShortWaitTimeout); +} + +TEST_F(NPAPIVisiblePluginTester, SelfDeletePluginInNPNEvaluate) { + if (!UITest::in_process_renderer()) { + GURL url = GetTestUrl(L"npapi", + L"execute_script_delete_in_npn_evaluate.html"); + NavigateToURL(url); + WaitForFinish("npobject_delete_plugin_in_evaluate", "1", url, + kTestCompleteCookie, kTestCompleteSuccess, + kShortWaitTimeout); + } +} + +TEST_F(NPAPIVisiblePluginTester, OpenPopupWindowWithPlugin) { + GURL url = GetTestUrl(L"npapi", + L"get_javascript_open_popup_with_plugin.html"); + NavigateToURL(url); + WaitForFinish("plugin_popup_with_plugin_target", "1", url, + kTestCompleteCookie, kTestCompleteSuccess, + action_timeout_ms()); +} + +// Test checking the privacy mode is off. +TEST_F(NPAPITester, PrivateDisabled) { + if (UITest::in_process_renderer()) + return; + + GURL url = GetTestUrl(L"npapi", L"private.html"); + NavigateToURL(url); + WaitForFinish("private", "1", url, kTestCompleteCookie, + kTestCompleteSuccess, kShortWaitTimeout); +} + +// Test checking the privacy mode is on. +TEST_F(NPAPIIncognitoTester, PrivateEnabled) { + if (UITest::in_process_renderer()) + return; + + GURL url = GetTestUrl(L"npapi", L"private.html?secure"); + NavigateToURL(url); + WaitForFinish("private", "1", url, kTestCompleteCookie, + kTestCompleteSuccess, kShortWaitTimeout); +} diff --git a/chrome/test/ui/npapi_uitest.cpp b/chrome/test/ui/npapi_uitest.cpp deleted file mode 100644 index 7826878..0000000 --- a/chrome/test/ui/npapi_uitest.cpp +++ /dev/null @@ -1,283 +0,0 @@ -// Copyright 2008, Google Inc. -// All rights reserved. -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above -// copyright notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the name of Google Inc. nor the names of its -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -// -// NPAPI UnitTests. -// - -// windows headers -#include -#include -#include -#include -#include - -// runtime headers -#include -#include -#include - -#include - -#include "base/file_util.h" -#include "chrome/common/chrome_paths.h" -#include "chrome/test/automation/tab_proxy.h" -#include "chrome/test/automation/window_proxy.h" -#include "chrome/test/ui/npapi_test_helper.h" -#include "net/base/net_util.h" - -const char kTestCompleteCookie[] = "status"; -const char kTestCompleteSuccess[] = "OK"; -const int kLongWaitTimeout = 30 * 1000; -const int kShortWaitTimeout = 5 * 1000; - -std::ostream& operator<<(std::ostream& out, const CComBSTR &str) -{ - // I love strings. I really do. That's why I make sure - // to need 4 different types of strings to stream one out. - TCHAR szFinal[1024]; - _bstr_t bstrIntermediate(str); - _stprintf_s(szFinal, _T("%s"), (LPCTSTR)bstrIntermediate); - return out << szFinal; -} - -// Test passing arguments to a plugin. -TEST_F(NPAPITester, Arguments) { - std::wstring test_case = L"arguments.html"; - GURL url = GetTestUrl(L"npapi", test_case); - NavigateToURL(url); - WaitForFinish("arguments", "1", url, kTestCompleteCookie, - kTestCompleteSuccess, kShortWaitTimeout); -} - -// Test invoking many plugins within a single page. -TEST_F(NPAPITester, ManyPlugins) { - std::wstring test_case = L"many_plugins.html"; - GURL url(GetTestUrl(L"npapi", test_case)); - NavigateToURL(url); - - WaitForFinish("arguments", "1", url, kTestCompleteCookie, - kTestCompleteSuccess, kShortWaitTimeout); - WaitForFinish("arguments", "2", url, kTestCompleteCookie, - kTestCompleteSuccess, kShortWaitTimeout); - WaitForFinish("arguments", "3", url, kTestCompleteCookie, - kTestCompleteSuccess, kShortWaitTimeout); - WaitForFinish("arguments", "4", url, kTestCompleteCookie, - kTestCompleteSuccess, kShortWaitTimeout); - WaitForFinish("arguments", "5", url, kTestCompleteCookie, - kTestCompleteSuccess, kShortWaitTimeout); - WaitForFinish("arguments", "6", url, kTestCompleteCookie, - kTestCompleteSuccess, kShortWaitTimeout); - WaitForFinish("arguments", "7", url, kTestCompleteCookie, - kTestCompleteSuccess, kShortWaitTimeout); - WaitForFinish("arguments", "8", url, kTestCompleteCookie, - kTestCompleteSuccess, kShortWaitTimeout); - WaitForFinish("arguments", "9", url, kTestCompleteCookie, - kTestCompleteSuccess, kShortWaitTimeout); - WaitForFinish("arguments", "10", url, kTestCompleteCookie, - kTestCompleteSuccess, kShortWaitTimeout); - WaitForFinish("arguments", "11", url, kTestCompleteCookie, - kTestCompleteSuccess, kShortWaitTimeout); - WaitForFinish("arguments", "12", url, kTestCompleteCookie, - kTestCompleteSuccess, kShortWaitTimeout); - WaitForFinish("arguments", "13", url, kTestCompleteCookie, - kTestCompleteSuccess, kShortWaitTimeout); - WaitForFinish("arguments", "14", url, kTestCompleteCookie, - kTestCompleteSuccess, kShortWaitTimeout); - WaitForFinish("arguments", "15", url, kTestCompleteCookie, - kTestCompleteSuccess, kShortWaitTimeout); -} - -// Test various calls to GetURL from a plugin. -TEST_F(NPAPITester, GetURL) { - std::wstring test_case = L"geturl.html"; - GURL url = GetTestUrl(L"npapi", test_case); - NavigateToURL(url); - WaitForFinish("geturl", "1", url, kTestCompleteCookie, - kTestCompleteSuccess, kShortWaitTimeout); -} - -// Test various calls to GetURL for javascript URLs with -// non NULL targets from a plugin. -TEST_F(NPAPITester, GetJavaScriptURL) { - std::wstring test_case = L"get_javascript_url.html"; - GURL url = GetTestUrl(L"npapi", test_case); - NavigateToURL(url); - WaitForFinish("getjavascripturl", "1", url, kTestCompleteCookie, - kTestCompleteSuccess, kShortWaitTimeout); -} - -// 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. -TEST_F(NPAPITester, NPObjectProxy) { - std::wstring test_case = L"npobject_proxy.html"; - GURL url = GetTestUrl(L"npapi", test_case); - NavigateToURL(url); - WaitForFinish("npobject_proxy", "1", url, kTestCompleteCookie, - kTestCompleteSuccess, kShortWaitTimeout); -} - -// Tests if a plugin executing a self deleting script using NPN_GetURL -// works without crashing or hanging -TEST_F(NPAPITester, SelfDeletePluginGetUrl) { - std::wstring test_case = L"self_delete_plugin_geturl.html"; - GURL url = GetTestUrl(L"npapi", test_case); - NavigateToURL(url); - WaitForFinish("self_delete_plugin_geturl", "1", url, - kTestCompleteCookie, kTestCompleteSuccess, - kShortWaitTimeout); -} - -// Tests if a plugin executing a self deleting script using Invoke -// works without crashing or hanging -TEST_F(NPAPITester, SelfDeletePluginInvoke) { - std::wstring test_case = L"self_delete_plugin_invoke.html"; - GURL url = GetTestUrl(L"npapi", test_case); - NavigateToURL(url); - WaitForFinish("self_delete_plugin_invoke", "1", url, - kTestCompleteCookie, kTestCompleteSuccess, - kShortWaitTimeout); -} - -// Tests if a plugin executing a self deleting script using Invoke with -// a modal dialog showing works without crashing or hanging -TEST_F(NPAPITester, DISABLED_SelfDeletePluginInvokeAlert) { - std::wstring test_case = L"self_delete_plugin_invoke_alert.html"; - GURL url = GetTestUrl(L"npapi", test_case); - NavigateToURL(url); - - // Wait for the alert dialog and then close it. - automation()->WaitForAppModalDialog(5000); - scoped_ptr window(automation()->GetActiveWindow()); - ASSERT_TRUE(window.get()); - ASSERT_TRUE(window->SimulateOSKeyPress(VK_ESCAPE, 0)); - - WaitForFinish("self_delete_plugin_invoke_alert", "1", url, - kTestCompleteCookie, kTestCompleteSuccess, - kShortWaitTimeout); -} - -// Tests if a plugin executing a self deleting script in the context of -// a synchronous paint event works correctly -TEST_F(NPAPIVisiblePluginTester, SelfDeletePluginInvokeInSynchronousPaint) { - if (!UITest::in_process_renderer()) { - show_window_ = true; - std::wstring test_case = L"execute_script_delete_in_paint.html"; - GURL url = GetTestUrl(L"npapi", test_case); - NavigateToURL(url); - WaitForFinish("execute_script_delete_in_paint", "1", url, - kTestCompleteCookie, kTestCompleteSuccess, - kShortWaitTimeout); - } -} - -TEST_F(NPAPIVisiblePluginTester, SelfDeletePluginInNewStream) { - if (!UITest::in_process_renderer()) { - show_window_ = true; - std::wstring test_case = L"self_delete_plugin_stream.html"; - GURL url = GetTestUrl(L"npapi", test_case); - NavigateToURL(url); - WaitForFinish("self_delete_plugin_stream", "1", url, - kTestCompleteCookie, kTestCompleteSuccess, - kShortWaitTimeout); - } -} - -// Tests if a plugin has a non zero window rect. -TEST_F(NPAPIVisiblePluginTester, VerifyPluginWindowRect) { - show_window_ = true; - std::wstring test_case = L"verify_plugin_window_rect.html"; - GURL url = GetTestUrl(L"npapi", test_case); - NavigateToURL(url); - WaitForFinish("checkwindowrect", "1", url, kTestCompleteCookie, - kTestCompleteSuccess, kShortWaitTimeout); -} - -TEST_F(NPAPIVisiblePluginTester, VerifyNPObjectLifetimeTest) { - if (!UITest::in_process_renderer()) { - show_window_ = true; - std::wstring test_case = L"npobject_lifetime_test.html"; - GURL url = GetTestUrl(L"npapi", test_case); - NavigateToURL(url); - WaitForFinish("npobject_lifetime_test", "1", url, - kTestCompleteCookie, kTestCompleteSuccess, - kShortWaitTimeout); - } -} - -// Tests that we don't crash or assert if NPP_New fails -TEST_F(NPAPIVisiblePluginTester, NewFails) { - GURL url = GetTestUrl(L"npapi", L"new_fails.html"); - NavigateToURL(url); - WaitForFinish("new_fails", "1", url, kTestCompleteCookie, - kTestCompleteSuccess, kShortWaitTimeout); -} - -TEST_F(NPAPIVisiblePluginTester, SelfDeletePluginInNPNEvaluate) { - if (!UITest::in_process_renderer()) { - GURL url = GetTestUrl(L"npapi", - L"execute_script_delete_in_npn_evaluate.html"); - NavigateToURL(url); - WaitForFinish("npobject_delete_plugin_in_evaluate", "1", url, - kTestCompleteCookie, kTestCompleteSuccess, - kShortWaitTimeout); - } -} - -TEST_F(NPAPIVisiblePluginTester, OpenPopupWindowWithPlugin) { - GURL url = GetTestUrl(L"npapi", - L"get_javascript_open_popup_with_plugin.html"); - NavigateToURL(url); - WaitForFinish("plugin_popup_with_plugin_target", "1", url, - kTestCompleteCookie, kTestCompleteSuccess, - action_timeout_ms()); -} - -// Test checking the privacy mode is off. -TEST_F(NPAPITester, PrivateDisabled) { - if (UITest::in_process_renderer()) - return; - - GURL url = GetTestUrl(L"npapi", L"private.html"); - NavigateToURL(url); - WaitForFinish("private", "1", url, kTestCompleteCookie, - kTestCompleteSuccess, kShortWaitTimeout); -} - -// Test checking the privacy mode is on. -TEST_F(NPAPIIncognitoTester, PrivateEnabled) { - if (UITest::in_process_renderer()) - return; - - GURL url = GetTestUrl(L"npapi", L"private.html?secure"); - NavigateToURL(url); - WaitForFinish("private", "1", url, kTestCompleteCookie, - kTestCompleteSuccess, kShortWaitTimeout); -} diff --git a/chrome/test/ui/ui_tests.scons b/chrome/test/ui/ui_tests.scons index 2736916..da3ca12b 100644 --- a/chrome/test/ui/ui_tests.scons +++ b/chrome/test/ui/ui_tests.scons @@ -137,8 +137,8 @@ input_files = ChromeFileList([ '$CHROME_DIR/test/automation/automation_proxy_uitest.cc', ]), MSVSFilter('TestNPAPI', [ - 'layout_plugin_uitest.cpp', - 'npapi_uitest.cpp', + 'layout_plugin_uitest.cc', + 'npapi_uitest.cc', ]), MSVSFilter('TestSessionHistory', [ '$CHROME_DIR/browser/session_history_uitest.cc', diff --git a/chrome/test/ui/ui_tests.vcproj b/chrome/test/ui/ui_tests.vcproj index 7f1d5f8..29e906e 100644 --- a/chrome/test/ui/ui_tests.vcproj +++ b/chrome/test/ui/ui_tests.vcproj @@ -286,11 +286,11 @@ Name="TestNPAPI" > -- cgit v1.1