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

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

Issue 728783003: Add infrastructure to run tests on android. (Closed) Base URL: https://github.com/domokit/mojo.git@master
Patch Set: Use file_hash 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
(Empty)
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
3 // found in the LICENSE file.
4
5 #include "mojo/edk/embedder/embedder_test_util.h"
6
7 #include "base/bind.h"
8 #include "mojo/edk/embedder/embedder.h"
9
10 namespace mojo {
11 namespace embedder {
12
13 ScopedTestChannel::ScopedTestChannel(
14 scoped_refptr<base::TaskRunner> io_thread_task_runner,
15 ScopedPlatformHandle platform_handle)
16 : io_thread_task_runner_(io_thread_task_runner),
17 bootstrap_message_pipe_(MOJO_HANDLE_INVALID),
18 did_create_channel_event_(true, false),
19 channel_info_(nullptr) {
20 bootstrap_message_pipe_ =
21 CreateChannel(platform_handle.Pass(), io_thread_task_runner_,
22 base::Bind(&ScopedTestChannel::DidCreateChannel,
23 base::Unretained(this)),
24 nullptr)
25 .release()
26 .value();
27 CHECK_NE(bootstrap_message_pipe_, MOJO_HANDLE_INVALID);
28 }
29
30 ScopedTestChannel::~ScopedTestChannel() {
31 DestroyChannel(channel_info_);
32 }
33
34 void ScopedTestChannel::WaitForChannelCreationCompletion() {
35 did_create_channel_event_.Wait();
36 }
37
38 void ScopedTestChannel::DidCreateChannel(ChannelInfo* channel_info) {
39 CHECK(channel_info);
40 CHECK(!channel_info_);
41 channel_info_ = channel_info;
42 did_create_channel_event_.Signal();
43 }
44
45 EmbedderTest::EmbedderTest() : test_io_thread_(base::TestIOThread::kAutoStart) {
46 }
47
48 EmbedderTest::~EmbedderTest() {
49 }
50
51 } // namespace embedder
52 } // namespace mojo
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698