diff options
author | brettw@chromium.org <brettw@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-05-20 19:26:46 +0000 |
---|---|---|
committer | brettw@chromium.org <brettw@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-05-20 19:26:46 +0000 |
commit | 90864a884d166bc380fc354e6a448bea1230a087 (patch) | |
tree | c1b48dd2daa216fc873df218da942bf904cccb08 | |
parent | 95940f106670b9259dcc25cdeb56722d857dbca0 (diff) | |
download | chromium_src-90864a884d166bc380fc354e6a448bea1230a087.zip chromium_src-90864a884d166bc380fc354e6a448bea1230a087.tar.gz chromium_src-90864a884d166bc380fc354e6a448bea1230a087.tar.bz2 |
Add a PPAPI ui test framework and start running the existing image data test.
Pull latest Pepper to get test updates.
TEST=is what this is
BUG=none
Review URL: http://codereview.chromium.org/2076012
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@47828 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r-- | DEPS | 2 | ||||
-rw-r--r-- | chrome/chrome_tests.gypi | 2 | ||||
-rw-r--r-- | chrome/test/ui/ppapi_uitest.cc | 74 |
3 files changed, 77 insertions, 1 deletions
@@ -151,7 +151,7 @@ deps = { Var("libvpx_revision"), "src/third_party/ppapi": - "http://ppapi.googlecode.com/svn/trunk@44", + "http://ppapi.googlecode.com/svn/trunk@46", } diff --git a/chrome/chrome_tests.gypi b/chrome/chrome_tests.gypi index 8835fd5..1199d7f 100644 --- a/chrome/chrome_tests.gypi +++ b/chrome/chrome_tests.gypi @@ -286,6 +286,7 @@ '../third_party/icu/icu.gyp:icuuc', '../third_party/libxml/libxml.gyp:libxml', # run time dependencies + '../third_party/ppapi/ppapi.gyp:ppapi_tests', '../webkit/webkit.gyp:npapi_layout_test_plugin', ], 'include_dirs': [ @@ -338,6 +339,7 @@ 'test/ui/npapi_uitest.cc', 'test/ui/omnibox_uitest.cc', 'test/ui/pepper_uitest.cc', + 'test/ui/ppapi_uitest.cc', 'test/ui/sandbox_uitests.cc', 'test/ui/sunspider_uitest.cc', 'test/ui/v8_benchmark_uitest.cc', diff --git a/chrome/test/ui/ppapi_uitest.cc b/chrome/test/ui/ppapi_uitest.cc new file mode 100644 index 0000000..ae72dc1 --- /dev/null +++ b/chrome/test/ui/ppapi_uitest.cc @@ -0,0 +1,74 @@ +// Copyright (c) 2010 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 "base/file_util.h" +#include "base/path_service.h" +#include "build/build_config.h" +#include "chrome/common/chrome_switches.h" +#include "chrome/test/automation/tab_proxy.h" +#include "chrome/test/ui/ui_test.h" +#include "net/base/net_util.h" + +namespace { + +#if defined(OS_WIN) +const wchar_t library_name[] = L"ppapi_tests.dll"; +#elif defined(OS_MACOSX) +const char library_name[] = "ppapi_tests.plugin"; +#elif defined(OS_POSIX) +const char library_name[] = "ppapi_tests.so"; +#endif + +} // namespace + +class PPAPITest : public UITest { + public: + PPAPITest() { + // Append the switch to register the pepper plugin. + // library name = <out dir>/<test_name>.<library_extension> + // MIME type = application/x-ppapi-<test_name> + FilePath plugin_dir; + PathService::Get(base::DIR_EXE, &plugin_dir); + + FilePath plugin_lib = plugin_dir.Append(library_name); + EXPECT_TRUE(file_util::PathExists(plugin_lib)); + +#if defined(OS_WIN) + std::wstring pepper_plugin = plugin_lib.value(); +#else + std::wstring pepper_plugin = UTF8ToWide(plugin_lib.value()); +#endif + pepper_plugin.append(L";application/x-ppapi-tests"); + launch_arguments_.AppendSwitchWithValue(switches::kRegisterPepperPlugins, + pepper_plugin); + + // The test sends us the result via a cookie. + launch_arguments_.AppendSwitch(switches::kEnableFileCookies); + } + + void RunTest(const FilePath::StringType& test_file_name) { + FilePath test_path; + PathService::Get(base::DIR_SOURCE_ROOT, &test_path); + test_path = test_path.Append(FILE_PATH_LITERAL("third_party")); + test_path = test_path.Append(FILE_PATH_LITERAL("ppapi")); + test_path = test_path.Append(FILE_PATH_LITERAL("tests")); + test_path = test_path.Append(test_file_name); + + // Sanity check the file name. + EXPECT_TRUE(file_util::PathExists(test_path)); + + GURL test_url = net::FilePathToFileURL(test_path); + scoped_refptr<TabProxy> tab(GetActiveTab()); + ASSERT_TRUE(tab.get()); + ASSERT_TRUE(tab->NavigateToURL(test_url)); + std::string escaped_value = + WaitUntilCookieNonEmpty(tab.get(), test_url, + "COMPLETION_COOKIE", action_max_timeout_ms()); + EXPECT_STREQ("PASS", escaped_value.c_str()); + } +}; + +TEST_F(PPAPITest, DISABLED_Test) { + RunTest(FILE_PATH_LITERAL("test_image_data.html")); +} |