summaryrefslogtreecommitdiffstats
path: root/chrome/test/thread_test_helper.h
diff options
context:
space:
mode:
authorerg@google.com <erg@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2011-02-11 20:44:42 +0000
committererg@google.com <erg@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2011-02-11 20:44:42 +0000
commit5322a7f16a374a15fe69b3bb2621678aede48bca (patch)
tree56c8ee955ed32cd69f8b3395cb609dcdd504e58c /chrome/test/thread_test_helper.h
parent192a05f2e4d8f66d095227439d4dce7bb14b16b5 (diff)
downloadchromium_src-5322a7f16a374a15fe69b3bb2621678aede48bca.zip
chromium_src-5322a7f16a374a15fe69b3bb2621678aede48bca.tar.gz
chromium_src-5322a7f16a374a15fe69b3bb2621678aede48bca.tar.bz2
Continuing with the out-of-lining of test code.
BUG=none TEST=compiles Review URL: http://codereview.chromium.org/6485015 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@74660 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/test/thread_test_helper.h')
-rw-r--r--chrome/test/thread_test_helper.h25
1 files changed, 6 insertions, 19 deletions
diff --git a/chrome/test/thread_test_helper.h b/chrome/test/thread_test_helper.h
index 93960e1..a0dd78a 100644
--- a/chrome/test/thread_test_helper.h
+++ b/chrome/test/thread_test_helper.h
@@ -6,6 +6,7 @@
#define CHROME_TEST_THREAD_TEST_HELPER_H_
#pragma once
+#include "base/compiler_specific.h"
#include "base/ref_counted.h"
#include "base/synchronization/waitable_event.h"
#include "chrome/browser/browser_thread.h"
@@ -17,37 +18,23 @@
// executed.
class ThreadTestHelper : public base::RefCountedThreadSafe<ThreadTestHelper> {
public:
- explicit ThreadTestHelper(BrowserThread::ID thread_id)
- : test_result_(false),
- thread_id_(thread_id),
- done_event_(false, false) {
- }
+ explicit ThreadTestHelper(BrowserThread::ID thread_id);
// True if RunTest() was successfully executed on the target thread.
- bool Run() WARN_UNUSED_RESULT {
- if (!BrowserThread::PostTask(thread_id_, FROM_HERE, NewRunnableMethod(
- this, &ThreadTestHelper::RunInThread))) {
- return false;
- }
- done_event_.Wait();
- return test_result_;
- }
+ bool Run() WARN_UNUSED_RESULT;
- virtual void RunTest() { set_test_result(true); }
+ virtual void RunTest();
protected:
friend class base::RefCountedThreadSafe<ThreadTestHelper>;
- virtual ~ThreadTestHelper() {}
+ virtual ~ThreadTestHelper();
// Use this method to store the result of RunTest().
void set_test_result(bool test_result) { test_result_ = test_result; }
private:
- void RunInThread() {
- RunTest();
- done_event_.Signal();
- }
+ void RunInThread();
bool test_result_;
BrowserThread::ID thread_id_;