Merge Chromium + Blink git repositories
[chromium-blink-merge.git] / build / android / pylib / remote / device / remote_device_helper.py
blob1b02207a027a2a354fe25e53ac5d8fc954649dc3
1 # Copyright 2014 The Chromium Authors. All rights reserved.
2 # Use of this source code is governed by a BSD-style license that can be
3 # found in the LICENSE file.
5 """Common functions and Exceptions for remote_device_*"""
7 from devil import base_error
10 class RemoteDeviceError(base_error.BaseError):
11 """Exception to throw when problems occur with remote device service."""
12 pass
15 def TestHttpResponse(response, error_msg):
16 """Checks the Http response from remote device service.
18 Args:
19 response: response dict from the remote device service.
20 error_msg: Error message to display if bad response is seen.
21 """
22 if response.status_code != 200:
23 raise RemoteDeviceError(
24 '%s (%d: %s)' % (error_msg, response.status_code, response.reason))