Bug 1434909 - Remove dependency to rectangles.html in test_position.py r=ato
authorBjörn Arnelid <bjorn.arnelid@gmail.com>
Wed, 07 Feb 2018 13:17:02 +0100
changeset 402798 04244826251464b44170d17b066a322c4c45d654
parent 402797 c388570c330fd7745f12eca3258cc3ae4b3d5bb2
child 402799 76c1582d760e117d1ce2befbc2af998c24760231
push id99659
push useraciure@mozilla.com
push dateWed, 07 Feb 2018 22:33:57 +0000
treeherdermozilla-inbound@5ceb1098fef3 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersato
bugs1434909
milestone60.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1434909 - Remove dependency to rectangles.html in test_position.py r=ato MozReview-Commit-ID: 75uJNm4ESOp
testing/marionette/harness/marionette_harness/tests/unit/test_position.py
testing/marionette/harness/marionette_harness/www/rectangles.html
--- a/testing/marionette/harness/marionette_harness/tests/unit/test_position.py
+++ b/testing/marionette/harness/marionette_harness/tests/unit/test_position.py
@@ -1,21 +1,47 @@
 # This Source Code Form is subject to the terms of the Mozilla Public
 # License, v. 2.0. If a copy of the MPL was not distributed with this
 # file, You can obtain one at http://mozilla.org/MPL/2.0/.
 
 from __future__ import absolute_import
 
+import urllib
+
 from marionette_driver.by import By
 
 from marionette_harness import MarionetteTestCase
 
 
+def inline(doc):
+    return "data:text/html;charset=utf-8,{}".format(urllib.quote(doc))
+
 class TestPosition(MarionetteTestCase):
-
     def test_should_get_element_position_back(self):
-        test_url = self.marionette.absolute_url('rectangles.html')
-        self.marionette.navigate(test_url)
+        doc = """
+        <head>
+            <title>Rectangles</title>
+            <style>
+                div {
+                    position: absolute;
+                    margin: 0;
+                    border: 0;
+                    padding: 0;
+                }
+                #r {
+                    background-color: red;
+                    left: 11px;
+                    top: 10px;
+                    width: 48.666666667px;
+                    height: 49.333333333px;
+                }
+            </style>
+        </head>
+        <body>
+            <div id="r">r</div>
+        </body>
+        """
+        self.marionette.navigate(inline(doc))
 
-        r2 = self.marionette.find_element(By.ID, "r2")
+        r2 = self.marionette.find_element(By.ID, "r")
         location = r2.rect
         self.assertEqual(11, location['x'])
         self.assertEqual(10, location['y'])
deleted file mode 100644
--- a/testing/marionette/harness/marionette_harness/www/rectangles.html
+++ /dev/null
@@ -1,40 +0,0 @@
-<?xml version="1.0"?>
-<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
-<head>
-    <title>Rectangles</title>
-    <style type="text/css">
-        div {
-            position: absolute;
-            margin: 0;
-            border: 0;
-            padding: 0;
-        }
-        #r1 {
-            background-color: blue;
-            left: 10px;
-            top: 10px;
-            width: 100px;
-            height: 50px;
-        }
-        #r2 {
-            background-color: red;
-            left: 11px;
-            top: 10px;
-            width: 48.666666667px;
-            height: 49.333333333px;
-        }
-        #r3 {
-            background-color: yellow;
-            left: 60px;
-            top: 10px;
-            width: 50px;
-            height: 25px;
-        }
-    </style>
-</head>
-    <body>
-        <div id="r1">r1</div>
-        <div id="r2">r2</div>
-        <div id="r3">r3</div>
-    </body>
-</html>