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

Side by Side Diff: webkit/plugins/npapi/plugin_lib_unittest.cc

Issue 12286020: Replace FilePath with base::FilePath. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 10 months 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "webkit/plugins/npapi/plugin_lib.h" 5 #include "webkit/plugins/npapi/plugin_lib.h"
6 6
7 #include "base/string_util.h" 7 #include "base/string_util.h"
8 #include "base/utf_string_conversions.h" 8 #include "base/utf_string_conversions.h"
9 #include "build/build_config.h" 9 #include "build/build_config.h"
10 #include "testing/gtest/include/gtest/gtest.h" 10 #include "testing/gtest/include/gtest/gtest.h"
11 11
12 namespace webkit { 12 namespace webkit {
13 namespace npapi { 13 namespace npapi {
14 14
15 // Test the unloading of plugin libs. Bug http://crbug.com/46526 showed that 15 // Test the unloading of plugin libs. Bug http://crbug.com/46526 showed that
16 // if UnloadAllPlugins() simply iterates through the g_loaded_libs global 16 // if UnloadAllPlugins() simply iterates through the g_loaded_libs global
17 // variable, we can get a crash if no plugin libs were marked as always loaded. 17 // variable, we can get a crash if no plugin libs were marked as always loaded.
18 class PluginLibTest : public PluginLib { 18 class PluginLibTest : public PluginLib {
19 public: 19 public:
20 PluginLibTest() : PluginLib(WebPluginInfo(), NULL) {} 20 PluginLibTest() : PluginLib(WebPluginInfo(), NULL) {}
21 using PluginLib::Unload; 21 using PluginLib::Unload;
22 22
23 protected: 23 protected:
24 virtual ~PluginLibTest() {} 24 virtual ~PluginLibTest() {}
25 }; 25 };
26 26
27 TEST(PluginLibLoading, UnloadAllPlugins) { 27 TEST(PluginLibLoading, UnloadAllPlugins) {
28 // For the creation of the g_loaded_libs global variable. 28 // For the creation of the g_loaded_libs global variable.
29 ASSERT_EQ(static_cast<PluginLibTest*>(NULL), 29 ASSERT_EQ(static_cast<PluginLibTest*>(NULL),
30 PluginLibTest::CreatePluginLib(FilePath())); 30 PluginLibTest::CreatePluginLib(base::FilePath()));
31 31
32 // Try with a single plugin lib. 32 // Try with a single plugin lib.
33 scoped_refptr<PluginLibTest> plugin_lib1(new PluginLibTest()); 33 scoped_refptr<PluginLibTest> plugin_lib1(new PluginLibTest());
34 PluginLib::UnloadAllPlugins(); 34 PluginLib::UnloadAllPlugins();
35 35
36 // Need to create it again, it should have been destroyed above. 36 // Need to create it again, it should have been destroyed above.
37 ASSERT_EQ(static_cast<PluginLibTest*>(NULL), 37 ASSERT_EQ(static_cast<PluginLibTest*>(NULL),
38 PluginLibTest::CreatePluginLib(FilePath())); 38 PluginLibTest::CreatePluginLib(base::FilePath()));
39 39
40 // Try with two plugin libs. 40 // Try with two plugin libs.
41 plugin_lib1 = new PluginLibTest(); 41 plugin_lib1 = new PluginLibTest();
42 scoped_refptr<PluginLibTest> plugin_lib2(new PluginLibTest()); 42 scoped_refptr<PluginLibTest> plugin_lib2(new PluginLibTest());
43 PluginLib::UnloadAllPlugins(); 43 PluginLib::UnloadAllPlugins();
44 44
45 // Need to create it again, it should have been destroyed above. 45 // Need to create it again, it should have been destroyed above.
46 ASSERT_EQ(static_cast<PluginLibTest*>(NULL), 46 ASSERT_EQ(static_cast<PluginLibTest*>(NULL),
47 PluginLibTest::CreatePluginLib(FilePath())); 47 PluginLibTest::CreatePluginLib(base::FilePath()));
48 48
49 // Now try to manually Unload one and then UnloadAll. 49 // Now try to manually Unload one and then UnloadAll.
50 plugin_lib1 = new PluginLibTest(); 50 plugin_lib1 = new PluginLibTest();
51 plugin_lib2 = new PluginLibTest(); 51 plugin_lib2 = new PluginLibTest();
52 plugin_lib1->Unload(); 52 plugin_lib1->Unload();
53 PluginLib::UnloadAllPlugins(); 53 PluginLib::UnloadAllPlugins();
54 54
55 // Need to create it again, it should have been destroyed above. 55 // Need to create it again, it should have been destroyed above.
56 ASSERT_EQ(static_cast<PluginLibTest*>(NULL), 56 ASSERT_EQ(static_cast<PluginLibTest*>(NULL),
57 PluginLibTest::CreatePluginLib(FilePath())); 57 PluginLibTest::CreatePluginLib(base::FilePath()));
58 58
59 // Now try to manually Unload the only one and then UnloadAll. 59 // Now try to manually Unload the only one and then UnloadAll.
60 plugin_lib1 = new PluginLibTest(); 60 plugin_lib1 = new PluginLibTest();
61 plugin_lib1->Unload(); 61 plugin_lib1->Unload();
62 PluginLib::UnloadAllPlugins(); 62 PluginLib::UnloadAllPlugins();
63 } 63 }
64 64
65 #if defined(OS_POSIX) && !defined(OS_MACOSX) 65 #if defined(OS_POSIX) && !defined(OS_MACOSX)
66 66
67 // Test parsing a simple description: Real Audio. 67 // Test parsing a simple description: Real Audio.
(...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after
168 "IcedTea-Web Plugin " 168 "IcedTea-Web Plugin "
169 "(using IcedTea-Web 1.2 (1.2-2ubuntu0.10.04.2))", 169 "(using IcedTea-Web 1.2 (1.2-2ubuntu0.10.04.2))",
170 &info); 170 &info);
171 EXPECT_EQ(ASCIIToUTF16("1.2"), info.version); 171 EXPECT_EQ(ASCIIToUTF16("1.2"), info.version);
172 } 172 }
173 173
174 #endif // defined(OS_POSIX) && !defined(OS_MACOSX) 174 #endif // defined(OS_POSIX) && !defined(OS_MACOSX)
175 175
176 } // namespace npapi 176 } // namespace npapi
177 } // namespace webkit 177 } // namespace webkit
OLDNEW
« no previous file with comments | « webkit/plugins/npapi/plugin_instance.h ('k') | webkit/tools/test_shell/simple_dom_storage_system.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698