| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 "content/browser/plugin_loader_posix.h" | 5 #include "content/browser/plugin_loader_posix.h" |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/file_path.h" | 8 #include "base/file_path.h" |
| 9 #include "base/message_loop.h" | 9 #include "base/message_loop.h" |
| 10 #include "base/memory/ref_counted.h" | 10 #include "base/memory/ref_counted.h" |
| (...skipping 258 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 269 message_loop()->RunAllPending(); | 269 message_loop()->RunAllPending(); |
| 270 EXPECT_EQ(0, did_callback); | 270 EXPECT_EQ(0, did_callback); |
| 271 | 271 |
| 272 plugin_loader()->TestOnPluginLoaded(plugin3_); | 272 plugin_loader()->TestOnPluginLoaded(plugin3_); |
| 273 EXPECT_EQ(3u, plugins.size()); | 273 EXPECT_EQ(3u, plugins.size()); |
| 274 EXPECT_EQ(plugin3_.name, plugins[2].name); | 274 EXPECT_EQ(plugin3_.name, plugins[2].name); |
| 275 | 275 |
| 276 message_loop()->RunAllPending(); | 276 message_loop()->RunAllPending(); |
| 277 EXPECT_EQ(1, did_callback); | 277 EXPECT_EQ(1, did_callback); |
| 278 } | 278 } |
| 279 |
| 280 TEST_F(PluginLoaderPosixTest, AllCrashed) { |
| 281 int did_callback = 0; |
| 282 PluginService::GetPluginsCallback callback = |
| 283 base::Bind(&VerifyCallback, base::Unretained(&did_callback)); |
| 284 |
| 285 plugin_loader()->LoadPlugins(message_loop()->message_loop_proxy(), callback); |
| 286 |
| 287 AddThreePlugins(); |
| 288 |
| 289 EXPECT_EQ(0u, plugin_loader()->next_load_index()); |
| 290 |
| 291 EXPECT_CALL(*plugin_loader(), LoadPluginsInternal()).Times(3); |
| 292 plugin_loader()->OnProcessCrashed(42); |
| 293 plugin_loader()->OnProcessCrashed(42); |
| 294 plugin_loader()->OnProcessCrashed(42); |
| 295 |
| 296 message_loop()->RunAllPending(); |
| 297 EXPECT_EQ(1, did_callback); |
| 298 |
| 299 EXPECT_EQ(0u, plugin_loader()->loaded_plugins().size()); |
| 300 } |
| OLD | NEW |