| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 "build/build_config.h" | 5 #include "build/build_config.h" |
| 6 | 6 |
| 7 #include "base/message_loop/message_loop.h" | 7 #include "base/message_loop/message_loop.h" |
| 8 #include "base/pickle.h" | 8 #include "base/pickle.h" |
| 9 #include "base/threading/thread.h" | 9 #include "base/threading/thread.h" |
| 10 #include "ipc/ipc_message.h" | 10 #include "ipc/ipc_message.h" |
| (...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 136 last_filter_event_(NONE), | 136 last_filter_event_(NONE), |
| 137 message_filtering_enabled_(false) {} | 137 message_filtering_enabled_(false) {} |
| 138 | 138 |
| 139 MessageCountFilter(uint32 supported_message_class) | 139 MessageCountFilter(uint32 supported_message_class) |
| 140 : messages_received_(0), | 140 : messages_received_(0), |
| 141 supported_message_class_(supported_message_class), | 141 supported_message_class_(supported_message_class), |
| 142 is_global_filter_(false), | 142 is_global_filter_(false), |
| 143 last_filter_event_(NONE), | 143 last_filter_event_(NONE), |
| 144 message_filtering_enabled_(false) {} | 144 message_filtering_enabled_(false) {} |
| 145 | 145 |
| 146 virtual void OnFilterAdded(IPC::Channel* channel) OVERRIDE { | 146 virtual void OnFilterAdded(IPC::Sender* sender) OVERRIDE { |
| 147 EXPECT_TRUE(channel); | 147 EXPECT_TRUE(sender); |
| 148 EXPECT_EQ(NONE, last_filter_event_); | 148 EXPECT_EQ(NONE, last_filter_event_); |
| 149 last_filter_event_ = FILTER_ADDED; | 149 last_filter_event_ = FILTER_ADDED; |
| 150 } | 150 } |
| 151 | 151 |
| 152 virtual void OnChannelConnected(int32_t peer_pid) OVERRIDE { | 152 virtual void OnSenderConnected() OVERRIDE { |
| 153 EXPECT_EQ(FILTER_ADDED, last_filter_event_); | 153 EXPECT_EQ(FILTER_ADDED, last_filter_event_); |
| 154 EXPECT_NE(static_cast<int32_t>(base::kNullProcessId), peer_pid); | |
| 155 last_filter_event_ = CHANNEL_CONNECTED; | 154 last_filter_event_ = CHANNEL_CONNECTED; |
| 156 } | 155 } |
| 157 | 156 |
| 158 virtual void OnChannelError() OVERRIDE { | 157 virtual void OnSenderError() OVERRIDE { |
| 159 EXPECT_EQ(CHANNEL_CONNECTED, last_filter_event_); | 158 EXPECT_EQ(CHANNEL_CONNECTED, last_filter_event_); |
| 160 last_filter_event_ = CHANNEL_ERROR; | 159 last_filter_event_ = CHANNEL_ERROR; |
| 161 } | 160 } |
| 162 | 161 |
| 163 virtual void OnChannelClosing() OVERRIDE { | 162 virtual void OnSenderClosing() OVERRIDE { |
| 164 // We may or may not have gotten OnChannelError; if not, the last event has | 163 // We may or may not have gotten OnSenderError; if not, the last event has |
| 165 // to be OnChannelConnected. | 164 // to be OnSenderConnected. |
| 166 if (last_filter_event_ != CHANNEL_ERROR) | 165 if (last_filter_event_ != CHANNEL_ERROR) |
| 167 EXPECT_EQ(CHANNEL_CONNECTED, last_filter_event_); | 166 EXPECT_EQ(CHANNEL_CONNECTED, last_filter_event_); |
| 168 last_filter_event_ = CHANNEL_CLOSING; | 167 last_filter_event_ = CHANNEL_CLOSING; |
| 169 } | 168 } |
| 170 | 169 |
| 171 virtual void OnFilterRemoved() OVERRIDE { | 170 virtual void OnFilterRemoved() OVERRIDE { |
| 172 // If the channel didn't get a chance to connect, we might see the | 171 // If the channel didn't get a chance to connect, we might see the |
| 173 // OnFilterRemoved event with no other events preceding it. We still want | 172 // OnFilterRemoved event with no other events preceding it. We still want |
| 174 // OnFilterRemoved to be called to allow for deleting the Filter. | 173 // OnFilterRemoved to be called to allow for deleting the Filter. |
| 175 if (last_filter_event_ != NONE) | 174 if (last_filter_event_ != NONE) |
| (...skipping 256 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 432 IPCTestBase::GetChannelName("ChannelProxyClient"), | 431 IPCTestBase::GetChannelName("ChannelProxyClient"), |
| 433 &listener)); | 432 &listener)); |
| 434 CHECK(channel->Connect()); | 433 CHECK(channel->Connect()); |
| 435 listener.Init(channel.get()); | 434 listener.Init(channel.get()); |
| 436 | 435 |
| 437 base::MessageLoop::current()->Run(); | 436 base::MessageLoop::current()->Run(); |
| 438 return 0; | 437 return 0; |
| 439 } | 438 } |
| 440 | 439 |
| 441 } // namespace | 440 } // namespace |
| OLD | NEW |