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

Side by Side Diff: content/child/npapi/plugin_lib_unittest.cc

Issue 1851093005: Remove content/child/npapi (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@remove_combined_01_02
Patch Set: rebase Created 4 years, 8 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
« no previous file with comments | « content/child/npapi/plugin_lib.cc ('k') | content/child/npapi/plugin_web_event_converter_mac.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
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
3 // found in the LICENSE file.
4
5 #include "content/child/npapi/plugin_lib.h"
6
7 #include "base/strings/string_util.h"
8 #include "base/strings/utf_string_conversions.h"
9 #include "build/build_config.h"
10 #include "testing/gtest/include/gtest/gtest.h"
11
12 namespace content {
13
14 // Test the unloading of plugin libs. Bug http://crbug.com/46526 showed that
15 // if UnloadAllPlugins() simply iterates through the g_loaded_libs global
16 // variable, we can get a crash if no plugin libs were marked as always loaded.
17 class PluginLibTest : public PluginLib {
18 public:
19 PluginLibTest() : PluginLib(WebPluginInfo()) {}
20 using PluginLib::Unload;
21
22 protected:
23 ~PluginLibTest() override {}
24 };
25
26 TEST(PluginLibLoading, UnloadAllPlugins) {
27 // For the creation of the g_loaded_libs global variable.
28 ASSERT_EQ(static_cast<PluginLibTest*>(NULL),
29 PluginLibTest::CreatePluginLib(base::FilePath()));
30
31 // Try with a single plugin lib.
32 scoped_refptr<PluginLibTest> plugin_lib1(new PluginLibTest());
33 PluginLib::UnloadAllPlugins();
34
35 // Need to create it again, it should have been destroyed above.
36 ASSERT_EQ(static_cast<PluginLibTest*>(NULL),
37 PluginLibTest::CreatePluginLib(base::FilePath()));
38
39 // Try with two plugin libs.
40 plugin_lib1 = new PluginLibTest();
41 scoped_refptr<PluginLibTest> plugin_lib2(new PluginLibTest());
42 PluginLib::UnloadAllPlugins();
43
44 // Need to create it again, it should have been destroyed above.
45 ASSERT_EQ(static_cast<PluginLibTest*>(NULL),
46 PluginLibTest::CreatePluginLib(base::FilePath()));
47
48 // Now try to manually Unload one and then UnloadAll.
49 plugin_lib1 = new PluginLibTest();
50 plugin_lib2 = new PluginLibTest();
51 plugin_lib1->Unload();
52 PluginLib::UnloadAllPlugins();
53
54 // Need to create it again, it should have been destroyed above.
55 ASSERT_EQ(static_cast<PluginLibTest*>(NULL),
56 PluginLibTest::CreatePluginLib(base::FilePath()));
57
58 // Now try to manually Unload the only one and then UnloadAll.
59 plugin_lib1 = new PluginLibTest();
60 plugin_lib1->Unload();
61 PluginLib::UnloadAllPlugins();
62 }
63
64 } // namespace content
OLDNEW
« no previous file with comments | « content/child/npapi/plugin_lib.cc ('k') | content/child/npapi/plugin_web_event_converter_mac.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698