nicholss | b34c0f6 | 2016-03-14 15:41:03 | [diff] [blame] | 1 | // Copyright (c) 2016 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/client/chromoting_client_runtime.h" |
| 9 | #include "testing/gtest/include/gtest/gtest.h" |
| 10 | |
| 11 | namespace remoting { |
| 12 | |
| 13 | #if defined(OS_IOS) || defined(OS_ANDROID) |
| 14 | |
| 15 | // A simple test that starts and stop the runtime. This tests the runtime |
| 16 | // operates properly and all threads and message loops are valid. |
| 17 | TEST(ChromotingClientRuntimeTest, StartAndStop) { |
| 18 | scoped_ptr<base::MessageLoopForUI> ui_loop; |
| 19 | ui_loop.reset(new base::MessageLoopForUI()); |
| 20 | #if defined(OS_IOS) |
| 21 | ui_loop->Attach(); |
| 22 | #elif defined(OS_ANDROID) |
| 23 | ui_loop->Start(); |
| 24 | #endif |
| 25 | |
| 26 | scoped_ptr<ChromotingClientRuntime> runtime = |
| 27 | ChromotingClientRuntime::Create(ui_loop.get()); |
| 28 | |
| 29 | ASSERT_TRUE(runtime); |
| 30 | EXPECT_TRUE(runtime->network_task_runner().get()); |
| 31 | EXPECT_TRUE(runtime->ui_task_runner().get()); |
| 32 | EXPECT_TRUE(runtime->display_task_runner().get()); |
| 33 | EXPECT_TRUE(runtime->file_task_runner().get()); |
| 34 | EXPECT_TRUE(runtime->url_requester().get()); |
| 35 | } |
| 36 | |
| 37 | #endif |
| 38 | |
| 39 | } // namespace remoting |