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

Unified Diff: third_party/WebKit/LayoutTests/inspector-protocol/input/eventTimestamp.html

Issue 2961493002: [DevTools] Migrate inspector-protocol/{input,network} tests to new harness (Closed)
Patch Set: minor fixes Created 3 years, 6 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
Index: third_party/WebKit/LayoutTests/inspector-protocol/input/eventTimestamp.html
diff --git a/third_party/WebKit/LayoutTests/inspector-protocol/input/eventTimestamp.html b/third_party/WebKit/LayoutTests/inspector-protocol/input/eventTimestamp.html
deleted file mode 100644
index 27e903f8d6ebd64aeab76816bcbd1f7dc14f7d4d..0000000000000000000000000000000000000000
--- a/third_party/WebKit/LayoutTests/inspector-protocol/input/eventTimestamp.html
+++ /dev/null
@@ -1,124 +0,0 @@
-<script type="text/javascript" src="../../http/tests/inspector-protocol/resources/inspector-protocol-test.js"></script>
-<script>
-window.addEventListener("keydown", logEvent);
-window.addEventListener("mousedown", logEvent);
-window.addEventListener("touchstart", logEvent);
-
-var receivedTimestamps = [];
-
-function logEvent(event)
-{
- log("-----Event-----");
- log("type: " + event.type);
- receivedTimestamps.push(event.timeStamp);
-}
-
-function verifyTimestamps()
-{
- log("-----Verify-----");
- log("Received " + receivedTimestamps.length + " timestamps");
-
- // Event.timeStamp values are in milliseconds
- var expectedOffsets = [0, 5000, 10000, 15000, 20000, 25000];
- var receivedOffsets = receivedTimestamps.map(function(timestamp) {
- return timestamp - receivedTimestamps[0];
- });
- for (var i = 0; i < receivedOffsets.length; ++i) {
- if (isNear(receivedOffsets[i], expectedOffsets[i]))
- log("timeStamps offsets is as expected.");
- else
- log("timeStamp offset is expected " + expectedOffsets[i] + " but it is:" + receivedOffsets[i]);
- }
-
- function isNear(a, b) {
- var epsilon = 0.5;
- return Math.abs(b - a) < epsilon;
- }
-
-}
-
-function test()
-{
- // We send epoch timestamp but expect to receive high-res timestamps
- var baseEpochTimestamp = Date.now() / 1000; // in seconds
- var sentTimestamps = [0, 5, 10, 15, 20, 25].map(function(offset) {
- return baseEpochTimestamp + offset;
- });
-
- var commands = [{
- value: "Input.dispatchKeyEvent",
- event: {
- "type": "rawKeyDown",
- "timestamp": sentTimestamps[0]
- }
- }, {
- value: "Input.dispatchKeyEvent",
- event: {
- "type": "rawKeyDown",
- "timestamp": sentTimestamps[1]
- }
- }, {
- value: "Input.dispatchMouseEvent",
- event: {
- "type": "mousePressed",
- "timestamp": sentTimestamps[2],
- "button": "left",
- "clickCount": 1,
- "x": 100,
- "y": 200
- }
- }, {
- value: "Input.dispatchMouseEvent",
- event: {
- "type": "mousePressed",
- "timestamp": sentTimestamps[3],
- "button": "left",
- "clickCount": 1,
- "x": 100,
- "y": 200
- }
- }, {
- value: "Input.dispatchTouchEvent",
- event: {
- "type": "touchStart",
- "timestamp": sentTimestamps[4],
- "touchPoints": [{
- "state": "touchPressed",
- "x": 100,
- "y": 200
- }]
- }
- }, {
- value: "Input.dispatchTouchEvent",
- event: {
- "type": "touchStart",
- "timestamp": sentTimestamps[5],
- "touchPoints": [{
- "state": "touchPressed",
- "x": 100,
- "y": 100
- }]
-
- }
- }];
-
- for (var i = 0; i < commands.length; i++)
- InspectorTest.sendCommand(commands[i].value, commands[i].event, checkResponse.bind(undefined, i == commands.length - 1));
-
- function checkResponse(isLastCommand, msg)
- {
- if (msg.error)
- InspectorTest.log("Error: " + msg.error.message);
- if (isLastCommand) {
- InspectorTest.sendCommandOrDie("Runtime.evaluate", {
- expression: 'verifyTimestamps()'
- }, function() {
- InspectorTest.completeTest();
- });
- }
- }
-}
-</script>
-
-<body onload="runTest()">
-</body>

Powered by Google App Engine
This is Rietveld 408576698