Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1931)

Unified Diff: Source/testing/runner/TestRunner.cpp

Issue 22599005: Blink-side layout tests for the new Device Orientation API. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: rebased once more Created 7 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « Source/core/page/DOMWindow.cpp ('k') | public/testing/WebTestDelegate.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/testing/runner/TestRunner.cpp
diff --git a/Source/testing/runner/TestRunner.cpp b/Source/testing/runner/TestRunner.cpp
index 716a66ada81b39ca3262c2abc917be1828fe6ed6..2cf75cea00d1040a30b24ffe944504f174861d26 100644
--- a/Source/testing/runner/TestRunner.cpp
+++ b/Source/testing/runner/TestRunner.cpp
@@ -39,6 +39,7 @@
#include "WebPermissions.h"
#include "public/platform/WebData.h"
#include "public/platform/WebDeviceMotionData.h"
+#include "public/platform/WebDeviceOrientationData.h"
#include "public/platform/WebPoint.h"
#include "public/platform/WebURLResponse.h"
#include "public/testing/WebPreferences.h"
@@ -1545,22 +1546,32 @@ void TestRunner::setMockDeviceMotion(const CppArgumentList& arguments, CppVarian
void TestRunner::setMockDeviceOrientation(const CppArgumentList& arguments, CppVariant* result)
{
result->setNull();
- if (arguments.size() < 6 || !arguments[0].isBool() || !arguments[1].isNumber() || !arguments[2].isBool() || !arguments[3].isNumber() || !arguments[4].isBool() || !arguments[5].isNumber())
+ if (arguments.size() < 8
+ || !arguments[0].isBool() || !arguments[1].isNumber() // alpha
+ || !arguments[2].isBool() || !arguments[3].isNumber() // beta
+ || !arguments[4].isBool() || !arguments[5].isNumber() // gamma
+ || !arguments[6].isBool() || !arguments[7].isBool()) // absolute
return;
- WebDeviceOrientation orientation;
- orientation.setNull(false);
- if (arguments[0].toBoolean())
- orientation.setAlpha(arguments[1].toDouble());
- if (arguments[2].toBoolean())
- orientation.setBeta(arguments[3].toDouble());
- if (arguments[4].toBoolean())
- orientation.setGamma(arguments[5].toDouble());
-
- // Note that we only call setOrientation on the main page's mock since this
- // tests require. If necessary, we could get a list of WebViewHosts from th
- // call setOrientation on each DeviceOrientationClientMock.
- m_proxy->deviceOrientationClientMock()->setOrientation(orientation);
+ WebDeviceOrientationData orientation;
+
+ // alpha
+ orientation.hasAlpha = arguments[0].toBoolean();
+ orientation.alpha = arguments[1].toDouble();
+
+ // beta
+ orientation.hasBeta = arguments[2].toBoolean();
+ orientation.beta = arguments[3].toDouble();
+
+ // gamma
+ orientation.hasGamma = arguments[4].toBoolean();
+ orientation.gamma = arguments[5].toDouble();
+
+ // absolute
+ orientation.hasAbsolute = arguments[6].toBoolean();
+ orientation.absolute = arguments[7].toBoolean();
+
+ m_delegate->setDeviceOrientationData(orientation);
}
void TestRunner::setUserStyleSheetEnabled(const CppArgumentList& arguments, CppVariant* result)
« no previous file with comments | « Source/core/page/DOMWindow.cpp ('k') | public/testing/WebTestDelegate.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698