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

Unified Diff: content/public/test/mock_render_thread.cc

Issue 10854245: In-te-grate hy-phen-ator to con-tent. (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Created 8 years, 3 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « content/public/test/mock_render_thread.h ('k') | content/renderer/hyphenator/hyphenator.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/public/test/mock_render_thread.cc
===================================================================
--- content/public/test/mock_render_thread.cc (revision 154648)
+++ content/public/test/mock_render_thread.cc (working copy)
@@ -98,10 +98,21 @@
void MockRenderThread::AddFilter(IPC::ChannelProxy::MessageFilter* filter) {
filter->OnFilterAdded(&sink());
+ // Add this filter to a vector so the MockRenderThread::RemoveFilter function
+ // can check if this filter is added.
+ filters_.push_back(make_scoped_refptr(filter));
}
void MockRenderThread::RemoveFilter(IPC::ChannelProxy::MessageFilter* filter) {
- filter->OnFilterRemoved();
+ // Emulate the IPC::ChannelProxy::OnRemoveFilter function.
+ for (size_t i = 0; i < filters_.size(); ++i) {
+ if (filters_[i].get() == filter) {
+ filter->OnFilterRemoved();
+ filters_.erase(filters_.begin() + i);
+ return;
+ }
+ }
+ NOTREACHED() << "filter to be removed not found";
}
void MockRenderThread::SetOutgoingMessageFilter(
« no previous file with comments | « content/public/test/mock_render_thread.h ('k') | content/renderer/hyphenator/hyphenator.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698