| 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 "ipc/ipc_channel_mojo.h" | 5 #include "ipc/ipc_channel_mojo.h" |
| 6 | 6 |
| 7 #include <stddef.h> | 7 #include <stddef.h> |
| 8 #include <stdint.h> | 8 #include <stdint.h> |
| 9 | 9 |
| 10 #include <memory> | 10 #include <memory> |
| (...skipping 208 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 219 EXPECT_TRUE(listener.is_connected_called()); | 219 EXPECT_TRUE(listener.is_connected_called()); |
| 220 EXPECT_TRUE(listener.HasSentAll()); | 220 EXPECT_TRUE(listener.HasSentAll()); |
| 221 | 221 |
| 222 Close(); | 222 Close(); |
| 223 } | 223 } |
| 224 | 224 |
| 225 class ListenerExpectingErrors : public IPC::Listener { | 225 class ListenerExpectingErrors : public IPC::Listener { |
| 226 public: | 226 public: |
| 227 ListenerExpectingErrors() : has_error_(false) {} | 227 ListenerExpectingErrors() : has_error_(false) {} |
| 228 | 228 |
| 229 void OnChannelConnected(int32_t peer_pid) override { | |
| 230 base::MessageLoop::current()->QuitWhenIdle(); | |
| 231 } | |
| 232 | |
| 233 bool OnMessageReceived(const IPC::Message& message) override { return true; } | 229 bool OnMessageReceived(const IPC::Message& message) override { return true; } |
| 234 | 230 |
| 235 void OnChannelError() override { | 231 void OnChannelError() override { |
| 236 has_error_ = true; | 232 has_error_ = true; |
| 237 base::MessageLoop::current()->QuitWhenIdle(); | 233 base::MessageLoop::current()->QuitWhenIdle(); |
| 238 } | 234 } |
| 239 | 235 |
| 240 bool has_error() const { return has_error_; } | 236 bool has_error() const { return has_error_; } |
| 241 | 237 |
| 242 private: | 238 private: |
| (...skipping 15 matching lines...) Expand all Loading... |
| 258 DEFINE_IPC_CHANNEL_MOJO_TEST_CLIENT(IPCChannelMojoErraticTestClient, | 254 DEFINE_IPC_CHANNEL_MOJO_TEST_CLIENT(IPCChannelMojoErraticTestClient, |
| 259 ChannelClient) { | 255 ChannelClient) { |
| 260 ListenerThatQuits listener; | 256 ListenerThatQuits listener; |
| 261 Connect(&listener); | 257 Connect(&listener); |
| 262 | 258 |
| 263 base::RunLoop().Run(); | 259 base::RunLoop().Run(); |
| 264 | 260 |
| 265 Close(); | 261 Close(); |
| 266 } | 262 } |
| 267 | 263 |
| 268 // Disabled because flake. http://crbug.com/630831 | 264 TEST_F(IPCChannelMojoTest, SendFailWithPendingMessages) { |
| 269 TEST_F(IPCChannelMojoTest, DISABLED_SendFailWithPendingMessages) { | |
| 270 InitWithMojo("IPCChannelMojoErraticTestClient"); | 265 InitWithMojo("IPCChannelMojoErraticTestClient"); |
| 271 | 266 |
| 272 // Set up IPC channel and start client. | 267 // Set up IPC channel and start client. |
| 273 ListenerExpectingErrors listener; | 268 ListenerExpectingErrors listener; |
| 274 CreateChannel(&listener); | 269 CreateChannel(&listener); |
| 275 ASSERT_TRUE(ConnectChannel()); | 270 ASSERT_TRUE(ConnectChannel()); |
| 276 | 271 |
| 277 // This matches a value in mojo/edk/system/constants.h | 272 // This matches a value in mojo/edk/system/constants.h |
| 278 const int kMaxMessageNumBytes = 4 * 1024 * 1024; | 273 const int kMaxMessageNumBytes = 4 * 1024 * 1024; |
| 279 std::string overly_large_data(kMaxMessageNumBytes, '*'); | 274 std::string overly_large_data(kMaxMessageNumBytes, '*'); |
| (...skipping 769 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1049 Connect(&listener); | 1044 Connect(&listener); |
| 1050 | 1045 |
| 1051 base::MessageLoop::current()->Run(); | 1046 base::MessageLoop::current()->Run(); |
| 1052 | 1047 |
| 1053 Close(); | 1048 Close(); |
| 1054 } | 1049 } |
| 1055 | 1050 |
| 1056 #endif // OS_LINUX | 1051 #endif // OS_LINUX |
| 1057 | 1052 |
| 1058 } // namespace | 1053 } // namespace |
| OLD | NEW |