Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 /* | 1 /* |
| 2 * Copyright (C) 2010 Google Inc. All rights reserved. | 2 * Copyright (C) 2010 Google Inc. All rights reserved. |
| 3 * Copyright (C) 2010 Pawel Hajdan (phajdan.jr@chromium.org) | 3 * Copyright (C) 2010 Pawel Hajdan (phajdan.jr@chromium.org) |
| 4 * Copyright (C) 2012 Apple Inc. All Rights Reserved. | 4 * Copyright (C) 2012 Apple Inc. All Rights Reserved. |
| 5 * | 5 * |
| 6 * Redistribution and use in source and binary forms, with or without | 6 * Redistribution and use in source and binary forms, with or without |
| 7 * modification, are permitted provided that the following conditions are | 7 * modification, are permitted provided that the following conditions are |
| 8 * met: | 8 * met: |
| 9 * | 9 * |
| 10 * * Redistributions of source code must retain the above copyright | 10 * * Redistributions of source code must retain the above copyright |
| (...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 54 #include "WebSerializedScriptValue.h" | 54 #include "WebSerializedScriptValue.h" |
| 55 #include "WebSettings.h" | 55 #include "WebSettings.h" |
| 56 #include "WebSurroundingText.h" | 56 #include "WebSurroundingText.h" |
| 57 #include "WebTask.h" | 57 #include "WebTask.h" |
| 58 #include "WebTestDelegate.h" | 58 #include "WebTestDelegate.h" |
| 59 #include "WebTestProxy.h" | 59 #include "WebTestProxy.h" |
| 60 #include "WebView.h" | 60 #include "WebView.h" |
| 61 #include "v8/include/v8.h" | 61 #include "v8/include/v8.h" |
| 62 #include <limits> | 62 #include <limits> |
| 63 #include <memory> | 63 #include <memory> |
| 64 #include <modules/device_orientation/DeviceMotionDispatcher.h> | |
|
abarth-chromium
2013/05/13 18:39:56
This is a bad dependency. TestRunner cannot reach
timvolodine
2013/05/14 18:07:46
Done.
| |
| 64 #include <public/WebData.h> | 65 #include <public/WebData.h> |
| 66 #include <public/WebDeviceMotionData.h> | |
| 65 #include <public/WebPoint.h> | 67 #include <public/WebPoint.h> |
| 66 #include <public/WebURLResponse.h> | 68 #include <public/WebURLResponse.h> |
| 67 | 69 |
| 68 #if defined(__linux__) || defined(ANDROID) | 70 #if defined(__linux__) || defined(ANDROID) |
| 69 #include "linux/WebFontRendering.h" | 71 #include "linux/WebFontRendering.h" |
| 70 #endif | 72 #endif |
| 71 | 73 |
| 72 using namespace WebKit; | 74 using namespace WebKit; |
| 73 using namespace std; | 75 using namespace std; |
| 74 | 76 |
| (...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 200 bindMethod("setFixedLayoutSize", &TestRunner::setFixedLayoutSize); | 202 bindMethod("setFixedLayoutSize", &TestRunner::setFixedLayoutSize); |
| 201 bindMethod("selectionAsMarkup", &TestRunner::selectionAsMarkup); | 203 bindMethod("selectionAsMarkup", &TestRunner::selectionAsMarkup); |
| 202 bindMethod("setTextSubpixelPositioning", &TestRunner::setTextSubpixelPositio ning); | 204 bindMethod("setTextSubpixelPositioning", &TestRunner::setTextSubpixelPositio ning); |
| 203 bindMethod("resetPageVisibility", &TestRunner::resetPageVisibility); | 205 bindMethod("resetPageVisibility", &TestRunner::resetPageVisibility); |
| 204 bindMethod("setPageVisibility", &TestRunner::setPageVisibility); | 206 bindMethod("setPageVisibility", &TestRunner::setPageVisibility); |
| 205 bindMethod("setTextDirection", &TestRunner::setTextDirection); | 207 bindMethod("setTextDirection", &TestRunner::setTextDirection); |
| 206 bindMethod("textSurroundingNode", &TestRunner::textSurroundingNode); | 208 bindMethod("textSurroundingNode", &TestRunner::textSurroundingNode); |
| 207 bindMethod("disableAutoResizeMode", &TestRunner::disableAutoResizeMode); | 209 bindMethod("disableAutoResizeMode", &TestRunner::disableAutoResizeMode); |
| 208 bindMethod("enableAutoResizeMode", &TestRunner::enableAutoResizeMode); | 210 bindMethod("enableAutoResizeMode", &TestRunner::enableAutoResizeMode); |
| 209 bindMethod("setMockDeviceOrientation", &TestRunner::setMockDeviceOrientation ); | 211 bindMethod("setMockDeviceOrientation", &TestRunner::setMockDeviceOrientation ); |
| 212 bindMethod("fireMockDeviceMotion", &TestRunner::fireMockDeviceMotion); | |
| 213 bindMethod("enableMockDeviceMotion", &TestRunner::enableMockDeviceMotion); | |
| 210 bindMethod("didAcquirePointerLock", &TestRunner::didAcquirePointerLock); | 214 bindMethod("didAcquirePointerLock", &TestRunner::didAcquirePointerLock); |
| 211 bindMethod("didLosePointerLock", &TestRunner::didLosePointerLock); | 215 bindMethod("didLosePointerLock", &TestRunner::didLosePointerLock); |
| 212 bindMethod("didNotAcquirePointerLock", &TestRunner::didNotAcquirePointerLock ); | 216 bindMethod("didNotAcquirePointerLock", &TestRunner::didNotAcquirePointerLock ); |
| 213 bindMethod("setPointerLockWillRespondAsynchronously", &TestRunner::setPointe rLockWillRespondAsynchronously); | 217 bindMethod("setPointerLockWillRespondAsynchronously", &TestRunner::setPointe rLockWillRespondAsynchronously); |
| 214 bindMethod("setPointerLockWillFailSynchronously", &TestRunner::setPointerLoc kWillFailSynchronously); | 218 bindMethod("setPointerLockWillFailSynchronously", &TestRunner::setPointerLoc kWillFailSynchronously); |
| 215 | 219 |
| 216 // The following modify WebPreferences. | 220 // The following modify WebPreferences. |
| 217 bindMethod("setUserStyleSheetEnabled", &TestRunner::setUserStyleSheetEnabled ); | 221 bindMethod("setUserStyleSheetEnabled", &TestRunner::setUserStyleSheetEnabled ); |
| 218 bindMethod("setUserStyleSheetLocation", &TestRunner::setUserStyleSheetLocati on); | 222 bindMethod("setUserStyleSheetLocation", &TestRunner::setUserStyleSheetLocati on); |
| 219 bindMethod("setAuthorAndUserStylesEnabled", &TestRunner::setAuthorAndUserSty lesEnabled); | 223 bindMethod("setAuthorAndUserStylesEnabled", &TestRunner::setAuthorAndUserSty lesEnabled); |
| (...skipping 1275 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1495 orientation.setBeta(arguments[3].toDouble()); | 1499 orientation.setBeta(arguments[3].toDouble()); |
| 1496 if (arguments[4].toBoolean()) | 1500 if (arguments[4].toBoolean()) |
| 1497 orientation.setGamma(arguments[5].toDouble()); | 1501 orientation.setGamma(arguments[5].toDouble()); |
| 1498 | 1502 |
| 1499 // Note that we only call setOrientation on the main page's mock since this | 1503 // Note that we only call setOrientation on the main page's mock since this |
| 1500 // tests require. If necessary, we could get a list of WebViewHosts from th | 1504 // tests require. If necessary, we could get a list of WebViewHosts from th |
| 1501 // call setOrientation on each DeviceOrientationClientMock. | 1505 // call setOrientation on each DeviceOrientationClientMock. |
| 1502 m_proxy->deviceOrientationClientMock()->setOrientation(orientation); | 1506 m_proxy->deviceOrientationClientMock()->setOrientation(orientation); |
| 1503 } | 1507 } |
| 1504 | 1508 |
| 1509 void TestRunner::enableMockDeviceMotion(const CppArgumentList& arguments, CppVar iant* result) | |
| 1510 { | |
| 1511 WebCore::DeviceMotionDispatcher::shared().setEnableTesting(true); | |
| 1512 } | |
| 1513 | |
| 1514 void TestRunner::fireMockDeviceMotion(const CppArgumentList& arguments, CppVaria nt* result) | |
| 1515 { | |
| 1516 result->setNull(); | |
| 1517 if (arguments.size() < 19 | |
| 1518 || !arguments[0].isBool() || !arguments[1].isNumber() // acceleration.x | |
| 1519 || !arguments[2].isBool() || !arguments[3].isNumber() // acceleration.y | |
| 1520 || !arguments[4].isBool() || !arguments[5].isNumber() // acceleration.z | |
| 1521 || !arguments[6].isBool() || !arguments[7].isNumber() // accelerationInc ludingGravity.x | |
| 1522 || !arguments[8].isBool() || !arguments[9].isNumber() // accelerationInc ludingGravity.y | |
| 1523 || !arguments[10].isBool() || !arguments[11].isNumber() // accelerationI ncludingGravity.z | |
| 1524 || !arguments[12].isBool() || !arguments[13].isNumber() // rotationRate. alpha | |
| 1525 || !arguments[14].isBool() || !arguments[15].isNumber() // rotationRate. beta | |
| 1526 || !arguments[16].isBool() || !arguments[17].isNumber() // rotationRate. gamma | |
| 1527 || !arguments[18].isNumber()) // interval | |
| 1528 return; | |
| 1529 | |
| 1530 WebDeviceMotionData motion; | |
| 1531 | |
| 1532 // acceleration | |
| 1533 if (arguments[0].toBoolean()) | |
| 1534 motion.setAccelerationX(arguments[1].toDouble()); | |
| 1535 if (arguments[2].toBoolean()) | |
| 1536 motion.setAccelerationY(arguments[3].toDouble()); | |
| 1537 if (arguments[4].toBoolean()) | |
| 1538 motion.setAccelerationZ(arguments[5].toDouble()); | |
| 1539 | |
| 1540 // accelerationIncludingGravity | |
| 1541 if (arguments[6].toBoolean()) | |
| 1542 motion.setAccelerationIncludingGravityX(arguments[7].toDouble()); | |
| 1543 if (arguments[8].toBoolean()) | |
| 1544 motion.setAccelerationIncludingGravityY(arguments[9].toDouble()); | |
| 1545 if (arguments[10].toBoolean()) | |
| 1546 motion.setAccelerationIncludingGravityZ(arguments[11].toDouble()); | |
| 1547 | |
| 1548 // rotationRate | |
| 1549 if (arguments[12].toBoolean()) | |
| 1550 motion.setRotationRateAlpha(arguments[13].toDouble()); | |
| 1551 if (arguments[14].toBoolean()) | |
| 1552 motion.setRotationRateBeta(arguments[15].toDouble()); | |
| 1553 if (arguments[16].toBoolean()) | |
| 1554 motion.setRotationRateGamma(arguments[17].toDouble()); | |
| 1555 | |
| 1556 // interval | |
| 1557 motion.setInterval(arguments[18].toDouble()); | |
| 1558 | |
| 1559 WebCore::DeviceMotionDispatcher::shared().didChangeDeviceMotion(motion); | |
| 1560 } | |
| 1561 | |
| 1505 void TestRunner::setUserStyleSheetEnabled(const CppArgumentList& arguments, CppV ariant* result) | 1562 void TestRunner::setUserStyleSheetEnabled(const CppArgumentList& arguments, CppV ariant* result) |
| 1506 { | 1563 { |
| 1507 if (arguments.size() > 0 && arguments[0].isBool()) { | 1564 if (arguments.size() > 0 && arguments[0].isBool()) { |
| 1508 m_delegate->preferences()->userStyleSheetLocation = arguments[0].value.b oolValue ? m_userStyleSheetLocation : WebURL(); | 1565 m_delegate->preferences()->userStyleSheetLocation = arguments[0].value.b oolValue ? m_userStyleSheetLocation : WebURL(); |
| 1509 m_delegate->applyPreferences(); | 1566 m_delegate->applyPreferences(); |
| 1510 } | 1567 } |
| 1511 result->setNull(); | 1568 result->setNull(); |
| 1512 } | 1569 } |
| 1513 | 1570 |
| 1514 void TestRunner::setUserStyleSheetLocation(const CppArgumentList& arguments, Cpp Variant* result) | 1571 void TestRunner::setUserStyleSheetLocation(const CppArgumentList& arguments, Cpp Variant* result) |
| (...skipping 513 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2028 result->setNull(); | 2085 result->setNull(); |
| 2029 } | 2086 } |
| 2030 | 2087 |
| 2031 void TestRunner::setPointerLockWillFailSynchronously(const CppArgumentList&, Cpp Variant* result) | 2088 void TestRunner::setPointerLockWillFailSynchronously(const CppArgumentList&, Cpp Variant* result) |
| 2032 { | 2089 { |
| 2033 m_pointerLockPlannedResult = PointerLockWillFailSync; | 2090 m_pointerLockPlannedResult = PointerLockWillFailSync; |
| 2034 result->setNull(); | 2091 result->setNull(); |
| 2035 } | 2092 } |
| 2036 | 2093 |
| 2037 } | 2094 } |
| OLD | NEW |