IDB: Make readonly transactions wait for earlier readwrite transactions
[chromium-blink-merge.git] / content / public / test / test_browser_thread.h
blob2428bbb66ba729f3a61c33056d3d0a581ff5957b
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 an IOThread message loop.
40 bool StartIOThread();
42 // Stops the thread.
43 void Stop();
45 // Returns true if the thread is running.
46 bool IsRunning();
48 // Returns a Thread pointer for the thread. This should not be used
49 // in new tests.
50 base::Thread* DeprecatedGetThreadObject();
52 private:
53 scoped_ptr<TestBrowserThreadImpl> impl_;
55 DISALLOW_COPY_AND_ASSIGN(TestBrowserThread);
58 } // namespace content
60 #endif // CONTENT_PUBLIC_TEST_TEST_BROWSER_THREAD_H_