| 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 "base/lazy_instance.h" | 5 #include "base/lazy_instance.h" |
| 6 #include "base/run_loop.h" | 6 #include "base/run_loop.h" |
| 7 #include "ipc/ipc_perftest_support.h" | 7 #include "ipc/ipc_perftest_support.h" |
| 8 #include "ipc/mojo/ipc_channel_mojo.h" | 8 #include "ipc/mojo/ipc_channel_mojo.h" |
| 9 |
| 10 #if defined(USE_CHROME_EDK) |
| 11 #include "mojo/edk/embedder/platform_channel_pair.h" |
| 12 #include "mojo/edk/embedder/test_embedder.h" |
| 13 #else |
| 14 #include "third_party/mojo/src/mojo/edk/embedder/platform_channel_pair.h" |
| 9 #include "third_party/mojo/src/mojo/edk/embedder/test_embedder.h" | 15 #include "third_party/mojo/src/mojo/edk/embedder/test_embedder.h" |
| 16 #endif |
| 10 | 17 |
| 11 namespace { | 18 namespace { |
| 12 | 19 |
| 13 // This is needed because we rely on //base/test:test_support_perf and | 20 // This is needed because we rely on //base/test:test_support_perf and |
| 14 // it provides main() which doesn't have Mojo initialization. We need | 21 // it provides main() which doesn't have Mojo initialization. We need |
| 15 // some way to call InitWithSimplePlatformSupport() only once before | 22 // some way to call InitWithSimplePlatformSupport() only once before |
| 16 // using Mojo. | 23 // using Mojo. |
| 17 struct MojoInitialier { | 24 struct MojoInitialier { |
| 18 MojoInitialier() { | 25 MojoInitialier() { |
| 19 mojo::embedder::test::InitWithSimplePlatformSupport(); | 26 mojo::embedder::test::InitWithSimplePlatformSupport(); |
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 58 run_loop.RunUntilIdle(); | 65 run_loop.RunUntilIdle(); |
| 59 } | 66 } |
| 60 | 67 |
| 61 TEST_F(MojoChannelPerfTest, ChannelProxyPingPong) { | 68 TEST_F(MojoChannelPerfTest, ChannelProxyPingPong) { |
| 62 RunTestChannelProxyPingPong(GetDefaultTestParams()); | 69 RunTestChannelProxyPingPong(GetDefaultTestParams()); |
| 63 | 70 |
| 64 base::RunLoop run_loop; | 71 base::RunLoop run_loop; |
| 65 run_loop.RunUntilIdle(); | 72 run_loop.RunUntilIdle(); |
| 66 } | 73 } |
| 67 | 74 |
| 75 |
| 76 TEST_F(MojoChannelPerfTest, DISABLED_MaxChannelCount) { |
| 77 #if defined(OS_POSIX) |
| 78 LOG(INFO) << "base::GetMaxFds " << base::GetMaxFds(); |
| 79 base::SetFdLimit(20000); |
| 80 #endif |
| 81 |
| 82 std::vector<mojo::embedder::PlatformChannelPair*> channels; |
| 83 for (size_t i = 0; i < 10000; ++i) { |
| 84 LOG(INFO) << "channels size: " << channels.size(); |
| 85 channels.push_back(new mojo::embedder::PlatformChannelPair()); |
| 86 } |
| 87 } |
| 88 |
| 68 class MojoTestClient : public IPC::test::PingPongTestClient { | 89 class MojoTestClient : public IPC::test::PingPongTestClient { |
| 69 public: | 90 public: |
| 70 typedef IPC::test::PingPongTestClient SuperType; | 91 typedef IPC::test::PingPongTestClient SuperType; |
| 71 | 92 |
| 72 MojoTestClient(); | 93 MojoTestClient(); |
| 73 | 94 |
| 74 scoped_ptr<IPC::Channel> CreateChannel(IPC::Listener* listener) override; | 95 scoped_ptr<IPC::Channel> CreateChannel(IPC::Listener* listener) override; |
| 75 }; | 96 }; |
| 76 | 97 |
| 77 MojoTestClient::MojoTestClient() { | 98 MojoTestClient::MojoTestClient() { |
| (...skipping 11 matching lines...) Expand all Loading... |
| 89 MojoTestClient client; | 110 MojoTestClient client; |
| 90 int rv = client.RunMain(); | 111 int rv = client.RunMain(); |
| 91 | 112 |
| 92 base::RunLoop run_loop; | 113 base::RunLoop run_loop; |
| 93 run_loop.RunUntilIdle(); | 114 run_loop.RunUntilIdle(); |
| 94 | 115 |
| 95 return rv; | 116 return rv; |
| 96 } | 117 } |
| 97 | 118 |
| 98 } // namespace | 119 } // namespace |
| OLD | NEW |