LayoutTestControllerManx.cpp 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585
  1. /*
  2. * Copyright (C) 2006, 2007, 2008, 2009, 2010 Apple Inc. All rights reserved.
  3. * Copyright (C) 2012 Sony Computer Entertainment Inc.
  4. *
  5. * Redistribution and use in source and binary forms, with or without
  6. * modification, are permitted provided that the following conditions
  7. * are met:
  8. *
  9. * 1. Redistributions of source code must retain the above copyright
  10. * notice, this list of conditions and the following disclaimer.
  11. * 2. Redistributions in binary form must reproduce the above copyright
  12. * notice, this list of conditions and the following disclaimer in the
  13. * documentation and/or other materials provided with the distribution.
  14. * 3. Neither the name of Apple Computer, Inc. ("Apple") nor the names of
  15. * its contributors may be used to endorse or promote products derived
  16. * from this software without specific prior written permission.
  17. *
  18. * THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY
  19. * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
  20. * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
  21. * DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY
  22. * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
  23. * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
  24. * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
  25. * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
  26. * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
  27. * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  28. */
  29. #include "config.h"
  30. #include "LayoutTestController.h"
  31. #include "DumpRenderTree.h"
  32. #include "NotImplemented.h"
  33. #include "WebCoreSupport/DumpRenderTreeSupportManx.h"
  34. #include "WorkQueue.h"
  35. #include "WorkQueueItem.h"
  36. #include <JavaScriptCore/JSRetainPtr.h>
  37. #include <JavaScriptCore/JavaScriptCore.h>
  38. #include <string>
  39. #include <wtf/Assertions.h>
  40. #include <wtf/Platform.h>
  41. #include <wtf/RetainPtr.h>
  42. #include <wtf/Vector.h>
  43. using namespace std;
  44. LayoutTestController::~LayoutTestController()
  45. {
  46. }
  47. void LayoutTestController::addDisallowedURL(JSStringRef url)
  48. {
  49. notImplemented();
  50. }
  51. void LayoutTestController::clearBackForwardList()
  52. {
  53. }
  54. bool LayoutTestController::callShouldCloseOnWebView()
  55. {
  56. return false;
  57. }
  58. JSStringRef LayoutTestController::copyDecodedHostName(JSStringRef name)
  59. {
  60. return 0;
  61. }
  62. JSStringRef LayoutTestController::copyEncodedHostName(JSStringRef name)
  63. {
  64. return 0;
  65. }
  66. void LayoutTestController::disableImageLoading()
  67. {
  68. }
  69. void LayoutTestController::dispatchPendingLoadRequests()
  70. {
  71. }
  72. void LayoutTestController::display()
  73. {
  74. }
  75. void LayoutTestController::keepWebHistory()
  76. {
  77. }
  78. JSValueRef LayoutTestController::computedStyleIncludingVisitedInfo(JSContextRef context, JSValueRef value)
  79. {
  80. return JSValueMakeUndefined(context);
  81. }
  82. JSRetainPtr<JSStringRef> LayoutTestController::layerTreeAsText() const
  83. {
  84. return 0;
  85. }
  86. JSRetainPtr<JSStringRef> LayoutTestController::markerTextForListItem(JSContextRef context, JSValueRef nodeObject) const
  87. {
  88. return 0;
  89. }
  90. void LayoutTestController::waitForPolicyDelegate()
  91. {
  92. waitForPolicy = true;
  93. setWaitToDump(true);
  94. }
  95. size_t LayoutTestController::webHistoryItemCount()
  96. {
  97. return 0;
  98. }
  99. unsigned LayoutTestController::workerThreadCount() const
  100. {
  101. return 0;
  102. }
  103. void LayoutTestController::notifyDone()
  104. {
  105. if (m_waitToDump)
  106. dump();
  107. m_waitToDump = false;
  108. waitForPolicy = false;
  109. }
  110. JSStringRef LayoutTestController::pathToLocalResource(JSContextRef context, JSStringRef url)
  111. {
  112. return JSStringCreateWithCharacters(JSChar(), 0);
  113. }
  114. void LayoutTestController::queueLoad(JSStringRef url, JSStringRef target)
  115. {
  116. }
  117. void LayoutTestController::setAcceptsEditing(bool acceptsEditing)
  118. {
  119. }
  120. void LayoutTestController::setAlwaysAcceptCookies(bool alwaysAcceptCookies)
  121. {
  122. }
  123. void LayoutTestController::setAuthorAndUserStylesEnabled(bool flag)
  124. {
  125. }
  126. void LayoutTestController::setAutofilled(JSContextRef context, JSValueRef nodeObject, bool autofilled)
  127. {
  128. }
  129. void LayoutTestController::setCustomPolicyDelegate(bool setDelegate, bool permissive)
  130. {
  131. }
  132. void LayoutTestController::setMockDeviceOrientation(bool canProvideAlpha, double alpha, bool canProvideBeta, double beta, bool canProvideGamma, double gamma)
  133. {
  134. }
  135. void LayoutTestController::setMockGeolocationPosition(double latitude, double longitude, double accuracy)
  136. {
  137. }
  138. void LayoutTestController::setMockGeolocationError(int code, JSStringRef message)
  139. {
  140. }
  141. void LayoutTestController::setGeolocationPermission(bool allow)
  142. {
  143. }
  144. int LayoutTestController::numberOfPendingGeolocationPermissionRequests()
  145. {
  146. return -1;
  147. }
  148. void LayoutTestController::addMockSpeechInputResult(JSStringRef result, double confidence, JSStringRef language)
  149. {
  150. }
  151. void LayoutTestController::setMockSpeechInputDumpRect(bool flag)
  152. {
  153. }
  154. void LayoutTestController::startSpeechInput(JSContextRef inputElement)
  155. {
  156. }
  157. void LayoutTestController::setIconDatabaseEnabled(bool iconDatabaseEnabled)
  158. {
  159. }
  160. void LayoutTestController::setMainFrameIsFirstResponder(bool flag)
  161. {
  162. }
  163. void LayoutTestController::setPrivateBrowsingEnabled(bool privateBrowsingEnabled)
  164. {
  165. }
  166. void LayoutTestController::setXSSAuditorEnabled(bool enabled)
  167. {
  168. }
  169. void LayoutTestController::setFrameFlatteningEnabled(bool enabled)
  170. {
  171. }
  172. void LayoutTestController::setSpatialNavigationEnabled(bool enabled)
  173. {
  174. }
  175. void LayoutTestController::setAllowUniversalAccessFromFileURLs(bool enabled)
  176. {
  177. }
  178. void LayoutTestController::setAllowFileAccessFromFileURLs(bool enabled)
  179. {
  180. }
  181. void LayoutTestController::setPopupBlockingEnabled(bool enabled)
  182. {
  183. }
  184. void LayoutTestController::setPluginsEnabled(bool flag)
  185. {
  186. }
  187. void LayoutTestController::setJavaScriptCanAccessClipboard(bool enabled)
  188. {
  189. }
  190. void LayoutTestController::setTabKeyCyclesThroughElements(bool shouldCycle)
  191. {
  192. }
  193. void LayoutTestController::setUseDashboardCompatibilityMode(bool flag)
  194. {
  195. }
  196. void LayoutTestController::setUserStyleSheetEnabled(bool flag)
  197. {
  198. }
  199. void LayoutTestController::setUserStyleSheetLocation(JSStringRef jsURL)
  200. {
  201. }
  202. void LayoutTestController::setValueForUser(JSContextRef context, JSValueRef element, JSStringRef value)
  203. {
  204. }
  205. void LayoutTestController::setViewModeMediaFeature(JSStringRef mode)
  206. {
  207. }
  208. void LayoutTestController::setPersistentUserStyleSheetLocation(JSStringRef jsURL)
  209. {
  210. }
  211. void LayoutTestController::clearPersistentUserStyleSheet()
  212. {
  213. }
  214. void LayoutTestController::setWindowIsKey(bool flag)
  215. {
  216. }
  217. void LayoutTestController::setSmartInsertDeleteEnabled(bool flag)
  218. {
  219. }
  220. void LayoutTestController::setJavaScriptProfilingEnabled(bool flag)
  221. {
  222. }
  223. void LayoutTestController::setSelectTrailingWhitespaceEnabled(bool flag)
  224. {
  225. }
  226. static bool waitToDumpWatchdogFired()
  227. {
  228. setWaitToDumpWatchdog(0);
  229. gLayoutTestController->waitToDumpWatchdogTimerFired();
  230. return FALSE;
  231. }
  232. void LayoutTestController::setWaitToDump(bool waitUntilDone)
  233. {
  234. static const int timeoutSeconds = 3;
  235. m_waitToDump = waitUntilDone;
  236. if (m_waitToDump && shouldSetWaitToDumpWatchdog()) {
  237. sceKernelDelayThread(timeoutSeconds * 1000 *1000);
  238. waitToDumpWatchdogFired();
  239. setWaitToDumpWatchdog(1);
  240. }
  241. }
  242. int LayoutTestController::windowCount()
  243. {
  244. return 1;
  245. }
  246. bool LayoutTestController::elementDoesAutoCompleteForElementWithId(JSStringRef id)
  247. {
  248. return false;
  249. }
  250. void LayoutTestController::execCommand(JSStringRef name, JSStringRef value)
  251. {
  252. }
  253. bool LayoutTestController::findString(JSContextRef /* context */, JSStringRef /* target */, JSObjectRef /* optionsArray */)
  254. {
  255. return false;
  256. }
  257. void LayoutTestController::setCacheModel(int)
  258. {
  259. }
  260. bool LayoutTestController::isCommandEnabled(JSStringRef /*name*/)
  261. {
  262. return false;
  263. }
  264. void LayoutTestController::clearAllApplicationCaches()
  265. {
  266. }
  267. void LayoutTestController::clearApplicationCacheForOrigin(JSStringRef origin)
  268. {
  269. }
  270. void LayoutTestController::setApplicationCacheOriginQuota(unsigned long long quota)
  271. {
  272. }
  273. JSValueRef LayoutTestController::originsWithApplicationCache(JSContextRef context)
  274. {
  275. return JSValueMakeUndefined(context);
  276. }
  277. long long LayoutTestController::applicationCacheDiskUsageForOrigin(JSStringRef name)
  278. {
  279. // FIXME: Implement to get disk usage by all application caches for an origin.
  280. return 0;
  281. }
  282. void LayoutTestController::clearAllDatabases()
  283. {
  284. }
  285. void LayoutTestController::overridePreference(JSStringRef key, JSStringRef value)
  286. {
  287. }
  288. void LayoutTestController::setDatabaseQuota(unsigned long long quota)
  289. {
  290. }
  291. void LayoutTestController::goBack()
  292. {
  293. }
  294. void LayoutTestController::setDefersLoading(bool)
  295. {
  296. }
  297. void LayoutTestController::setDomainRelaxationForbiddenForURLScheme(bool forbidden, JSStringRef scheme)
  298. {
  299. }
  300. void LayoutTestController::setAppCacheMaximumSize(unsigned long long size)
  301. {
  302. }
  303. bool LayoutTestController::pauseAnimationAtTimeOnElementWithId(JSStringRef animationName, double time, JSStringRef elementId)
  304. {
  305. return false;
  306. }
  307. bool LayoutTestController::pauseTransitionAtTimeOnElementWithId(JSStringRef propertyName, double time, JSStringRef elementId)
  308. {
  309. return false;
  310. }
  311. unsigned LayoutTestController::numberOfActiveAnimations() const
  312. {
  313. return 0;
  314. }
  315. void LayoutTestController::suspendAnimations() const
  316. {
  317. }
  318. void LayoutTestController::resumeAnimations() const
  319. {
  320. }
  321. void LayoutTestController::addOriginAccessWhitelistEntry(JSStringRef sourceOrigin, JSStringRef destinationProtocol, JSStringRef destinationHost, bool allowDestinationSubdomains)
  322. {
  323. }
  324. void LayoutTestController::removeOriginAccessWhitelistEntry(JSStringRef sourceOrigin, JSStringRef destinationProtocol, JSStringRef destinationHost, bool allowDestinationSubdomains)
  325. {
  326. }
  327. void LayoutTestController::setScrollbarPolicy(JSStringRef orientation, JSStringRef policy)
  328. {
  329. }
  330. void LayoutTestController::addUserScript(JSStringRef source, bool runAtStart, bool allFrames)
  331. {
  332. }
  333. void LayoutTestController::addUserStyleSheet(JSStringRef source, bool allFrames)
  334. {
  335. }
  336. void LayoutTestController::setDeveloperExtrasEnabled(bool enabled)
  337. {
  338. }
  339. void LayoutTestController::setAsynchronousSpellCheckingEnabled(bool)
  340. {
  341. }
  342. void LayoutTestController::showWebInspector()
  343. {
  344. }
  345. void LayoutTestController::closeWebInspector()
  346. {
  347. }
  348. void LayoutTestController::evaluateInWebInspector(long callId, JSStringRef script)
  349. {
  350. }
  351. void LayoutTestController::evaluateScriptInIsolatedWorld(unsigned worldID, JSObjectRef globalObject, JSStringRef script)
  352. {
  353. }
  354. void LayoutTestController::removeAllVisitedLinks()
  355. {
  356. }
  357. JSRetainPtr<JSStringRef> LayoutTestController::counterValueForElementById(JSStringRef id)
  358. {
  359. return JSRetainPtr<JSStringRef>();
  360. }
  361. int LayoutTestController::pageNumberForElementById(JSStringRef id, float pageWidthInPixels, float pageHeightInPixels)
  362. {
  363. return 0;
  364. }
  365. int LayoutTestController::numberOfPages(float pageWidthInPixels, float pageHeightInPixels)
  366. {
  367. return 0;
  368. }
  369. JSRetainPtr<JSStringRef> LayoutTestController::pageProperty(const char* propertyName, int pageNumber) const
  370. {
  371. return JSRetainPtr<JSStringRef>();
  372. }
  373. void LayoutTestController::apiTestNewWindowDataLoadBaseURL(JSStringRef utf8Data, JSStringRef baseURL)
  374. {
  375. }
  376. bool LayoutTestController::isPageBoxVisible(int pageNumber) const
  377. {
  378. return false;
  379. }
  380. JSRetainPtr<JSStringRef> LayoutTestController::pageSizeAndMarginsInPixels(int pageNumber, int width, int height, int marginTop, int marginRight, int marginBottom, int marginLeft) const
  381. {
  382. return JSRetainPtr<JSStringRef>();
  383. }
  384. void LayoutTestController::apiTestGoToCurrentBackForwardItem()
  385. {
  386. }
  387. void LayoutTestController::setWebViewEditable(bool)
  388. {
  389. }
  390. void LayoutTestController::authenticateSession(JSStringRef, JSStringRef, JSStringRef)
  391. {
  392. }
  393. void LayoutTestController::setEditingBehavior(const char* editingBehavior)
  394. {
  395. }
  396. void LayoutTestController::abortModal()
  397. {
  398. }
  399. void LayoutTestController::dumpConfigurationForViewport(int /*deviceDPI*/, int /*deviceWidth*/, int /*deviceHeight*/, int /*availableWidth*/, int /*availableHeight*/)
  400. {
  401. }
  402. void LayoutTestController::setSerializeHTTPLoads(bool)
  403. {
  404. }
  405. void LayoutTestController::syncLocalStorage()
  406. {
  407. }
  408. void LayoutTestController::observeStorageTrackerNotifications(unsigned number)
  409. {
  410. }
  411. void LayoutTestController::deleteAllLocalStorage()
  412. {
  413. }
  414. JSValueRef LayoutTestController::originsWithLocalStorage(JSContextRef context)
  415. {
  416. return JSValueMakeUndefined(context);
  417. }
  418. long long LayoutTestController::localStorageDiskUsageForOrigin(JSStringRef originIdentifier)
  419. {
  420. return 0;
  421. }
  422. void LayoutTestController::deleteLocalStorageForOrigin(JSStringRef URL)
  423. {
  424. }
  425. void LayoutTestController::setMinimumTimerInterval(double minimumTimerInterval)
  426. {
  427. }
  428. void LayoutTestController::setTextDirection(JSStringRef direction)
  429. {
  430. }
  431. void LayoutTestController::allowRoundingHacks()
  432. {
  433. }
  434. void LayoutTestController::addChromeInputField()
  435. {
  436. }
  437. void LayoutTestController::removeChromeInputField()
  438. {
  439. }
  440. void LayoutTestController::focusWebView()
  441. {
  442. }
  443. void LayoutTestController::setBackingScaleFactor(double)
  444. {
  445. }
  446. void LayoutTestController::simulateDesktopNotificationClick(JSStringRef title)
  447. {
  448. }
  449. void LayoutTestController::setPageVisibility(const char* visibilityBuffer)
  450. {
  451. }
  452. void LayoutTestController::resetPageVisibility()
  453. {
  454. }
  455. void LayoutTestController::evaluateScriptInIsolatedWorldAndReturnValue(unsigned worldID, JSObjectRef globalObject, JSStringRef script)
  456. {
  457. }