-
Notifications
You must be signed in to change notification settings - Fork 10
/
demowindow.h
193 lines (153 loc) · 5.56 KB
/
demowindow.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
/*
* Copyright 2012 Aarhus University
*
* Licensed under the GNU General Public License, Version 3 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.gnu.org/licenses/gpl-3.0.html
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#ifndef DEMOWINDOW_H
#define DEMOWINDOW_H
#include <QtGui>
#include <QLineEdit>
#include <QSharedPointer>
#include <QUrl>
#include <QList>
#include <QPair>
#include <QDir>
#include <QDesktopServices>
#include <QProcess>
#include "runtime/browser/artemiswebview.h"
#include "runtime/browser/artemiswebpage.h"
#include "runtime/browser/webkitexecutor.h"
#include "artemisbrowserwidget.h"
#include "initialanalysiswidget.h"
#include "artemisglobals.h"
#include "model/coverage/coveragetooutputstream.h"
#include "concolic/entrypoints.h"
#include "concolic/executiontree/tracenodes.h"
#include "concolic/executiontree/classifier/traceclassifier.h"
#include "concolic/executiontree/traceprinter.h"
#include "concolic/tracestatistics.h"
#include "concolic/executiontree/tracedisplay.h"
#include "traceviewerdialog.h"
namespace artemis
{
class DemoModeMainWindow : public QMainWindow
{
Q_OBJECT
public:
DemoModeMainWindow(AppModelPtr appModel, WebKitExecutor *webkitExecutor, const QUrl& url, const Options& options);
~DemoModeMainWindow();
void run(const QUrl &url);
protected:
void closeEvent(QCloseEvent *);
private:
// Artemis
AppModelPtr mAppModel;
ArtemisWebViewPtr mWebView;
ArtemisWebPagePtr mWebPage;
WebKitExecutor* mWebkitExecutor;
// GUI
// QWidgets are owned by their parent widget and so should not be QSharedPointer.
// TODO: so we probably should also not be storing most of these here... only the ones we access directly later.
QMenuBar* mMenuBar;
QWidget* mCentralWidget;
QWidget* mArtemisWidget;
QWidget* mAnalysisWidget;
QLayout* mLayout;
QLayout* mArtemisLayout;
QVBoxLayout* mAnalysisLayout;
QToolBar* mToolBar;
QLineEdit* mAddressBar;
QProgressBar* mProgressBar;
QPushButton* mExamplesButton;
QStatusBar* mStatusBar;
QLabel* mEntryPointLabel;
QListWidget* mEntryPointList;
QPushButton* mStartTraceRecordingBtn;
QPushButton* mEndTraceRecordingBtn;
QLabel* mTraceRecordingProgress;
QLabel* mTraceClassificationResult;
QPushButton* mViewTraceBtn;
QPushButton* mGenerateTraceGraphButton;
QLabel* mTraceAnalysisText;
QPushButton* mGenerateReportsBtn;
QPushButton* mPathTraceReportBtn;
QPushButton* mCoverageReportBtn;
QPushButton* mManualEntryPointXPathBtn;
QPushButton* mManualEntryPointClickBtn;
QLabel* mManualEntryPointDescription;
// The initial analysis panel is provided as its own widget.
InitialAnalysisWidget* mInitialAnalysis;
// The artemis browser widget.
ArtemisBrowserWidget* mArtemisBrowser;
void addEntryPoint(QString name, DOMElementDescriptorConstPtr element);
void highlightDomElement(DOMElementDescriptorConstPtr element);
void unHighlightDomElement(DOMElementDescriptorConstPtr element);
// The analysis logic itself.
EntryPointDetector mEntryPointDetector;
TraceClassifierPtr mTraceClassifier;
TraceNodePtr mPreviousTrace;
void preTraceExecution(ExecutionResultPtr result);
void postTraceExecution();
// The analysis/GUI interaction
typedef QPair<QString, DOMElementDescriptorConstPtr> EntryPointInfo;
QList<EntryPointInfo > mKnownEntryPoints;
int mTraceNodesRecorded;
void displayTraceInformation();
// Utility methods
void loadUrl(QUrl url);
void resetPageAnlaysis();
// Trace and Coverage report names.
QString mPathTraceFilename;
QString mCoverageFilename;
// Location of the manual entry point.
QString mManualEntryPointXPath;
QWebElementCollection mManualEntryPointMatches;
QWebElement mManualEntryPointElement;
QPoint mManualEntryPointCoordinates;
protected slots:
// For the GUI.
void slChangeLocation();
void slAdjustLocation();
void slLoadStarted();
void slLoadFinished(bool ok);
void slSetProgress(int p);
void slUrlChanged(const QUrl & url);
void slViewTrace();
void slGenerateTraceGraph();
void slAboutDialog();
void slLinkHovered(const QString & link, const QString & title, const QString & textContent);
void slJavascriptAlert(QWebFrame* frame, QString message);
void slShowExamples();
void slDumpDOM();
// For the analysis logic.
void slExecutedSequence(ExecutableConfigurationConstPtr configuration, QSharedPointer<ExecutionResult> result);
void slNavigationRequest(QWebFrame *frame, const QNetworkRequest &request, QWebPage::NavigationType type);
// For the analysis/GUI interaction.
void slEntryPointSelectionChanged();
// Trace recording
void slStartTraceRecording();
void slEndTraceRecording();
void slAddedTraceNode();
// Links to coverage and trace reports
void slShowTraceReport();
void slShowCoverageReport();
void slExportLinkedReports();
// Manual entry-point selection.
void slEnterManualEntryPoint();
void slClickManualEntryPoint();
signals:
void sigClose();
};
typedef QSharedPointer<DemoModeMainWindow> DemoModeMainWindowPtr;
} // namespace artemis
#endif // DEMOWINDOW_H