Skip to content

Commit

Permalink
Merge pull request #816 from TikhomirovSergey/mykola-mokhnach-push_file
Browse files Browse the repository at this point in the history
push file. The addition to the #812
  • Loading branch information
TikhomirovSergey authored Jan 20, 2018
2 parents a84490c + be484e1 commit ca0ffb8
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
3 changes: 2 additions & 1 deletion src/main/java/io/appium/java_client/MobileCommand.java
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
import org.openqa.selenium.remote.CommandInfo;
import org.openqa.selenium.remote.http.HttpMethod;

import java.nio.charset.StandardCharsets;
import java.time.Duration;
import java.util.AbstractMap;
import java.util.HashMap;
Expand Down Expand Up @@ -376,7 +377,7 @@ public static ImmutableMap<String, Object> prepareArguments(String[] params,
*/
public static Map.Entry<String, Map<String, ?>> pushFileCommand(String remotePath, byte[] base64Data) {
String[] parameters = new String[] {"path", "data"};
Object[] values = new Object[] {remotePath, base64Data};
Object[] values = new Object[]{remotePath, new String(base64Data, StandardCharsets.UTF_8)};
return new AbstractMap.SimpleEntry<>(PUSH_FILE, prepareArguments(parameters, values));
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ public class AndroidDriverTest extends BaseAndroidTest {
.getBytes());
driver.pushFile("/data/local/tmp/remote.txt", data);
byte[] returnData = driver.pullFile("/data/local/tmp/remote.txt");
String returnDataDecoded = new String(Base64.decodeBase64(returnData));
String returnDataDecoded = new String(returnData);
assertEquals(
"The eventual code is no more than the deposit of your understanding. ~E. W. Dijkstra",
returnDataDecoded);
Expand All @@ -75,7 +75,7 @@ public class AndroidDriverTest extends BaseAndroidTest {
+ "more than the deposit of your understanding. ~E. W. Dijkstra", "UTF-8", true);
driver.pushFile("/data/local/tmp/remote2.txt", temp);
byte[] returnData = driver.pullFile("/data/local/tmp/remote2.txt");
String returnDataDecoded = new String(Base64.decodeBase64(returnData));
String returnDataDecoded = new String(returnData);
assertEquals(
"The eventual code is no more than the deposit of "
+ "your understanding. ~E. W. Dijkstra",
Expand Down

0 comments on commit ca0ffb8

Please sign in to comment.