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

Side by Side Diff: ipc/ipc_channel_proxy_unittest.cc

Issue 2437283005: Fix some test expectations for IPC tests (Closed)
Patch Set: Created 4 years, 1 month 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 <stddef.h> 7 #include <stddef.h>
8 #include <stdint.h> 8 #include <stdint.h>
9 #include <memory> 9 #include <memory>
10 10
(...skipping 147 matching lines...) Expand 10 before | Expand all | Expand 10 after
158 } 158 }
159 159
160 void OnChannelError() override { 160 void OnChannelError() override {
161 EXPECT_EQ(CHANNEL_CONNECTED, last_filter_event_); 161 EXPECT_EQ(CHANNEL_CONNECTED, last_filter_event_);
162 last_filter_event_ = CHANNEL_ERROR; 162 last_filter_event_ = CHANNEL_ERROR;
163 } 163 }
164 164
165 void OnChannelClosing() override { 165 void OnChannelClosing() override {
166 // We may or may not have gotten OnChannelError; if not, the last event has 166 // We may or may not have gotten OnChannelError; if not, the last event has
167 // to be OnChannelConnected. 167 // to be OnChannelConnected.
168 EXPECT_NE(FILTER_REMOVED, last_filter_event_);
168 if (last_filter_event_ != CHANNEL_ERROR) 169 if (last_filter_event_ != CHANNEL_ERROR)
169 EXPECT_EQ(CHANNEL_CONNECTED, last_filter_event_); 170 EXPECT_EQ(CHANNEL_CONNECTED, last_filter_event_);
170 last_filter_event_ = CHANNEL_CLOSING; 171 last_filter_event_ = CHANNEL_CLOSING;
171 } 172 }
172 173
173 void OnFilterRemoved() override { 174 void OnFilterRemoved() override {
174 // If the channel didn't get a chance to connect, we might see the 175 // A filter may be removed at any time, even before the channel is connected
175 // OnFilterRemoved event with no other events preceding it. We still want 176 // (and thus before OnFilterAdded is ever able to dispatch.) The only time
176 // OnFilterRemoved to be called to allow for deleting the Filter. 177 // we won't see OnFilterRemoved is immediately after OnFilterAdded, because
177 if (last_filter_event_ != NONE) 178 // OnChannelConnected is always the next event to fire after that.
178 EXPECT_EQ(CHANNEL_CLOSING, last_filter_event_); 179 EXPECT_NE(FILTER_ADDED, last_filter_event_);
179 last_filter_event_ = FILTER_REMOVED; 180 last_filter_event_ = FILTER_REMOVED;
180 } 181 }
181 182
182 bool OnMessageReceived(const IPC::Message& message) override { 183 bool OnMessageReceived(const IPC::Message& message) override {
183 // We should always get the OnFilterAdded and OnChannelConnected events 184 // We should always get the OnFilterAdded and OnChannelConnected events
184 // prior to any messages. 185 // prior to any messages.
185 EXPECT_EQ(CHANNEL_CONNECTED, last_filter_event_); 186 EXPECT_EQ(CHANNEL_CONNECTED, last_filter_event_);
186 187
187 if (!is_global_filter_) { 188 if (!is_global_filter_) {
188 EXPECT_EQ(supported_message_class_, IPC_MESSAGE_CLASS(message)); 189 EXPECT_EQ(supported_message_class_, IPC_MESSAGE_CLASS(message));
(...skipping 242 matching lines...) Expand 10 before | Expand all | Expand 10 after
431 IPCTestBase::GetChannelName("ChannelProxyClient"), &listener, 432 IPCTestBase::GetChannelName("ChannelProxyClient"), &listener,
432 main_message_loop.task_runner())); 433 main_message_loop.task_runner()));
433 CHECK(channel->Connect()); 434 CHECK(channel->Connect());
434 listener.Init(channel.get()); 435 listener.Init(channel.get());
435 436
436 base::RunLoop().Run(); 437 base::RunLoop().Run();
437 return 0; 438 return 0;
438 } 439 }
439 440
440 } // namespace 441 } // namespace
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698