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

Side by Side Diff: mojo/system/multiprocess_message_pipe_unittest.cc

Issue 475223002: Mojo: Add embedder::PlatformSupport and a simple implementation (and a bit of plumbing). (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 4 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 | Annotate | Revision Log
OLDNEW
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 <stdio.h> 6 #include <stdio.h>
7 #include <string.h> 7 #include <string.h>
8 8
9 #include <string> 9 #include <string>
10 #include <vector> 10 #include <vector>
11 11
12 #include "base/bind.h" 12 #include "base/bind.h"
13 #include "base/file_util.h" 13 #include "base/file_util.h"
14 #include "base/files/file_path.h" 14 #include "base/files/file_path.h"
15 #include "base/files/scoped_file.h" 15 #include "base/files/scoped_file.h"
16 #include "base/files/scoped_temp_dir.h" 16 #include "base/files/scoped_temp_dir.h"
17 #include "base/location.h" 17 #include "base/location.h"
18 #include "base/logging.h" 18 #include "base/logging.h"
19 #include "base/macros.h" 19 #include "base/macros.h"
20 #include "base/threading/platform_thread.h" // For |Sleep()|. 20 #include "base/threading/platform_thread.h" // For |Sleep()|.
21 #include "build/build_config.h" // TODO(vtl): Remove this. 21 #include "build/build_config.h" // TODO(vtl): Remove this.
22 #include "mojo/common/test/multiprocess_test_helper.h" 22 #include "mojo/common/test/multiprocess_test_helper.h"
23 #include "mojo/common/test/test_utils.h" 23 #include "mojo/common/test/test_utils.h"
24 #include "mojo/embedder/platform_shared_buffer.h" 24 #include "mojo/embedder/platform_shared_buffer.h"
25 #include "mojo/embedder/scoped_platform_handle.h" 25 #include "mojo/embedder/scoped_platform_handle.h"
26 #include "mojo/embedder/simple_platform_support.h"
26 #include "mojo/system/channel.h" 27 #include "mojo/system/channel.h"
27 #include "mojo/system/dispatcher.h" 28 #include "mojo/system/dispatcher.h"
28 #include "mojo/system/local_message_pipe_endpoint.h" 29 #include "mojo/system/local_message_pipe_endpoint.h"
29 #include "mojo/system/message_pipe.h" 30 #include "mojo/system/message_pipe.h"
30 #include "mojo/system/platform_handle_dispatcher.h" 31 #include "mojo/system/platform_handle_dispatcher.h"
31 #include "mojo/system/proxy_message_pipe_endpoint.h" 32 #include "mojo/system/proxy_message_pipe_endpoint.h"
32 #include "mojo/system/raw_channel.h" 33 #include "mojo/system/raw_channel.h"
33 #include "mojo/system/shared_buffer_dispatcher.h" 34 #include "mojo/system/shared_buffer_dispatcher.h"
34 #include "mojo/system/test_utils.h" 35 #include "mojo/system/test_utils.h"
35 #include "mojo/system/waiter.h" 36 #include "mojo/system/waiter.h"
(...skipping 384 matching lines...) Expand 10 before | Expand all | Expand 10 after
420 #endif 421 #endif
421 TEST_F(MultiprocessMessagePipeTest, MAYBE_SharedBufferPassing) { 422 TEST_F(MultiprocessMessagePipeTest, MAYBE_SharedBufferPassing) {
422 helper()->StartChild("CheckSharedBuffer"); 423 helper()->StartChild("CheckSharedBuffer");
423 424
424 scoped_refptr<MessagePipe> mp(new MessagePipe( 425 scoped_refptr<MessagePipe> mp(new MessagePipe(
425 scoped_ptr<MessagePipeEndpoint>(new LocalMessagePipeEndpoint()), 426 scoped_ptr<MessagePipeEndpoint>(new LocalMessagePipeEndpoint()),
426 scoped_ptr<MessagePipeEndpoint>(new ProxyMessagePipeEndpoint()))); 427 scoped_ptr<MessagePipeEndpoint>(new ProxyMessagePipeEndpoint())));
427 Init(mp); 428 Init(mp);
428 429
429 // Make a shared buffer. 430 // Make a shared buffer.
431 embedder::SimplePlatformSupport platform_support;
430 scoped_refptr<SharedBufferDispatcher> dispatcher; 432 scoped_refptr<SharedBufferDispatcher> dispatcher;
431 EXPECT_EQ( 433 EXPECT_EQ(MOJO_RESULT_OK,
432 MOJO_RESULT_OK, 434 SharedBufferDispatcher::Create(
433 SharedBufferDispatcher::Create( 435 &platform_support,
434 SharedBufferDispatcher::kDefaultCreateOptions, 100, &dispatcher)); 436 SharedBufferDispatcher::kDefaultCreateOptions,
437 100,
438 &dispatcher));
435 ASSERT_TRUE(dispatcher); 439 ASSERT_TRUE(dispatcher);
436 440
437 // Make a mapping. 441 // Make a mapping.
438 scoped_ptr<embedder::PlatformSharedBufferMapping> mapping; 442 scoped_ptr<embedder::PlatformSharedBufferMapping> mapping;
439 EXPECT_EQ(MOJO_RESULT_OK, 443 EXPECT_EQ(MOJO_RESULT_OK,
440 dispatcher->MapBuffer(0, 100, MOJO_MAP_BUFFER_FLAG_NONE, &mapping)); 444 dispatcher->MapBuffer(0, 100, MOJO_MAP_BUFFER_FLAG_NONE, &mapping));
441 ASSERT_TRUE(mapping); 445 ASSERT_TRUE(mapping);
442 ASSERT_TRUE(mapping->GetBase()); 446 ASSERT_TRUE(mapping->GetBase());
443 ASSERT_EQ(100u, mapping->GetLength()); 447 ASSERT_EQ(100u, mapping->GetLength());
444 448
(...skipping 174 matching lines...) Expand 10 before | Expand all | Expand 10 after
619 EXPECT_EQ(0u, hss.satisfiable_signals); 623 EXPECT_EQ(0u, hss.satisfiable_signals);
620 624
621 mp->Close(0); 625 mp->Close(0);
622 626
623 EXPECT_EQ(0, helper()->WaitForChildShutdown()); 627 EXPECT_EQ(0, helper()->WaitForChildShutdown());
624 } 628 }
625 629
626 } // namespace 630 } // namespace
627 } // namespace system 631 } // namespace system
628 } // namespace mojo 632 } // namespace mojo
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698