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

Unified Diff: tools/telemetry/telemetry/internal/actions/drag_unittest.py

Issue 1647513002: Delete tools/telemetry. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 11 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: tools/telemetry/telemetry/internal/actions/drag_unittest.py
diff --git a/tools/telemetry/telemetry/internal/actions/drag_unittest.py b/tools/telemetry/telemetry/internal/actions/drag_unittest.py
deleted file mode 100644
index 439ade62c920de5fd780212aa24542eaa0078d45..0000000000000000000000000000000000000000
--- a/tools/telemetry/telemetry/internal/actions/drag_unittest.py
+++ /dev/null
@@ -1,71 +0,0 @@
-# Copyright 2015 The Chromium Authors. All rights reserved.
-# Use of this source code is governed by a BSD-style license that can be
-# found in the LICENSE file.
-import logging
-import math
-import os
-
-from telemetry import decorators
-from telemetry.internal.actions import drag
-from telemetry.internal.actions import page_action
-from telemetry.testing import tab_test_case
-
-
-class DragActionTest(tab_test_case.TabTestCase):
- def CheckWithinRange(self, value, expected, error_ratio):
- error_range = abs(expected * error_ratio)
- return abs(value - expected) <= error_range
-
- @decorators.Disabled('chromeos') # crbug.com/483212
- def testDragAction(self):
- self.Navigate('draggable.html')
-
- with open(os.path.join(os.path.dirname(__file__),
- 'gesture_common.js')) as f:
- js = f.read()
- self._tab.ExecuteJavaScript(js)
-
- div_width = self._tab.EvaluateJavaScript(
- '__GestureCommon_GetBoundingVisibleRect(document.body).width')
- div_height = self._tab.EvaluateJavaScript(
- '__GestureCommon_GetBoundingVisibleRect(document.body).height')
-
- i = drag.DragAction(left_start_ratio=0.5, top_start_ratio=0.5,
- left_end_ratio=0.25, top_end_ratio=0.25)
- try:
- i.WillRunAction(self._tab)
- except page_action.PageActionNotSupported:
- logging.warning('This browser does not support drag gesture. Please try'
- ' updating chrome.')
- return
-
- self._tab.ExecuteJavaScript('''
- window.__dragAction.beginMeasuringHook = function() {
- window.__didBeginMeasuring = true;
- };
- window.__dragAction.endMeasuringHook = function() {
- window.__didEndMeasuring = true;
- };''')
- i.RunAction(self._tab)
-
- self.assertTrue(self._tab.EvaluateJavaScript('window.__didBeginMeasuring'))
- self.assertTrue(self._tab.EvaluateJavaScript('window.__didEndMeasuring'))
-
- div_position_x = self._tab.EvaluateJavaScript(
- 'document.getElementById("drag_div").offsetLeft')
- div_position_y = self._tab.EvaluateJavaScript(
- 'document.getElementById("drag_div").offsetTop')
-
- # 0.25 is the ratio of displacement to the initial size.
- expected_x = math.floor(div_width * -0.25)
- expected_y = math.floor(div_height * -0.25)
- error_ratio = 0.1
-
- self.assertTrue(
- self.CheckWithinRange(div_position_x, expected_x, error_ratio),
- msg="Moved element's left coordinate: %d, expected: %d" %
- (div_position_x, expected_x))
- self.assertTrue(
- self.CheckWithinRange(div_position_y, expected_y, error_ratio),
- msg="Moved element's top coordinate: %d, expected: %d" %
- (div_position_y, expected_y))
« no previous file with comments | « tools/telemetry/telemetry/internal/actions/drag.py ('k') | tools/telemetry/telemetry/internal/actions/gesture_common.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698