| 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 21 matching lines...) Expand all Loading... |
| 32 | 32 |
| 33 #include "TestRunner.h" | 33 #include "TestRunner.h" |
| 34 | 34 |
| 35 #include "MockWebSpeechInputController.h" | 35 #include "MockWebSpeechInputController.h" |
| 36 #include "MockWebSpeechRecognizer.h" | 36 #include "MockWebSpeechRecognizer.h" |
| 37 #include "NotificationPresenter.h" | 37 #include "NotificationPresenter.h" |
| 38 #include "TestInterfaces.h" | 38 #include "TestInterfaces.h" |
| 39 #include "WebPermissions.h" | 39 #include "WebPermissions.h" |
| 40 #include "public/platform/WebData.h" | 40 #include "public/platform/WebData.h" |
| 41 #include "public/platform/WebDeviceMotionData.h" | 41 #include "public/platform/WebDeviceMotionData.h" |
| 42 #include "public/platform/WebDeviceOrientationData.h" |
| 42 #include "public/platform/WebPoint.h" | 43 #include "public/platform/WebPoint.h" |
| 43 #include "public/platform/WebURLResponse.h" | 44 #include "public/platform/WebURLResponse.h" |
| 44 #include "public/testing/WebPreferences.h" | 45 #include "public/testing/WebPreferences.h" |
| 45 #include "public/testing/WebTask.h" | 46 #include "public/testing/WebTask.h" |
| 46 #include "public/testing/WebTestDelegate.h" | 47 #include "public/testing/WebTestDelegate.h" |
| 47 #include "public/testing/WebTestProxy.h" | 48 #include "public/testing/WebTestProxy.h" |
| 48 #include "public/web/WebBindings.h" | 49 #include "public/web/WebBindings.h" |
| 49 #include "public/web/WebDataSource.h" | 50 #include "public/web/WebDataSource.h" |
| 50 #include "public/web/WebDeviceOrientation.h" | 51 #include "public/web/WebDeviceOrientation.h" |
| 51 #include "public/web/WebDeviceOrientationClientMock.h" | 52 #include "public/web/WebDeviceOrientationClientMock.h" |
| (...skipping 1486 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1538 | 1539 |
| 1539 // interval | 1540 // interval |
| 1540 motion.interval = arguments[18].toDouble(); | 1541 motion.interval = arguments[18].toDouble(); |
| 1541 | 1542 |
| 1542 m_delegate->setDeviceMotionData(motion); | 1543 m_delegate->setDeviceMotionData(motion); |
| 1543 } | 1544 } |
| 1544 | 1545 |
| 1545 void TestRunner::setMockDeviceOrientation(const CppArgumentList& arguments, CppV
ariant* result) | 1546 void TestRunner::setMockDeviceOrientation(const CppArgumentList& arguments, CppV
ariant* result) |
| 1546 { | 1547 { |
| 1547 result->setNull(); | 1548 result->setNull(); |
| 1548 if (arguments.size() < 6 || !arguments[0].isBool() || !arguments[1].isNumber
() || !arguments[2].isBool() || !arguments[3].isNumber() || !arguments[4].isBool
() || !arguments[5].isNumber()) | 1549 if (arguments.size() < 8 |
| 1550 || !arguments[0].isBool() || !arguments[1].isNumber() // alpha |
| 1551 || !arguments[2].isBool() || !arguments[3].isNumber() // beta |
| 1552 || !arguments[4].isBool() || !arguments[5].isNumber() // gamma |
| 1553 || !arguments[6].isBool() || !arguments[7].isBool()) // absolute |
| 1549 return; | 1554 return; |
| 1550 | 1555 |
| 1551 WebDeviceOrientation orientation; | 1556 WebDeviceOrientationData orientation; |
| 1552 orientation.setNull(false); | |
| 1553 if (arguments[0].toBoolean()) | |
| 1554 orientation.setAlpha(arguments[1].toDouble()); | |
| 1555 if (arguments[2].toBoolean()) | |
| 1556 orientation.setBeta(arguments[3].toDouble()); | |
| 1557 if (arguments[4].toBoolean()) | |
| 1558 orientation.setGamma(arguments[5].toDouble()); | |
| 1559 | 1557 |
| 1560 // Note that we only call setOrientation on the main page's mock since this | 1558 // alpha |
| 1561 // tests require. If necessary, we could get a list of WebViewHosts from th | 1559 orientation.hasAlpha = arguments[0].toBoolean(); |
| 1562 // call setOrientation on each DeviceOrientationClientMock. | 1560 orientation.alpha = arguments[1].toDouble(); |
| 1563 m_proxy->deviceOrientationClientMock()->setOrientation(orientation); | 1561 |
| 1562 // beta |
| 1563 orientation.hasBeta = arguments[2].toBoolean(); |
| 1564 orientation.beta = arguments[3].toDouble(); |
| 1565 |
| 1566 // gamma |
| 1567 orientation.hasGamma = arguments[4].toBoolean(); |
| 1568 orientation.gamma = arguments[5].toDouble(); |
| 1569 |
| 1570 // absolute |
| 1571 orientation.hasAbsolute = arguments[6].toBoolean(); |
| 1572 orientation.absolute = arguments[7].toBoolean(); |
| 1573 |
| 1574 m_delegate->setDeviceOrientationData(orientation); |
| 1564 } | 1575 } |
| 1565 | 1576 |
| 1566 void TestRunner::setUserStyleSheetEnabled(const CppArgumentList& arguments, CppV
ariant* result) | 1577 void TestRunner::setUserStyleSheetEnabled(const CppArgumentList& arguments, CppV
ariant* result) |
| 1567 { | 1578 { |
| 1568 if (arguments.size() > 0 && arguments[0].isBool()) { | 1579 if (arguments.size() > 0 && arguments[0].isBool()) { |
| 1569 m_delegate->preferences()->userStyleSheetLocation = arguments[0].value.b
oolValue ? m_userStyleSheetLocation : WebURL(); | 1580 m_delegate->preferences()->userStyleSheetLocation = arguments[0].value.b
oolValue ? m_userStyleSheetLocation : WebURL(); |
| 1570 m_delegate->applyPreferences(); | 1581 m_delegate->applyPreferences(); |
| 1571 } | 1582 } |
| 1572 result->setNull(); | 1583 result->setNull(); |
| 1573 } | 1584 } |
| (...skipping 564 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2138 result->setNull(); | 2149 result->setNull(); |
| 2139 } | 2150 } |
| 2140 | 2151 |
| 2141 void TestRunner::setPointerLockWillFailSynchronously(const CppArgumentList&, Cpp
Variant* result) | 2152 void TestRunner::setPointerLockWillFailSynchronously(const CppArgumentList&, Cpp
Variant* result) |
| 2142 { | 2153 { |
| 2143 m_pointerLockPlannedResult = PointerLockWillFailSync; | 2154 m_pointerLockPlannedResult = PointerLockWillFailSync; |
| 2144 result->setNull(); | 2155 result->setNull(); |
| 2145 } | 2156 } |
| 2146 | 2157 |
| 2147 } | 2158 } |
| OLD | NEW |