Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(32)

Unified Diff: webkit/plugins/npapi/plugin_lib_unittest.cc

Issue 6012002: Move the NPAPI files from webkit/glue/plugins to webkit/plugins/npapi and put... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Created 10 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « webkit/plugins/npapi/plugin_lib_posix.cc ('k') | webkit/plugins/npapi/plugin_lib_win.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: webkit/plugins/npapi/plugin_lib_unittest.cc
===================================================================
--- webkit/plugins/npapi/plugin_lib_unittest.cc (revision 0)
+++ webkit/plugins/npapi/plugin_lib_unittest.cc (working copy)
@@ -2,21 +2,24 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#include "webkit/glue/plugins/plugin_lib.h"
+#include "webkit/plugins/npapi/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 NPAPI::PluginLib {
+class PluginLibTest : public PluginLib {
public:
- PluginLibTest() : NPAPI::PluginLib(WebPluginInfo(), NULL) {
+ PluginLibTest() : PluginLib(WebPluginInfo(), NULL) {
}
- using NPAPI::PluginLib::Unload;
+ using PluginLib::Unload;
};
TEST(PluginLibLoading, UnloadAllPlugins) {
@@ -26,7 +29,7 @@
// Try with a single plugin lib.
scoped_refptr<PluginLibTest> plugin_lib1(new PluginLibTest());
- NPAPI::PluginLib::UnloadAllPlugins();
+ PluginLib::UnloadAllPlugins();
// Need to create it again, it should have been destroyed above.
ASSERT_EQ(static_cast<PluginLibTest*>(NULL),
@@ -35,7 +38,7 @@
// Try with two plugin libs.
plugin_lib1 = new PluginLibTest();
scoped_refptr<PluginLibTest> plugin_lib2(new PluginLibTest());
- NPAPI::PluginLib::UnloadAllPlugins();
+ PluginLib::UnloadAllPlugins();
// Need to create it again, it should have been destroyed above.
ASSERT_EQ(static_cast<PluginLibTest*>(NULL),
@@ -45,7 +48,7 @@
plugin_lib1 = new PluginLibTest();
plugin_lib2 = new PluginLibTest();
plugin_lib1->Unload();
- NPAPI::PluginLib::UnloadAllPlugins();
+ PluginLib::UnloadAllPlugins();
// Need to create it again, it should have been destroyed above.
ASSERT_EQ(static_cast<PluginLibTest*>(NULL),
@@ -54,7 +57,7 @@
// Now try to manually Unload the only one and then UnloadAll.
plugin_lib1 = new PluginLibTest();
plugin_lib1->Unload();
- NPAPI::PluginLib::UnloadAllPlugins();
+ PluginLib::UnloadAllPlugins();
}
#if defined(OS_LINUX)
@@ -62,7 +65,7 @@
// Test parsing a simple description: Real Audio.
TEST(MIMEDescriptionParse, Simple) {
std::vector<WebPluginMimeType> types;
- NPAPI::PluginLib::ParseMIMEDescription(
+ PluginLib::ParseMIMEDescription(
"audio/x-pn-realaudio-plugin:rpm:RealAudio document;",
&types);
ASSERT_EQ(1U, types.size());
@@ -76,7 +79,7 @@
// Test parsing a multi-entry description: QuickTime as provided by Totem.
TEST(MIMEDescriptionParse, Multi) {
std::vector<WebPluginMimeType> types;
- NPAPI::PluginLib::ParseMIMEDescription(
+ 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"
@@ -98,7 +101,7 @@
// This comes from loading Totem with LANG=ja_JP.UTF-8.
TEST(MIMEDescriptionParse, JapaneseUTF8) {
std::vector<WebPluginMimeType> types;
- NPAPI::PluginLib::ParseMIMEDescription(
+ PluginLib::ParseMIMEDescription(
"audio/x-ogg:ogg:Ogg \xe3\x82\xaa\xe3\x83\xbc\xe3\x83\x87"
"\xe3\x82\xa3\xe3\x83\xaa",
&types);
@@ -111,11 +114,11 @@
// Test that we handle corner cases gracefully.
TEST(MIMEDescriptionParse, CornerCases) {
std::vector<WebPluginMimeType> types;
- NPAPI::PluginLib::ParseMIMEDescription("mime/type:", &types);
+ PluginLib::ParseMIMEDescription("mime/type:", &types);
EXPECT_TRUE(types.empty());
types.clear();
- NPAPI::PluginLib::ParseMIMEDescription("mime/type:ext1:", &types);
+ 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());
@@ -126,7 +129,7 @@
// This Java plugin has embedded semicolons in the mime type.
TEST(MIMEDescriptionParse, ComplicatedJava) {
std::vector<WebPluginMimeType> types;
- NPAPI::PluginLib::ParseMIMEDescription(
+ 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="
@@ -150,3 +153,6 @@
}
#endif // defined(OS_LINUX)
+
+} // namespace npapi
+} // namespace webkit
« no previous file with comments | « webkit/plugins/npapi/plugin_lib_posix.cc ('k') | webkit/plugins/npapi/plugin_lib_win.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698