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"
11 class TestWebThreadImpl
: public WebThreadImpl
{
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(); }
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() {
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() {
51 bool TestWebThread::IsRunning() {
52 return impl_
->IsRunning();