Commit a8af5943 authored by qsr's avatar qsr Committed by Commit bot

mojo: Fix mojo test on Art runtime.

Due to the following bug:
https://code.google.com/p/android/issues/detail?id=76644, it is not
possible in art to create an empty buffer for address NULL. This solve
the issue by creating an empty buffer on a random address. This is not
an issue as the memory will never be accessed.

BUG=406848
R=ppi@chromium.org,yfriedman@chromium.org

Review URL: https://codereview.chromium.org/601163002

Cr-Commit-Position: refs/heads/master@{#296964}
parent 55ed6724
......@@ -31,9 +31,13 @@ jobject ParseData(JNIEnv* env, jclass jcaller, jstring data_as_string) {
return Java_ValidationTestUtil_buildData(
env, NULL, 0, j_error_message.obj()).Release();
}
void* data_ptr = &data[0];
if (!data_ptr) {
DCHECK(!data.size());
data_ptr = &data;
}
jobject byte_buffer =
env->NewDirectByteBuffer(&data[0], data.size());
env->NewDirectByteBuffer(data_ptr, data.size());
return Java_ValidationTestUtil_buildData(env, byte_buffer, num_handles, NULL)
.Release();
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment