transport: pass correct channel
[abstract.git] / xpunit / nsTestRunner.h
blob2e0448c742a0f70170288d0eda31768001d9a653
1 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
2 /* vim:set ts=2 sw=2 sts=2 et cindent tw=79 ft=cpp: */
3 /*
4 * Copyright (C) 2007 Sergey Yanovich <ynvich@gmail.com>
6 * This program is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU General Public License as
8 * published by the Free Software Foundation; either version 2 of the
9 * License, or (at your option) any later version.
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * General Public License for more details.
16 * You should have received a copy of the GNU General Public
17 * License along with this program; if not, write to the
18 * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
19 * Boston, MA 02111-1307, USA.
22 #ifndef NSTESTRUNNER_H
23 #define NSTESTRUNNER_H 1
25 #include "nsStringAPI.h"
27 #define NS_TESTRUNNER_CID \
28 {0xda0c516d, 0x0531, 0x4429, {0xb8, 0x28, 0xa7, 0xaf, 0xbf, 0xfc, 0x6e, 0x35}}
30 #include "nsIConsoleListener.h"
31 #include "nsIWebProgressListener.h"
32 #include "nsWeakReference.h"
33 #include "nsITimer.h"
34 #include "nsICommandLineHandler.h"
35 #include "nsDeque.h"
36 #include "nsITestRunner.h"
37 #include "nsICompareListener.h"
39 class nsITestResult;
40 class nsIDOMWindow;
41 class nsITimer;
42 class nsIRDFDataSource;
43 class nsIThreadJSContextStack;
45 class nsTestRunner: public nsITestRunner,
46 public nsIConsoleListener,
47 public nsIWebProgressListener,
48 public nsSupportsWeakReference,
49 public nsITimerCallback,
50 public nsICommandLineHandler,
51 public nsICompareListener
53 public:
54 virtual ~nsTestRunner();
55 NS_DECL_ISUPPORTS
56 NS_DECL_NSITESTRUNNER
57 NS_DECL_NSICONSOLELISTENER
58 NS_DECL_NSIWEBPROGRESSLISTENER
59 NS_DECL_NSITIMERCALLBACK
60 NS_DECL_NSICOMMANDLINEHANDLER
61 NS_DECL_NSICOMPARELISTENER
62 NS_DECLARE_STATIC_IID_ACCESSOR(NS_TESTRUNNER_CID)
64 operator nsISupports * () { return (nsITestRunner*) this; }
65 static nsTestRunner* GetTestRunner();
66 nsresult resolve(nsACString &aURL, const PRUnichar* *result);
67 private:
68 nsTestRunner();
69 static nsTestRunner* gTestRunner;
70 friend class nsSelfTest;
72 nsresult openMainWindow();
73 void run();
74 nsresult init();
75 nsresult pushTest(const char *aContractID);
76 nsresult getNextTest(nsACString &aContractID);
77 void traverse();
78 nsresult closeMainWindow();
79 void done();
80 nsresult registerXmlTests();
82 nsCOMPtr<nsITestResult> mTestResult;
83 nsCAutoString mTestID;
84 nsDeque mTestTree;
85 nsCOMPtr<nsIDOMWindow> mTestWindow;
86 nsCOMPtr<nsIDOMWindow> mWatchWindow;
87 nsCOMPtr<nsITimer> mTimer;
88 nsCOMPtr<nsIRDFDataSource> mFileMap;
89 nsCOMPtr<nsIThreadJSContextStack> mJSStack;
90 nsCOMPtr<nsIURI> mCompareURI;
91 const char* mCompareFile;
92 PRUint32 mCompareLine;
93 PRPackedBool mArmed;
94 PRPackedBool mHasWindow;
95 };
97 NS_DEFINE_STATIC_IID_ACCESSOR(nsTestRunner, NS_TESTRUNNER_CID)
98 #endif /* ! NSTESTRUNNER_H */