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

Side by Side Diff: mojo/edk/embedder/embedder_unittest.cc

Issue 1351293002: Convert remaining scoped_ptr -> std::unique_ptr in //mojo/edk (minus js). (Closed) Base URL: https://github.com/domokit/mojo.git@edk_unique_ptr_5
Patch Set: oops, forgot to fix android Created 5 years, 3 months 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 | « mojo/edk/embedder/embedder.cc ('k') | mojo/edk/embedder/platform_channel_pair.h » ('j') | 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 "mojo/edk/embedder/embedder.h" 5 #include "mojo/edk/embedder/embedder.h"
6 6
7 #include <string.h> 7 #include <string.h>
8 8
9 #include <memory>
10
9 #include "base/bind.h" 11 #include "base/bind.h"
10 #include "base/command_line.h" 12 #include "base/command_line.h"
11 #include "base/location.h" 13 #include "base/location.h"
12 #include "base/logging.h" 14 #include "base/logging.h"
13 #include "base/message_loop/message_loop.h" 15 #include "base/message_loop/message_loop.h"
14 #include "base/synchronization/waitable_event.h" 16 #include "base/synchronization/waitable_event.h"
15 #include "base/test/test_timeouts.h" 17 #include "base/test/test_timeouts.h"
16 #include "mojo/edk/embedder/platform_channel_pair.h" 18 #include "mojo/edk/embedder/platform_channel_pair.h"
17 #include "mojo/edk/embedder/test_embedder.h" 19 #include "mojo/edk/embedder/test_embedder.h"
18 #include "mojo/edk/system/mutex.h" 20 #include "mojo/edk/system/mutex.h"
(...skipping 428 matching lines...) Expand 10 before | Expand all | Expand 10 after
447 FROM_HERE, 449 FROM_HERE,
448 base::Bind(&DestroyChannelOnIOThread, base::Unretained(channel_info))); 450 base::Bind(&DestroyChannelOnIOThread, base::Unretained(channel_info)));
449 } 451 }
450 452
451 TEST_F(EmbedderTest, ChannelShutdownRace_MessagePipeClose) { 453 TEST_F(EmbedderTest, ChannelShutdownRace_MessagePipeClose) {
452 const size_t kIterations = 1000; 454 const size_t kIterations = 1000;
453 mojo::test::ScopedIPCSupport ipc_support(test_io_task_runner()); 455 mojo::test::ScopedIPCSupport ipc_support(test_io_task_runner());
454 456
455 for (size_t i = 0; i < kIterations; i++) { 457 for (size_t i = 0; i < kIterations; i++) {
456 PlatformChannelPair channel_pair; 458 PlatformChannelPair channel_pair;
457 scoped_ptr<ScopedTestChannel> server_channel( 459 std::unique_ptr<ScopedTestChannel> server_channel(
458 new ScopedTestChannel(channel_pair.PassServerHandle())); 460 new ScopedTestChannel(channel_pair.PassServerHandle()));
459 server_channel->WaitForChannelCreationCompletion(); 461 server_channel->WaitForChannelCreationCompletion();
460 server_channel->NoWaitOnShutdown(); 462 server_channel->NoWaitOnShutdown();
461 463
462 MojoHandle server_mp = server_channel->bootstrap_message_pipe(); 464 MojoHandle server_mp = server_channel->bootstrap_message_pipe();
463 EXPECT_NE(server_mp, MOJO_HANDLE_INVALID); 465 EXPECT_NE(server_mp, MOJO_HANDLE_INVALID);
464 466
465 // Race between channel shutdown and closing a message pipe. The message 467 // Race between channel shutdown and closing a message pipe. The message
466 // pipe doesn't have to be the bootstrap pipe. It just has to be bound to 468 // pipe doesn't have to be the bootstrap pipe. It just has to be bound to
467 // the channel. 469 // the channel.
(...skipping 315 matching lines...) Expand 10 before | Expand all | Expand 10 after
783 785
784 EXPECT_TRUE(test::Shutdown()); 786 EXPECT_TRUE(test::Shutdown());
785 } 787 }
786 788
787 // TODO(vtl): Test immediate write & close. 789 // TODO(vtl): Test immediate write & close.
788 // TODO(vtl): Test broken-connection cases. 790 // TODO(vtl): Test broken-connection cases.
789 791
790 } // namespace 792 } // namespace
791 } // namespace embedder 793 } // namespace embedder
792 } // namespace mojo 794 } // namespace mojo
OLDNEW
« no previous file with comments | « mojo/edk/embedder/embedder.cc ('k') | mojo/edk/embedder/platform_channel_pair.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698