| Index: webkit/glue/plugins/plugin_lib_unittest.cc
|
| diff --git a/webkit/plugins/npapi/plugin_lib_unittest.cc b/webkit/glue/plugins/plugin_lib_unittest.cc
|
| similarity index 88%
|
| rename from webkit/plugins/npapi/plugin_lib_unittest.cc
|
| rename to webkit/glue/plugins/plugin_lib_unittest.cc
|
| index 1794da909d7533c2a62f068d76d48d1b1cdb256a..45c4bb66dfbeaeeb9bcb21c4ebea4fc885baa0db 100644
|
| --- a/webkit/plugins/npapi/plugin_lib_unittest.cc
|
| +++ b/webkit/glue/plugins/plugin_lib_unittest.cc
|
| @@ -2,24 +2,21 @@
|
| // Use of this source code is governed by a BSD-style license that can be
|
| // found in the LICENSE file.
|
|
|
| -#include "webkit/plugins/npapi/plugin_lib.h"
|
| +#include "webkit/glue/plugins/plugin_lib.h"
|
|
|
| #include "base/string_util.h"
|
| #include "base/utf_string_conversions.h"
|
| #include "build/build_config.h"
|
| #include "testing/gtest/include/gtest/gtest.h"
|
|
|
| -namespace webkit {
|
| -namespace npapi {
|
| -
|
| // Test the unloading of plugin libs. Bug http://crbug.com/46526 showed that
|
| // if UnloadAllPlugins() simply iterates through the g_loaded_libs global
|
| // variable, we can get a crash if no plugin libs were marked as always loaded.
|
| -class PluginLibTest : public PluginLib {
|
| +class PluginLibTest : public NPAPI::PluginLib {
|
| public:
|
| - PluginLibTest() : PluginLib(WebPluginInfo(), NULL) {
|
| + PluginLibTest() : NPAPI::PluginLib(WebPluginInfo(), NULL) {
|
| }
|
| - using PluginLib::Unload;
|
| + using NPAPI::PluginLib::Unload;
|
| };
|
|
|
| TEST(PluginLibLoading, UnloadAllPlugins) {
|
| @@ -29,7 +26,7 @@ TEST(PluginLibLoading, UnloadAllPlugins) {
|
|
|
| // Try with a single plugin lib.
|
| scoped_refptr<PluginLibTest> plugin_lib1(new PluginLibTest());
|
| - PluginLib::UnloadAllPlugins();
|
| + NPAPI::PluginLib::UnloadAllPlugins();
|
|
|
| // Need to create it again, it should have been destroyed above.
|
| ASSERT_EQ(static_cast<PluginLibTest*>(NULL),
|
| @@ -38,7 +35,7 @@ TEST(PluginLibLoading, UnloadAllPlugins) {
|
| // Try with two plugin libs.
|
| plugin_lib1 = new PluginLibTest();
|
| scoped_refptr<PluginLibTest> plugin_lib2(new PluginLibTest());
|
| - PluginLib::UnloadAllPlugins();
|
| + NPAPI::PluginLib::UnloadAllPlugins();
|
|
|
| // Need to create it again, it should have been destroyed above.
|
| ASSERT_EQ(static_cast<PluginLibTest*>(NULL),
|
| @@ -48,7 +45,7 @@ TEST(PluginLibLoading, UnloadAllPlugins) {
|
| plugin_lib1 = new PluginLibTest();
|
| plugin_lib2 = new PluginLibTest();
|
| plugin_lib1->Unload();
|
| - PluginLib::UnloadAllPlugins();
|
| + NPAPI::PluginLib::UnloadAllPlugins();
|
|
|
| // Need to create it again, it should have been destroyed above.
|
| ASSERT_EQ(static_cast<PluginLibTest*>(NULL),
|
| @@ -57,7 +54,7 @@ TEST(PluginLibLoading, UnloadAllPlugins) {
|
| // Now try to manually Unload the only one and then UnloadAll.
|
| plugin_lib1 = new PluginLibTest();
|
| plugin_lib1->Unload();
|
| - PluginLib::UnloadAllPlugins();
|
| + NPAPI::PluginLib::UnloadAllPlugins();
|
| }
|
|
|
| #if defined(OS_LINUX)
|
| @@ -65,7 +62,7 @@ TEST(PluginLibLoading, UnloadAllPlugins) {
|
| // Test parsing a simple description: Real Audio.
|
| TEST(MIMEDescriptionParse, Simple) {
|
| std::vector<WebPluginMimeType> types;
|
| - PluginLib::ParseMIMEDescription(
|
| + NPAPI::PluginLib::ParseMIMEDescription(
|
| "audio/x-pn-realaudio-plugin:rpm:RealAudio document;",
|
| &types);
|
| ASSERT_EQ(1U, types.size());
|
| @@ -79,7 +76,7 @@ TEST(MIMEDescriptionParse, Simple) {
|
| // Test parsing a multi-entry description: QuickTime as provided by Totem.
|
| TEST(MIMEDescriptionParse, Multi) {
|
| std::vector<WebPluginMimeType> types;
|
| - PluginLib::ParseMIMEDescription(
|
| + NPAPI::PluginLib::ParseMIMEDescription(
|
| "video/quicktime:mov:QuickTime video;video/mp4:mp4:MPEG-4 "
|
| "video;image/x-macpaint:pntg:MacPaint Bitmap image;image/x"
|
| "-quicktime:pict, pict1, pict2:QuickTime image;video/x-m4v"
|
| @@ -101,7 +98,7 @@ TEST(MIMEDescriptionParse, Multi) {
|
| // This comes from loading Totem with LANG=ja_JP.UTF-8.
|
| TEST(MIMEDescriptionParse, JapaneseUTF8) {
|
| std::vector<WebPluginMimeType> types;
|
| - PluginLib::ParseMIMEDescription(
|
| + NPAPI::PluginLib::ParseMIMEDescription(
|
| "audio/x-ogg:ogg:Ogg \xe3\x82\xaa\xe3\x83\xbc\xe3\x83\x87"
|
| "\xe3\x82\xa3\xe3\x83\xaa",
|
| &types);
|
| @@ -114,11 +111,11 @@ TEST(MIMEDescriptionParse, JapaneseUTF8) {
|
| // Test that we handle corner cases gracefully.
|
| TEST(MIMEDescriptionParse, CornerCases) {
|
| std::vector<WebPluginMimeType> types;
|
| - PluginLib::ParseMIMEDescription("mime/type:", &types);
|
| + NPAPI::PluginLib::ParseMIMEDescription("mime/type:", &types);
|
| EXPECT_TRUE(types.empty());
|
|
|
| types.clear();
|
| - PluginLib::ParseMIMEDescription("mime/type:ext1:", &types);
|
| + NPAPI::PluginLib::ParseMIMEDescription("mime/type:ext1:", &types);
|
| ASSERT_EQ(1U, types.size());
|
| EXPECT_EQ("mime/type", types[0].mime_type);
|
| EXPECT_EQ(1U, types[0].file_extensions.size());
|
| @@ -129,7 +126,7 @@ TEST(MIMEDescriptionParse, CornerCases) {
|
| // This Java plugin has embedded semicolons in the mime type.
|
| TEST(MIMEDescriptionParse, ComplicatedJava) {
|
| std::vector<WebPluginMimeType> types;
|
| - PluginLib::ParseMIMEDescription(
|
| + NPAPI::PluginLib::ParseMIMEDescription(
|
| "application/x-java-vm:class,jar:IcedTea;application/x-java"
|
| "-applet:class,jar:IcedTea;application/x-java-applet;versio"
|
| "n=1.1:class,jar:IcedTea;application/x-java-applet;version="
|
| @@ -153,6 +150,3 @@ TEST(MIMEDescriptionParse, ComplicatedJava) {
|
| }
|
|
|
| #endif // defined(OS_LINUX)
|
| -
|
| -} // namespace npapi
|
| -} // namespace webkit
|
|
|