Skip to content

Commit

Permalink
Added environment variable
Browse files Browse the repository at this point in the history
Added ANDROID_VIEW_CLIENT_HOME
  • Loading branch information
dtmilano committed Feb 4, 2012
1 parent 3f396e8 commit 2ef200d
Show file tree
Hide file tree
Showing 5 changed files with 5 additions and 3 deletions.
Binary file modified AndroidViewClient/src/com/__init__$py.class
Binary file not shown.
Binary file modified AndroidViewClient/src/com/dtmilano/__init__$py.class
Binary file not shown.
Binary file modified AndroidViewClient/src/com/dtmilano/android/__init__$py.class
Binary file not shown.
Binary file modified AndroidViewClient/src/com/dtmilano/android/viewclient$py.class
Binary file not shown.
8 changes: 5 additions & 3 deletions AndroidViewClient/src/com/dtmilano/android/viewclient.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,14 @@
@author: diego
'''

import unittest
import subprocess
import re
import socket
import os

DEBUG = False

ANDROID_HOME = os.environ['ANDROID_HOME'] if os.environ.has_key('ANDROID_HOME') else '/Users/diego/opt/android-sdk'
ANDROID_HOME = os.environ['ANDROID_HOME'] if os.environ.has_key('ANDROID_HOME') else '/opt/android-sdk'
VIEW_SERVER_HOST = 'localhost'
VIEW_SERVER_PORT = 4939

Expand All @@ -25,6 +24,8 @@ class ViewClient:
'''

def __init__(self, device):
if not device:
raise Exception('Device is not connected')
if not self.serviceResponse(device.shell('service call window 3')):
self.assertServiceResponse(device.shell('service call window 1 i32 %d' %
VIEW_SERVER_PORT))
Expand All @@ -35,7 +36,8 @@ def __init__(self, device):
self.viewsById = {}

def assertServiceResponse(self, response):
unittest.assertTrue(self.serviceResponse(response))
if not self.serviceResponse(response):
raise Exception('Invalid response received from service.')

def serviceResponse(self, response):
return response == "Result: Parcel(00000000 00000001 '........')\r\n"
Expand Down

0 comments on commit 2ef200d

Please sign in to comment.