[Android] Implement 3-way sensor fallback for Device Orientation.
[chromium-blink-merge.git] / content / public / test / test_browser_thread.h
blobd3a256474e36c40814ab9037a8def9c10a39ba2f
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.
5 #ifndef CONTENT_PUBLIC_TEST_TEST_BROWSER_THREAD_H_
6 #define CONTENT_PUBLIC_TEST_TEST_BROWSER_THREAD_H_
8 #include "base/basictypes.h"
9 #include "base/memory/scoped_ptr.h"
10 #include "content/public/browser/browser_thread.h"
12 namespace base {
13 class MessageLoop;
14 class Thread;
17 namespace content {
19 class TestBrowserThreadImpl;
21 // DEPRECATED: use TestBrowserThreadBundle instead. See http://crbug.com/272091
22 // A BrowserThread for unit tests; this lets unit tests in chrome/ create
23 // BrowserThread instances.
24 class TestBrowserThread {
25 public:
26 explicit TestBrowserThread(BrowserThread::ID identifier);
27 TestBrowserThread(BrowserThread::ID identifier,
28 base::MessageLoop* message_loop);
29 ~TestBrowserThread();
31 // We provide a subset of the capabilities of the Thread interface
32 // to enable certain unit tests. To avoid a stronger dependency of
33 // the internals of BrowserThread, we do not provide the full Thread
34 // interface.
36 // Starts the thread with a generic message loop.
37 bool Start();
39 // Starts the thread with a generic message loop and waits for the
40 // thread to run.
41 bool StartAndWaitForTesting();
43 // Starts the thread with an IOThread message loop.
44 bool StartIOThread();
46 // Stops the thread.
47 void Stop();
49 // Returns true if the thread is running.
50 bool IsRunning();
52 // Returns a Thread pointer for the thread. This should not be used
53 // in new tests.
54 base::Thread* DeprecatedGetThreadObject();
56 private:
57 scoped_ptr<TestBrowserThreadImpl> impl_;
59 DISALLOW_COPY_AND_ASSIGN(TestBrowserThread);
62 } // namespace content
64 #endif // CONTENT_PUBLIC_TEST_TEST_BROWSER_THREAD_H_