Chameleon: Move DisplayInfo from server to client
This is a part of CLs that moves logic from server to client.
This way helps code-reusability for client tests.
BUG=chromium:405143
TEST=Ran display_ResolutionList passed on Falco
Change-Id: I627298ea28fb82d3d9df57e81a8cc0629905ee57
Reviewed-on: https://chromium-review.googlesource.com/226106
Tested-by: Wai-Hong Tam <waihong@chromium.org>
Reviewed-by: Hung-ying Tyan <tyanh@chromium.org>
Commit-Queue: Wai-Hong Tam <waihong@chromium.org>
diff --git a/client/cros/multimedia/display_helper.py b/client/cros/multimedia/display_helper.py
new file mode 100644
index 0000000..5502de2
--- /dev/null
+++ b/client/cros/multimedia/display_helper.py
@@ -0,0 +1,54 @@
+# Copyright 2014 The Chromium OS Authors. All rights reserved.
+# Use of this source code is governed by a BSD-style license that can be
+# found in the LICENSE file.
+
+"""Helper related to display."""
+
+class DisplayInfo(object):
+ """The class match displayInfo object from chrome.system.display API.
+ """
+
+ class Bounds(object):
+ """The class match Bounds object from chrome.system.display API.
+
+ @param left: The x-coordinate of the upper-left corner.
+ @param top: The y-coordinate of the upper-left corner.
+ @param width: The width of the display in pixels.
+ @param height: The height of the display in pixels.
+ """
+ def __init__(self, d):
+ self.left = d['left']
+ self.top = d['top']
+ self.width = d['width']
+ self.height = d['height']
+
+
+ class Insets(object):
+ """The class match Insets object from chrome.system.display API.
+
+ @param left: The x-axis distance from the left bound.
+ @param left: The y-axis distance from the top bound.
+ @param left: The x-axis distance from the right bound.
+ @param left: The y-axis distance from the bottom bound.
+ """
+
+ def __init__(self, d):
+ self.left = d['left']
+ self.top = d['top']
+ self.right = d['right']
+ self.bottom = d['bottom']
+
+
+ def __init__(self, d):
+ self.display_id = d['id']
+ self.name = d['name']
+ self.mirroring_source_id = d['mirroringSourceId']
+ self.is_primary = d['isPrimary']
+ self.is_internal = d['isInternal']
+ self.is_enabled = d['isEnabled']
+ self.dpi_x = d['dpiX']
+ self.dpi_y = d['dpiY']
+ self.rotation = d['rotation']
+ self.bounds = self.Bounds(d['bounds'])
+ self.overscan = self.Insets(d['overscan'])
+ self.work_area = self.Bounds(d['workArea'])
diff --git a/server/cros/chameleon/display_client.py b/server/cros/chameleon/display_client.py
index 711ddd1..5b327b2 100644
--- a/server/cros/chameleon/display_client.py
+++ b/server/cros/chameleon/display_client.py
@@ -7,59 +7,10 @@
from PIL import Image
+from autotest_lib.client.cros.multimedia.display_helper import DisplayInfo
from autotest_lib.server.cros.chameleon import image_generator
-class DisplayInfo(object):
- """The class match displayInfo object from chrome.system.display API.
- """
-
- class Bounds(object):
- """The class match Bounds object from chrome.system.display API.
-
- @param left: The x-coordinate of the upper-left corner.
- @param top: The y-coordinate of the upper-left corner.
- @param width: The width of the display in pixels.
- @param height: The height of the display in pixels.
- """
- def __init__(self, d):
- self.left = d['left']
- self.top = d['top']
- self.width = d['width']
- self.height = d['height']
-
-
- class Insets(object):
- """The class match Insets object from chrome.system.display API.
-
- @param left: The x-axis distance from the left bound.
- @param left: The y-axis distance from the top bound.
- @param left: The x-axis distance from the right bound.
- @param left: The y-axis distance from the bottom bound.
- """
-
- def __init__(self, d):
- self.left = d['left']
- self.top = d['top']
- self.right = d['right']
- self.bottom = d['bottom']
-
-
- def __init__(self, d):
- self.display_id = d['id']
- self.name = d['name']
- self.mirroring_source_id = d['mirroringSourceId']
- self.is_primary = d['isPrimary']
- self.is_internal = d['isInternal']
- self.is_enabled = d['isEnabled']
- self.dpi_x = d['dpiX']
- self.dpi_y = d['dpiY']
- self.rotation = d['rotation']
- self.bounds = self.Bounds(d['bounds'])
- self.overscan = self.Insets(d['overscan'])
- self.work_area = self.Bounds(d['workArea'])
-
-
class DisplayClient(object):
"""DisplayClient is a layer to control display logic over a remote DUT.