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

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

Issue 324143002: Decouple IPC::MessageFilter from IPC::Channel (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fixing compilation errors Created 6 years, 6 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
Index: content/browser/fileapi/fileapi_message_filter_unittest.cc
diff --git a/content/browser/fileapi/fileapi_message_filter_unittest.cc b/content/browser/fileapi/fileapi_message_filter_unittest.cc
index 3a4c47e93eb758cd66dac8d55b1a67cf9aad35e1..fee38393fed9989e0a494da8d602836a28bd2f67 100644
--- a/content/browser/fileapi/fileapi_message_filter_unittest.cc
+++ b/content/browser/fileapi/fileapi_message_filter_unittest.cc
@@ -11,6 +11,7 @@
#include "base/memory/shared_memory.h"
#include "base/message_loop/message_loop.h"
#include "base/process/process.h"
+#include "content/browser/browser_message_filter_peer.h"
#include "content/browser/child_process_security_policy_impl.h"
#include "content/browser/fileapi/chrome_blob_storage_context.h"
#include "content/browser/streams/stream_registry.h"
@@ -84,6 +85,7 @@ class FileAPIMessageFilterTest : public testing::Test {
ChromeBlobStorageContext* blob_storage_context_;
scoped_refptr<FileAPIMessageFilter> filter_;
+ scoped_ptr<BrowserMessageFilterPeer> filter_peer_;
};
TEST_F(FileAPIMessageFilterTest, CloseChannelWithInflightRequest) {
@@ -94,7 +96,7 @@ TEST_F(FileAPIMessageFilterTest, CloseChannelWithInflightRequest) {
file_system_context_.get(),
ChromeBlobStorageContext::GetFor(&browser_context_),
StreamContext::GetFor(&browser_context_)));
- filter->OnChannelConnected(0);
+ filter->OnSenderConnected();
// Complete initialization.
message_loop_.RunUntilIdle();
@@ -105,7 +107,7 @@ TEST_F(FileAPIMessageFilterTest, CloseChannelWithInflightRequest) {
EXPECT_TRUE(filter->OnMessageReceived(read_metadata));
// Close the filter while it has inflight request.
- filter->OnChannelClosing();
+ filter->OnSenderClosing();
// This shouldn't cause DCHECK failure.
message_loop_.RunUntilIdle();
@@ -126,8 +128,8 @@ TEST_F(FileAPIMessageFilterTest, MultipleFilters) {
file_system_context_.get(),
ChromeBlobStorageContext::GetFor(&browser_context_),
StreamContext::GetFor(&browser_context_)));
- filter1->OnChannelConnected(0);
- filter2->OnChannelConnected(1);
+ filter1->OnSenderConnected();
+ filter2->OnSenderConnected();
// Complete initialization.
message_loop_.RunUntilIdle();
@@ -138,7 +140,7 @@ TEST_F(FileAPIMessageFilterTest, MultipleFilters) {
EXPECT_TRUE(filter1->OnMessageReceived(read_metadata));
// Close the other filter before the request for filter1 is processed.
- filter2->OnChannelClosing();
+ filter2->OnSenderClosing();
// This shouldn't cause DCHECK failure.
message_loop_.RunUntilIdle();
@@ -236,7 +238,8 @@ TEST_F(FileAPIMessageFilterTest, BuildStreamWithSharedMemory) {
// OnAppendSharedMemoryToStream passes the peer process's handle to
// SharedMemory's constructor. If it's incorrect, DuplicateHandle won't work
// correctly.
- filter_->set_peer_pid_for_testing(base::Process::Current().pid());
+ filter_peer_.reset(new BrowserMessageFilterPeer(base::GetCurrentProcId()));
+ filter_->OnFilterAddedToHost(filter_peer_.get());
StreamHostMsg_StartBuilding start_message(kUrl, kFakeContentType);
EXPECT_TRUE(filter_->OnMessageReceived(start_message));
@@ -272,7 +275,7 @@ TEST_F(FileAPIMessageFilterTest, BuildStreamWithSharedMemory) {
EXPECT_EQ(0, bytes_read);
}
-TEST_F(FileAPIMessageFilterTest, BuildStreamAndCallOnChannelClosing) {
+TEST_F(FileAPIMessageFilterTest, BuildStreamAndCallOnSenderClosing) {
StreamRegistry* stream_registry = stream_context_->registry();
const GURL kUrl(kFakeBlobInternalUrlSpec);
@@ -282,7 +285,7 @@ TEST_F(FileAPIMessageFilterTest, BuildStreamAndCallOnChannelClosing) {
ASSERT_FALSE(stream_registry->GetStream(kUrl).get() == NULL);
- filter_->OnChannelClosing();
+ filter_->OnSenderClosing();
ASSERT_EQ(NULL, stream_registry->GetStream(kUrl).get());
}

Powered by Google App Engine
This is Rietveld 408576698