Changeset 86154 in webkit
- Timestamp:
- May 10, 2011 8:32:44 AM (13 years ago)
- Location:
- trunk/Source/WebKit/qt
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebKit/qt/ChangeLog
r86124 r86154 1 2011-05-10 Ademar de Souza Reis Jr. <ademar.reis@openbossa.org> 2 3 Reviewed by Csaba Osztrogonác. 4 5 [Qt] tst_QWebPage creates temporary files in the current working dir 6 https://bugs.webkit.org/show_bug.cgi?id=60497 7 8 tst_QWebPage was using QDir::currentPath when creating temporary dirs 9 and leaving them after the test was run. I basically borrowed the fix 10 from tst_QDeclarativeWebView. 11 12 * tests/qwebpage/tst_qwebpage.cpp: 13 (removeRecursive): 14 (tst_QWebPage::tmpDirPath): 15 (tst_QWebPage::cleanupFiles): 16 (tst_QWebPage::database): 17 (tst_QWebPage::multiplePageGroupsAndLocalStorage): 18 1 19 2011-05-09 Chang Shu <cshu@webkit.org> 2 20 -
trunk/Source/WebKit/qt/tests/qwebpage/tst_qwebpage.cpp
r85799 r86154 45 45 #include <qwebview.h> 46 46 #include <qimagewriter.h> 47 48 static void removeRecursive(const QString& dirname) 49 { 50 QDir dir(dirname); 51 QFileInfoList entries(dir.entryInfoList(QDir::Dirs | QDir::Files | QDir::NoDotAndDotDot)); 52 for (int i = 0; i < entries.count(); ++i) 53 if (entries[i].isDir()) 54 removeRecursive(entries[i].filePath()); 55 else 56 dir.remove(entries[i].fileName()); 57 QDir().rmdir(dirname); 58 } 47 59 48 60 class EventSpy : public QObject, public QList<QEvent::Type> … … 146 158 void macCopyUnicodeToClipboard(); 147 159 #endif 148 160 149 161 private: 150 162 QWebView* m_view; 151 163 QWebPage* m_page; 164 QString tmpDirPath() const 165 { 166 static QString tmpd = QDir::tempPath() + "/tst_qwebpage-" 167 + QDateTime::currentDateTime().toString(QLatin1String("yyyyMMddhhmmss")); 168 return tmpd; 169 } 152 170 }; 153 171 … … 173 191 void tst_QWebPage::cleanupFiles() 174 192 { 175 QFile::remove("Databases.db"); 176 QDir::current().rmdir("http_www.myexample.com_0"); 177 QFile::remove("http_www.myexample.com_0.localstorage"); 193 removeRecursive(tmpDirPath()); 178 194 } 179 195 … … 554 570 void tst_QWebPage::database() 555 571 { 556 QString path = QDir::currentPath();572 QString path = tmpDirPath(); 557 573 m_page->settings()->setOfflineStoragePath(path); 558 574 QVERIFY(m_page->settings()->offlineStoragePath() == path); … … 908 924 void tst_QWebPage::multiplePageGroupsAndLocalStorage() 909 925 { 910 QDir dir( QDir::currentPath());926 QDir dir(tmpDirPath()); 911 927 dir.mkdir("path1"); 912 928 dir.mkdir("path2"); … … 916 932 917 933 view1.page()->settings()->setAttribute(QWebSettings::LocalStorageEnabled, true); 918 view1.page()->settings()->setLocalStoragePath(QDir::toNativeSeparators( QDir::currentPath() + "/path1"));934 view1.page()->settings()->setLocalStoragePath(QDir::toNativeSeparators(tmpDirPath() + "/path1")); 919 935 DumpRenderTreeSupportQt::webPageSetGroupName(view1.page(), "group1"); 920 936 view2.page()->settings()->setAttribute(QWebSettings::LocalStorageEnabled, true); 921 view2.page()->settings()->setLocalStoragePath(QDir::toNativeSeparators( QDir::currentPath() + "/path2"));937 view2.page()->settings()->setLocalStoragePath(QDir::toNativeSeparators(tmpDirPath() + "/path2")); 922 938 DumpRenderTreeSupportQt::webPageSetGroupName(view2.page(), "group2"); 923 939 QCOMPARE(DumpRenderTreeSupportQt::webPageGroupName(view1.page()), QString("group1")); … … 942 958 QTest::qWait(1000); 943 959 944 QFile::remove(QDir::toNativeSeparators( QDir::currentPath() + "/path1/http_www.myexample.com_0.localstorage"));945 QFile::remove(QDir::toNativeSeparators( QDir::currentPath() + "/path2/http_www.myexample.com_0.localstorage"));960 QFile::remove(QDir::toNativeSeparators(tmpDirPath() + "/path1/http_www.myexample.com_0.localstorage")); 961 QFile::remove(QDir::toNativeSeparators(tmpDirPath() + "/path2/http_www.myexample.com_0.localstorage")); 946 962 dir.rmdir(QDir::toNativeSeparators("./path1")); 947 963 dir.rmdir(QDir::toNativeSeparators("./path2"));
Note: See TracChangeset
for help on using the changeset viewer.