Merge Chromium + Blink git repositories
[chromium-blink-merge.git] / ios / web / test / test_web_thread.cc
blob06322bd00b9e059ea30e6ea587ab7c03e950d9b1
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.
5 #include "ios/web/public/test/test_web_thread.h"
7 #include "ios/web/web_thread_impl.h"
9 namespace web {
11 class TestWebThreadImpl : public WebThreadImpl {
12 public:
13 TestWebThreadImpl(WebThread::ID identifier) : WebThreadImpl(identifier) {}
15 TestWebThreadImpl(WebThread::ID identifier, base::MessageLoop* message_loop)
16 : WebThreadImpl(identifier, message_loop) {}
18 ~TestWebThreadImpl() override { Stop(); }
20 private:
21 DISALLOW_COPY_AND_ASSIGN(TestWebThreadImpl);
24 TestWebThread::TestWebThread(WebThread::ID identifier)
25 : impl_(new TestWebThreadImpl(identifier)) {
28 TestWebThread::TestWebThread(WebThread::ID identifier,
29 base::MessageLoop* message_loop)
30 : impl_(new TestWebThreadImpl(identifier, message_loop)) {
33 TestWebThread::~TestWebThread() {
34 Stop();
37 bool TestWebThread::Start() {
38 return impl_->Start();
41 bool TestWebThread::StartIOThread() {
42 base::Thread::Options options;
43 options.message_loop_type = base::MessageLoop::TYPE_IO;
44 return impl_->StartWithOptions(options);
47 void TestWebThread::Stop() {
48 impl_->Stop();
51 bool TestWebThread::IsRunning() {
52 return impl_->IsRunning();
55 } // namespace web