adb unittest: get test_unicode_paths passing on win32

The Python 2 subprocess class doesn't use Unicode, so as a work-around
write the command line to a UTF-8 batch file and run that.

I modified the test to use u'blah' without .encode('utf-8') because the
Python docs recommend dealing with string variables like that. When
formatting a string with a unicode parameter, use u'foo' on the constant
string to make it unicode.

I also tested this on Linux and it seems to work fine (I did ls in the
middle of the test to make sure the filenames came out right, etc.).

I had to close the temporary files before adb tries to read/write them
because filesystem semantics are different on Windows (technically I
might be able to modify adb to try to open files with more permissive
share flags, but then I'm not sure if Python uses the right share flags.
Basically, I'd be opening another can of worms.).

Fixed the test to delete a temp file on the device once it is done.

Change-Id: Id0c34e26d7697fbbb47a44ae45298bed5e8c59d6
Signed-off-by: Spencer Low <CompareAndSwap@gmail.com>
2 files changed