QUIC - cleanup changes to sync chromium tree with internal source.
[chromium-blink-merge.git] / ios / web / public / test / test_web_thread.h
blob4ad9eb705c806b16db93a76aebaad0c6d5dbc290
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 #ifndef IOS_WEB_PUBLIC_TEST_TEST_WEB_THREAD_H_
6 #define IOS_WEB_PUBLIC_TEST_TEST_WEB_THREAD_H_
8 #include "base/macros.h"
9 #include "base/memory/scoped_ptr.h"
10 #include "ios/web/public/web_thread.h"
12 namespace base {
13 class MessageLoop;
16 namespace web {
18 class TestWebThreadImpl;
20 // DEPRECATED: use TestWebThreadBundle instead.
21 // A WebThread for unit tests; this lets unit tests outside of web create
22 // WebThread instances.
23 class TestWebThread {
24 public:
25 explicit TestWebThread(WebThread::ID identifier);
26 TestWebThread(WebThread::ID identifier, base::MessageLoop* message_loop);
28 ~TestWebThread();
30 // Provides a subset of the capabilities of the Thread interface to enable
31 // certain unit tests. To avoid a stronger dependency of the internals of
32 // WebThread, do no provide the full Thread interface.
34 // Starts the thread with a generic message loop.
35 bool Start();
37 // Starts the thread with an IOThread message loop.
38 bool StartIOThread();
40 // Stops the thread.
41 void Stop();
43 // Returns true if the thread is running.
44 bool IsRunning();
46 private:
47 scoped_ptr<TestWebThreadImpl> impl_;
49 DISALLOW_COPY_AND_ASSIGN(TestWebThread);
52 } // namespace web
54 #endif // IOS_WEB_PUBLIC_TEST_TEST_WEB_THREAD_H_