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

Side by Side Diff: mojo/edk/test/multiprocess_test_helper_unittest.cc

Issue 728783003: Add infrastructure to run tests on android. (Closed) Base URL: https://github.com/domokit/mojo.git@master
Patch Set: Do not introduce IsInitialzed() Created 6 years, 1 month 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
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 "mojo/edk/test/multiprocess_test_helper.h" 5 #include "mojo/edk/test/multiprocess_test_helper.h"
6 6
7 #include "base/logging.h" 7 #include "base/logging.h"
8 #include "build/build_config.h" 8 #include "build/build_config.h"
9 #include "mojo/edk/embedder/scoped_platform_handle.h" 9 #include "mojo/edk/embedder/scoped_platform_handle.h"
10 #include "mojo/edk/embedder/test_embedder.h"
10 #include "mojo/edk/test/test_utils.h" 11 #include "mojo/edk/test/test_utils.h"
11 #include "testing/gtest/include/gtest/gtest.h" 12 #include "testing/gtest/include/gtest/gtest.h"
12 13
13 #if defined(OS_POSIX) 14 #if defined(OS_POSIX)
14 #include <fcntl.h> 15 #include <fcntl.h>
15 #endif 16 #endif
16 17
17 namespace mojo { 18 namespace mojo {
18 namespace test { 19 namespace test {
19 namespace { 20 namespace {
(...skipping 13 matching lines...) Expand all
33 BlockingWrite(handle, &c, 1, &bytes_written); 34 BlockingWrite(handle, &c, 1, &bytes_written);
34 return bytes_written == 1; 35 return bytes_written == 1;
35 } 36 }
36 37
37 bool ReadByte(const embedder::PlatformHandle& handle, char* c) { 38 bool ReadByte(const embedder::PlatformHandle& handle, char* c) {
38 size_t bytes_read = 0; 39 size_t bytes_read = 0;
39 BlockingRead(handle, c, 1, &bytes_read); 40 BlockingRead(handle, c, 1, &bytes_read);
40 return bytes_read == 1; 41 return bytes_read == 1;
41 } 42 }
42 43
43 typedef testing::Test MultiprocessTestHelperTest; 44 class MultiprocessTestHelperTest : public testing::Test {
45 public:
46 void SetUp() override { embedder::test::InitWithSimplePlatformSupport(); }
47
48 void TearDown() override { EXPECT_TRUE(embedder::test::Shutdown()); }
49 };
44 50
45 TEST_F(MultiprocessTestHelperTest, RunChild) { 51 TEST_F(MultiprocessTestHelperTest, RunChild) {
46 MultiprocessTestHelper helper; 52 MultiprocessTestHelper helper;
47 EXPECT_TRUE(helper.server_platform_handle.is_valid()); 53 EXPECT_TRUE(helper.server_platform_handle.is_valid());
48 54
49 helper.StartChild("RunChild"); 55 helper.StartChild("RunChild");
50 EXPECT_EQ(123, helper.WaitForChildShutdown()); 56 EXPECT_EQ(123, helper.WaitForChildShutdown());
51 } 57 }
52 58
53 MOJO_MULTIPROCESS_TEST_CHILD_MAIN(RunChild) { 59 MOJO_MULTIPROCESS_TEST_CHILD_MAIN(RunChild) {
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after
149 EXPECT_FALSE(MultiprocessTestHelper::client_platform_handle.is_valid()) 155 EXPECT_FALSE(MultiprocessTestHelper::client_platform_handle.is_valid())
150 << "DISREGARD: Expected failure #1 in child process"; 156 << "DISREGARD: Expected failure #1 in child process";
151 EXPECT_FALSE( 157 EXPECT_FALSE(
152 IsNonBlocking(MultiprocessTestHelper::client_platform_handle.get())) 158 IsNonBlocking(MultiprocessTestHelper::client_platform_handle.get()))
153 << "DISREGARD: Expected failure #2 in child process"; 159 << "DISREGARD: Expected failure #2 in child process";
154 } 160 }
155 161
156 } // namespace 162 } // namespace
157 } // namespace test 163 } // namespace test
158 } // namespace mojo 164 } // namespace mojo
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698