| OLD | NEW |
| (Empty) |
| 1 /* | |
| 2 * Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). | |
| 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 | |
| 21 #include "config.h" | |
| 22 #include "PlatformUtilities.h" | |
| 23 | |
| 24 #include <WebKit2/WKStringQt.h> | |
| 25 #include <WebKit2/WKNativeEvent.h> | |
| 26 #include <WebKit2/WKURLQt.h> | |
| 27 | |
| 28 #include <QCoreApplication> | |
| 29 #include <QDir> | |
| 30 #include <QUrl> | |
| 31 #include <QThread> | |
| 32 | |
| 33 namespace TestWebKitAPI { | |
| 34 namespace Util { | |
| 35 | |
| 36 void run(bool* done) | |
| 37 { | |
| 38 while (!*done) | |
| 39 QCoreApplication::processEvents(); | |
| 40 } | |
| 41 | |
| 42 void sleep(double seconds) | |
| 43 { | |
| 44 QThread::sleep(seconds); | |
| 45 } | |
| 46 | |
| 47 WKStringRef createInjectedBundlePath() | |
| 48 { | |
| 49 QString path = QFileInfo(QStringLiteral(ROOT_BUILD_DIR "/lib/libTestWebKitAP
IInjectedBundle")).absoluteFilePath(); | |
| 50 | |
| 51 return WKStringCreateWithQString(path); | |
| 52 } | |
| 53 | |
| 54 WKURLRef createURLForResource(const char* resource, const char* extension) | |
| 55 { | |
| 56 QDir path(QStringLiteral(APITEST_SOURCE_DIR)); | |
| 57 QString filename = QString::fromLocal8Bit(resource) + QStringLiteral(".") +
QString::fromLocal8Bit(extension); | |
| 58 | |
| 59 return WKURLCreateWithQUrl(QUrl::fromLocalFile(path.absoluteFilePath(filenam
e))); | |
| 60 } | |
| 61 | |
| 62 WKURLRef URLForNonExistentResource() | |
| 63 { | |
| 64 return WKURLCreateWithUTF8CString("file:///does-not-exist.html"); | |
| 65 } | |
| 66 | |
| 67 bool isKeyDown(WKNativeEventPtr event) | |
| 68 { | |
| 69 return event->type() == QEvent::KeyPress; | |
| 70 } | |
| 71 | |
| 72 } // namespace Util | |
| 73 } // namespace TestWebKitAPI | |
| OLD | NEW |