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

Unified Diff: content/browser/fileapi/fileapi_message_filter_unittest.cc

Issue 24514003: Make BrowserMessageFilter not derive from IPC::ChannelProxy::MessageFilter. This allows us to hide … (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: sync Created 7 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/browser/fileapi/fileapi_message_filter.cc ('k') | content/browser/histogram_message_filter.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/browser/fileapi/fileapi_message_filter_unittest.cc
===================================================================
--- content/browser/fileapi/fileapi_message_filter_unittest.cc (revision 225900)
+++ content/browser/fileapi/fileapi_message_filter_unittest.cc (working copy)
@@ -76,12 +76,10 @@
}
// Tests via OnMessageReceived(const IPC::Message&). The channel proxy calls
- // this method. Since OnMessageReceived is hidden on FileAPIMessageFilter,
- // we need to cast it.
+ // this method.
bool InvokeOnMessageReceived(const IPC::Message& message) {
- IPC::ChannelProxy::MessageFilter* casted_filter =
- static_cast<IPC::ChannelProxy::MessageFilter*>(filter_.get());
- return casted_filter->OnMessageReceived(message);
+ bool message_was_ok;
+ return filter_->OnMessageReceived(message, &message_was_ok);
}
base::MessageLoop message_loop_;
@@ -108,13 +106,11 @@
// Complete initialization.
message_loop_.RunUntilIdle();
- IPC::ChannelProxy::MessageFilter* casted_filter =
- static_cast<IPC::ChannelProxy::MessageFilter*>(filter.get());
-
int request_id = 0;
const GURL kUrl("filesystem:http://example.com/temporary/foo");
FileSystemHostMsg_ReadMetadata read_metadata(request_id++, kUrl);
- EXPECT_TRUE(casted_filter->OnMessageReceived(read_metadata));
+ bool message_was_ok;
+ EXPECT_TRUE(filter->OnMessageReceived(read_metadata, &message_was_ok));
// Close the filter while it has inflight request.
filter->OnChannelClosing();
@@ -144,13 +140,11 @@
// Complete initialization.
message_loop_.RunUntilIdle();
- IPC::ChannelProxy::MessageFilter* casted_filter =
- static_cast<IPC::ChannelProxy::MessageFilter*>(filter1.get());
-
int request_id = 0;
const GURL kUrl("filesystem:http://example.com/temporary/foo");
FileSystemHostMsg_ReadMetadata read_metadata(request_id++, kUrl);
- EXPECT_TRUE(casted_filter->OnMessageReceived(read_metadata));
+ bool message_was_ok;
+ EXPECT_TRUE(filter1->OnMessageReceived(read_metadata, &message_was_ok));
// Close the other filter before the request for filter1 is processed.
filter2->OnChannelClosing();
@@ -251,8 +245,7 @@
// OnAppendSharedMemoryToStream passes the peer process's handle to
// SharedMemory's constructor. If it's incorrect, DuplicateHandle won't work
// correctly.
- static_cast<IPC::ChannelProxy::MessageFilter*>(
- filter_.get())->OnChannelConnected(base::Process::Current().pid());
+ filter_->set_peer_pid_for_testing(base::Process::Current().pid());
StreamHostMsg_StartBuilding start_message(kUrl, kFakeContentType);
EXPECT_TRUE(InvokeOnMessageReceived(start_message));
« no previous file with comments | « content/browser/fileapi/fileapi_message_filter.cc ('k') | content/browser/histogram_message_filter.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698