1// Copyright (c) 2012 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 "base/message_loop/message_loop.h"
6#include "base/run_loop.h"
7#include "remoting/base/auto_thread_task_runner.h"
8#include "remoting/host/chromoting_host_context.h"
9#include "testing/gtest/include/gtest/gtest.h"
10
11namespace remoting {
12
13// A simple test that starts and stop the context. This tests the context
14// operates properly and all threads and message loops are valid.
15TEST(ChromotingHostContextTest, StartAndStop) {
16  base::MessageLoopForUI message_loop;
17  base::RunLoop run_loop;
18
19  scoped_ptr<ChromotingHostContext> context =
20      ChromotingHostContext::Create(new AutoThreadTaskRunner(
21      message_loop.message_loop_proxy(), run_loop.QuitClosure()));
22
23  EXPECT_TRUE(context);
24  if (!context)
25    return;
26  EXPECT_TRUE(context->audio_task_runner().get());
27  EXPECT_TRUE(context->video_capture_task_runner().get());
28  EXPECT_TRUE(context->video_encode_task_runner().get());
29  EXPECT_TRUE(context->file_task_runner().get());
30  EXPECT_TRUE(context->input_task_runner().get());
31  EXPECT_TRUE(context->network_task_runner().get());
32  EXPECT_TRUE(context->ui_task_runner().get());
33
34  context.reset();
35  run_loop.Run();
36}
37
38}  // namespace remoting
39