| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 <stdint.h> | 5 #include <stdint.h> |
| 6 #include <string.h> | 6 #include <string.h> |
| 7 | 7 |
| 8 #include "base/memory/ref_counted.h" | 8 #include "base/memory/ref_counted.h" |
| 9 #include "mojo/edk/system/test_utils.h" | 9 #include "mojo/edk/system/test_utils.h" |
| 10 #include "mojo/edk/test/mojo_test_base.h" | 10 #include "mojo/edk/test/mojo_test_base.h" |
| (...skipping 688 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 699 EXPECT_EQ(MOJO_RESULT_INVALID_ARGUMENT, MojoClose(b)); | 699 EXPECT_EQ(MOJO_RESULT_INVALID_ARGUMENT, MojoClose(b)); |
| 700 EXPECT_EQ(MOJO_RESULT_INVALID_ARGUMENT, MojoClose(c)); | 700 EXPECT_EQ(MOJO_RESULT_INVALID_ARGUMENT, MojoClose(c)); |
| 701 | 701 |
| 702 EXPECT_EQ(kTestMessage, ReadMessage(d)); | 702 EXPECT_EQ(kTestMessage, ReadMessage(d)); |
| 703 EXPECT_EQ(MOJO_RESULT_OK, MojoWait(d, MOJO_HANDLE_SIGNAL_PEER_CLOSED, | 703 EXPECT_EQ(MOJO_RESULT_OK, MojoWait(d, MOJO_HANDLE_SIGNAL_PEER_CLOSED, |
| 704 MOJO_DEADLINE_INDEFINITE, nullptr)); | 704 MOJO_DEADLINE_INDEFINITE, nullptr)); |
| 705 | 705 |
| 706 EXPECT_EQ(MOJO_RESULT_OK, MojoClose(d)); | 706 EXPECT_EQ(MOJO_RESULT_OK, MojoClose(d)); |
| 707 } | 707 } |
| 708 | 708 |
| 709 TEST_F(MessagePipeTest, ClosePipesStressTest) { |
| 710 // Stress test to exercise https://crbug.com/665869. |
| 711 const size_t kNumPipes = 100000; |
| 712 for (size_t i = 0; i < kNumPipes; ++i) { |
| 713 MojoHandle a, b; |
| 714 CreateMessagePipe(&a, &b); |
| 715 MojoClose(a); |
| 716 MojoClose(b); |
| 717 } |
| 718 } |
| 719 |
| 709 } // namespace | 720 } // namespace |
| 710 } // namespace edk | 721 } // namespace edk |
| 711 } // namespace mojo | 722 } // namespace mojo |
| OLD | NEW |