Index: content/browser/plugin_loader_posix_unittest.cc |
diff --git a/content/browser/plugin_loader_posix_unittest.cc b/content/browser/plugin_loader_posix_unittest.cc |
index 59e30b1ddd3d863fc92cd0546e75f9aa2e77566a..9b7e29b82484dcf9d6fe5174dd4e65df275e74c1 100644 |
--- a/content/browser/plugin_loader_posix_unittest.cc |
+++ b/content/browser/plugin_loader_posix_unittest.cc |
@@ -47,6 +47,13 @@ class MockPluginLoaderPosix : public PluginLoaderPosix { |
PluginLoaderPosix::LoadPluginsInternal(); |
} |
+ bool LaunchUtilityProcess() override { |
+ // This method always does nothing and returns false. The actual |
+ // implementation of this method launches another process, which is not |
+ // very unit_test friendly. |
+ return false; |
+ } |
+ |
void TestOnPluginLoaded(uint32 index, const WebPluginInfo& plugin) { |
OnPluginLoaded(index, plugin); |
} |
@@ -394,4 +401,23 @@ TEST_F(PluginLoaderPosixTest, AllCrashed) { |
EXPECT_EQ(0u, plugin_loader()->loaded_plugins().size()); |
} |
+TEST_F(PluginLoaderPosixTest, PluginLaunchFailed) { |
+ int did_callback = 0; |
+ PluginService::GetPluginsCallback callback = |
+ base::Bind(&VerifyCallback, base::Unretained(&did_callback)); |
+ |
+ EXPECT_CALL(*plugin_loader(), LoadPluginsInternal()) |
+ .WillOnce(testing::Invoke( |
+ plugin_loader(), &MockPluginLoaderPosix::RealLoadPluginsInternal)); |
+ |
+ plugin_loader()->GetPlugins(callback); |
+ message_loop()->RunUntilIdle(); |
+ EXPECT_EQ(1, did_callback); |
+ EXPECT_EQ(0u, plugin_loader()->loaded_plugins().size()); |
+ |
+ // TODO(erikchen): This is a genuine leak that should be fixed. |
+ // https://code.google.com/p/chromium/issues/detail?id=431906 |
+ testing::Mock::AllowLeak(plugin_loader()); |
+} |
+ |
} // namespace content |