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

Side by Side Diff: content/browser/plugin_loader_posix_unittest.cc

Issue 14335017: content: Use base::MessageLoop. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase Created 7 years, 7 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 "content/browser/plugin_loader_posix.h" 5 #include "content/browser/plugin_loader_posix.h"
6 6
7 #include "base/at_exit.h" 7 #include "base/at_exit.h"
8 #include "base/bind.h" 8 #include "base/bind.h"
9 #include "base/files/file_path.h" 9 #include "base/files/file_path.h"
10 #include "base/memory/ref_counted.h" 10 #include "base/memory/ref_counted.h"
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after
72 ASCIIToUTF16("3.0"), string16()), 72 ASCIIToUTF16("3.0"), string16()),
73 file_thread_(BrowserThread::FILE, &message_loop_), 73 file_thread_(BrowserThread::FILE, &message_loop_),
74 io_thread_(BrowserThread::IO, &message_loop_), 74 io_thread_(BrowserThread::IO, &message_loop_),
75 plugin_loader_(new MockPluginLoaderPosix) { 75 plugin_loader_(new MockPluginLoaderPosix) {
76 } 76 }
77 77
78 virtual void SetUp() OVERRIDE { 78 virtual void SetUp() OVERRIDE {
79 PluginServiceImpl::GetInstance()->Init(); 79 PluginServiceImpl::GetInstance()->Init();
80 } 80 }
81 81
82 MessageLoop* message_loop() { return &message_loop_; } 82 base::MessageLoop* message_loop() { return &message_loop_; }
83 MockPluginLoaderPosix* plugin_loader() { return plugin_loader_.get(); } 83 MockPluginLoaderPosix* plugin_loader() { return plugin_loader_.get(); }
84 84
85 void AddThreePlugins() { 85 void AddThreePlugins() {
86 plugin_loader_->canonical_list()->clear(); 86 plugin_loader_->canonical_list()->clear();
87 plugin_loader_->canonical_list()->push_back(plugin1_.path); 87 plugin_loader_->canonical_list()->push_back(plugin1_.path);
88 plugin_loader_->canonical_list()->push_back(plugin2_.path); 88 plugin_loader_->canonical_list()->push_back(plugin2_.path);
89 plugin_loader_->canonical_list()->push_back(plugin3_.path); 89 plugin_loader_->canonical_list()->push_back(plugin3_.path);
90 } 90 }
91 91
92 // Data used for testing. 92 // Data used for testing.
93 webkit::WebPluginInfo plugin1_; 93 webkit::WebPluginInfo plugin1_;
94 webkit::WebPluginInfo plugin2_; 94 webkit::WebPluginInfo plugin2_;
95 webkit::WebPluginInfo plugin3_; 95 webkit::WebPluginInfo plugin3_;
96 96
97 private: 97 private:
98 base::ShadowingAtExitManager at_exit_manager_; // Destroys PluginService. 98 base::ShadowingAtExitManager at_exit_manager_; // Destroys PluginService.
99 99
100 MessageLoopForIO message_loop_; 100 base::MessageLoopForIO message_loop_;
101 BrowserThreadImpl file_thread_; 101 BrowserThreadImpl file_thread_;
102 BrowserThreadImpl io_thread_; 102 BrowserThreadImpl io_thread_;
103 103
104 scoped_refptr<MockPluginLoaderPosix> plugin_loader_; 104 scoped_refptr<MockPluginLoaderPosix> plugin_loader_;
105 }; 105 };
106 106
107 TEST_F(PluginLoaderPosixTest, QueueRequests) { 107 TEST_F(PluginLoaderPosixTest, QueueRequests) {
108 int did_callback = 0; 108 int did_callback = 0;
109 PluginService::GetPluginsCallback callback = 109 PluginService::GetPluginsCallback callback =
110 base::Bind(&VerifyCallback, base::Unretained(&did_callback)); 110 base::Bind(&VerifyCallback, base::Unretained(&did_callback));
(...skipping 259 matching lines...) Expand 10 before | Expand all | Expand 10 after
370 plugin_loader()->OnProcessCrashed(42); 370 plugin_loader()->OnProcessCrashed(42);
371 plugin_loader()->OnProcessCrashed(42); 371 plugin_loader()->OnProcessCrashed(42);
372 372
373 message_loop()->RunUntilIdle(); 373 message_loop()->RunUntilIdle();
374 EXPECT_EQ(1, did_callback); 374 EXPECT_EQ(1, did_callback);
375 375
376 EXPECT_EQ(0u, plugin_loader()->loaded_plugins().size()); 376 EXPECT_EQ(0u, plugin_loader()->loaded_plugins().size());
377 } 377 }
378 378
379 } // namespace content 379 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/plugin_data_remover_impl_browsertest.cc ('k') | content/browser/plugin_service_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698