author | John Kern <johnk@symbian.org> |
Wed, 12 May 2010 11:54:19 -0700 | |
changeset 18 | 5707b75503d5 |
permissions | -rw-r--r-- |
18
5707b75503d5
working on test for common siging test
John Kern <johnk@symbian.org>
parents:
diff
changeset
|
1 |
#ifndef SIGNINGCOMMONCASE_H |
5707b75503d5
working on test for common siging test
John Kern <johnk@symbian.org>
parents:
diff
changeset
|
2 |
#define SIGNINGCOMMONCASE_H |
5707b75503d5
working on test for common siging test
John Kern <johnk@symbian.org>
parents:
diff
changeset
|
3 |
|
5707b75503d5
working on test for common siging test
John Kern <johnk@symbian.org>
parents:
diff
changeset
|
4 |
#include <QObject> |
5707b75503d5
working on test for common siging test
John Kern <johnk@symbian.org>
parents:
diff
changeset
|
5 |
#include <QtCore/QUrl> |
5707b75503d5
working on test for common siging test
John Kern <johnk@symbian.org>
parents:
diff
changeset
|
6 |
|
5707b75503d5
working on test for common siging test
John Kern <johnk@symbian.org>
parents:
diff
changeset
|
7 |
#include <QtDebug> |
5707b75503d5
working on test for common siging test
John Kern <johnk@symbian.org>
parents:
diff
changeset
|
8 |
|
5707b75503d5
working on test for common siging test
John Kern <johnk@symbian.org>
parents:
diff
changeset
|
9 |
#include <QtNetwork/QNetworkAccessManager> |
5707b75503d5
working on test for common siging test
John Kern <johnk@symbian.org>
parents:
diff
changeset
|
10 |
#include <QtNetwork/QNetworkReply> |
5707b75503d5
working on test for common siging test
John Kern <johnk@symbian.org>
parents:
diff
changeset
|
11 |
#include <QtNetwork/QNetworkRequest> |
5707b75503d5
working on test for common siging test
John Kern <johnk@symbian.org>
parents:
diff
changeset
|
12 |
|
5707b75503d5
working on test for common siging test
John Kern <johnk@symbian.org>
parents:
diff
changeset
|
13 |
|
5707b75503d5
working on test for common siging test
John Kern <johnk@symbian.org>
parents:
diff
changeset
|
14 |
|
5707b75503d5
working on test for common siging test
John Kern <johnk@symbian.org>
parents:
diff
changeset
|
15 |
#include "test.h" |
5707b75503d5
working on test for common siging test
John Kern <johnk@symbian.org>
parents:
diff
changeset
|
16 |
|
5707b75503d5
working on test for common siging test
John Kern <johnk@symbian.org>
parents:
diff
changeset
|
17 |
/** |
5707b75503d5
working on test for common siging test
John Kern <johnk@symbian.org>
parents:
diff
changeset
|
18 |
This is the original puesdo-code for this test. |
5707b75503d5
working on test for common siging test
John Kern <johnk@symbian.org>
parents:
diff
changeset
|
19 |
This walks through signing. Express and Certified signing are very similar. |
5707b75503d5
working on test for common siging test
John Kern <johnk@symbian.org>
parents:
diff
changeset
|
20 |
|
5707b75503d5
working on test for common siging test
John Kern <johnk@symbian.org>
parents:
diff
changeset
|
21 |
sign sis file with publisher ID |
5707b75503d5
working on test for common siging test
John Kern <johnk@symbian.org>
parents:
diff
changeset
|
22 |
|
5707b75503d5
working on test for common siging test
John Kern <johnk@symbian.org>
parents:
diff
changeset
|
23 |
type is one of express or certified. |
5707b75503d5
working on test for common siging test
John Kern <johnk@symbian.org>
parents:
diff
changeset
|
24 |
submissionID,type = uploadSIS(sisfile) |
5707b75503d5
working on test for common siging test
John Kern <johnk@symbian.org>
parents:
diff
changeset
|
25 |
|
5707b75503d5
working on test for common siging test
John Kern <johnk@symbian.org>
parents:
diff
changeset
|
26 |
createSigningRequest(submissionID, type, description) |
5707b75503d5
working on test for common siging test
John Kern <johnk@symbian.org>
parents:
diff
changeset
|
27 |
|
5707b75503d5
working on test for common siging test
John Kern <johnk@symbian.org>
parents:
diff
changeset
|
28 |
done = false |
5707b75503d5
working on test for common siging test
John Kern <johnk@symbian.org>
parents:
diff
changeset
|
29 |
do { |
5707b75503d5
working on test for common siging test
John Kern <johnk@symbian.org>
parents:
diff
changeset
|
30 |
status = getSubmissionStatus(submissionID) |
5707b75503d5
working on test for common siging test
John Kern <johnk@symbian.org>
parents:
diff
changeset
|
31 |
switch (status) |
5707b75503d5
working on test for common siging test
John Kern <johnk@symbian.org>
parents:
diff
changeset
|
32 |
{ |
5707b75503d5
working on test for common siging test
John Kern <johnk@symbian.org>
parents:
diff
changeset
|
33 |
case SIGNED: |
5707b75503d5
working on test for common siging test
John Kern <johnk@symbian.org>
parents:
diff
changeset
|
34 |
done = true |
5707b75503d5
working on test for common siging test
John Kern <johnk@symbian.org>
parents:
diff
changeset
|
35 |
break; |
5707b75503d5
working on test for common siging test
John Kern <johnk@symbian.org>
parents:
diff
changeset
|
36 |
case SCAN_FAILED: |
5707b75503d5
working on test for common siging test
John Kern <johnk@symbian.org>
parents:
diff
changeset
|
37 |
done = true |
5707b75503d5
working on test for common siging test
John Kern <johnk@symbian.org>
parents:
diff
changeset
|
38 |
break; |
5707b75503d5
working on test for common siging test
John Kern <johnk@symbian.org>
parents:
diff
changeset
|
39 |
case TEST_FAILED: |
5707b75503d5
working on test for common siging test
John Kern <johnk@symbian.org>
parents:
diff
changeset
|
40 |
done = true |
5707b75503d5
working on test for common siging test
John Kern <johnk@symbian.org>
parents:
diff
changeset
|
41 |
break; |
5707b75503d5
working on test for common siging test
John Kern <johnk@symbian.org>
parents:
diff
changeset
|
42 |
case TESTING_IN_PROGRESS: |
5707b75503d5
working on test for common siging test
John Kern <johnk@symbian.org>
parents:
diff
changeset
|
43 |
case AUDIT_IN_PROGRESS: |
5707b75503d5
working on test for common siging test
John Kern <johnk@symbian.org>
parents:
diff
changeset
|
44 |
// This take awhile. Probably don't want to poll. IDEs may want to check for outstanding |
5707b75503d5
working on test for common siging test
John Kern <johnk@symbian.org>
parents:
diff
changeset
|
45 |
// submissions when IDE is started. see enumerateSubmissions |
5707b75503d5
working on test for common siging test
John Kern <johnk@symbian.org>
parents:
diff
changeset
|
46 |
break; |
5707b75503d5
working on test for common siging test
John Kern <johnk@symbian.org>
parents:
diff
changeset
|
47 |
default: |
5707b75503d5
working on test for common siging test
John Kern <johnk@symbian.org>
parents:
diff
changeset
|
48 |
sleep(2000); |
5707b75503d5
working on test for common siging test
John Kern <johnk@symbian.org>
parents:
diff
changeset
|
49 |
} |
5707b75503d5
working on test for common siging test
John Kern <johnk@symbian.org>
parents:
diff
changeset
|
50 |
|
5707b75503d5
working on test for common siging test
John Kern <johnk@symbian.org>
parents:
diff
changeset
|
51 |
} while (!done) |
5707b75503d5
working on test for common siging test
John Kern <johnk@symbian.org>
parents:
diff
changeset
|
52 |
|
5707b75503d5
working on test for common siging test
John Kern <johnk@symbian.org>
parents:
diff
changeset
|
53 |
if (status == SIGNED) getSubmission(submissionID) |
5707b75503d5
working on test for common siging test
John Kern <johnk@symbian.org>
parents:
diff
changeset
|
54 |
*/ |
5707b75503d5
working on test for common siging test
John Kern <johnk@symbian.org>
parents:
diff
changeset
|
55 |
|
5707b75503d5
working on test for common siging test
John Kern <johnk@symbian.org>
parents:
diff
changeset
|
56 |
class SigningCommonCase : public QObject, public TestInterface |
5707b75503d5
working on test for common siging test
John Kern <johnk@symbian.org>
parents:
diff
changeset
|
57 |
{ |
5707b75503d5
working on test for common siging test
John Kern <johnk@symbian.org>
parents:
diff
changeset
|
58 |
Q_OBJECT |
5707b75503d5
working on test for common siging test
John Kern <johnk@symbian.org>
parents:
diff
changeset
|
59 |
public: |
5707b75503d5
working on test for common siging test
John Kern <johnk@symbian.org>
parents:
diff
changeset
|
60 |
explicit SigningCommonCase(QNetworkAccessManager &mgr, QObject *parent = 0); |
5707b75503d5
working on test for common siging test
John Kern <johnk@symbian.org>
parents:
diff
changeset
|
61 |
|
5707b75503d5
working on test for common siging test
John Kern <johnk@symbian.org>
parents:
diff
changeset
|
62 |
void run(); |
5707b75503d5
working on test for common siging test
John Kern <johnk@symbian.org>
parents:
diff
changeset
|
63 |
TRESULT_STATE getResult(); |
5707b75503d5
working on test for common siging test
John Kern <johnk@symbian.org>
parents:
diff
changeset
|
64 |
|
5707b75503d5
working on test for common siging test
John Kern <johnk@symbian.org>
parents:
diff
changeset
|
65 |
signals: |
5707b75503d5
working on test for common siging test
John Kern <johnk@symbian.org>
parents:
diff
changeset
|
66 |
|
5707b75503d5
working on test for common siging test
John Kern <johnk@symbian.org>
parents:
diff
changeset
|
67 |
public slots: |
5707b75503d5
working on test for common siging test
John Kern <johnk@symbian.org>
parents:
diff
changeset
|
68 |
|
5707b75503d5
working on test for common siging test
John Kern <johnk@symbian.org>
parents:
diff
changeset
|
69 |
|
5707b75503d5
working on test for common siging test
John Kern <johnk@symbian.org>
parents:
diff
changeset
|
70 |
private: |
5707b75503d5
working on test for common siging test
John Kern <johnk@symbian.org>
parents:
diff
changeset
|
71 |
void uploadSIS(); |
5707b75503d5
working on test for common siging test
John Kern <johnk@symbian.org>
parents:
diff
changeset
|
72 |
QString testBaseURL; |
5707b75503d5
working on test for common siging test
John Kern <johnk@symbian.org>
parents:
diff
changeset
|
73 |
QNetworkAccessManager &mgr; |
5707b75503d5
working on test for common siging test
John Kern <johnk@symbian.org>
parents:
diff
changeset
|
74 |
}; |
5707b75503d5
working on test for common siging test
John Kern <johnk@symbian.org>
parents:
diff
changeset
|
75 |
|
5707b75503d5
working on test for common siging test
John Kern <johnk@symbian.org>
parents:
diff
changeset
|
76 |
#endif // SIGNINGCOMMONCASE_H |