1/*
2 * Copyright (C) 2011 Igalia S.L.
3 *
4 * This library is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU Library General Public
6 * License as published by the Free Software Foundation; either
7 * version 2 of the License, or (at your option) any later version.
8 *
9 * This library is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 * Library General Public License for more details.
13 *
14 * You should have received a copy of the GNU Library General Public License
15 * along with this library; see the file COPYING.LIB. If not, write to
16 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
17 * Boston, MA 02110-1301, USA.
18 */
19
20#pragma once
21
22#include "WebViewTest.h"
23#include <wtf/Vector.h>
24
25class LoadTrackingTest : public WebViewTest {
26public:
27 MAKE_GLIB_TEST_FIXTURE(LoadTrackingTest);
28 LoadTrackingTest();
29 virtual ~LoadTrackingTest();
30 void waitUntilLoadFinished();
31
32 virtual void provisionalLoadStarted();
33 virtual void provisionalLoadReceivedServerRedirect();
34 virtual void provisionalLoadFailed(const gchar* failingURI, GError*);
35 virtual bool loadFailedWithTLSErrors(const gchar* failingURI, GTlsCertificate*, GTlsCertificateFlags);
36 virtual void loadCommitted();
37 virtual void loadFinished();
38 virtual void loadFailed(const char* failingURI, GError*);
39 virtual void estimatedProgressChanged();
40
41 void loadURI(const char* uri);
42 void loadHtml(const char* html, const char* baseURI);
43 void loadPlainText(const char* plainText);
44 void loadRequest(WebKitURIRequest*);
45 void loadBytes(GBytes*, const char* mimeType, const char* encoding, const char* baseURI);
46 void reload();
47 void goBack();
48 void goForward();
49 void reset();
50
51 void setRedirectURI(const char* uri) { m_redirectURI = uri; }
52
53 enum LoadEvents {
54 ProvisionalLoadStarted,
55 ProvisionalLoadReceivedServerRedirect,
56 ProvisionalLoadFailed,
57 LoadCommitted,
58 LoadFinished,
59 LoadFailed,
60 LoadFailedWithTLSErrors
61 };
62 bool m_runLoadUntilCompletion;
63 bool m_loadFailed;
64 GUniquePtr<GError> m_error;
65 Vector<LoadEvents> m_loadEvents;
66 float m_estimatedProgress;
67 CString m_redirectURI;
68};
69