Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(366)

Side by Side Diff: mojo/android/javatests/validation_test_util.cc

Issue 601163002: mojo: Fix mojo test on Art runtime. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: CHECJ size is 0 Created 6 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 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 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "mojo/android/javatests/validation_test_util.h" 5 #include "mojo/android/javatests/validation_test_util.h"
6 6
7 #include "base/android/jni_android.h" 7 #include "base/android/jni_android.h"
8 #include "base/android/jni_string.h" 8 #include "base/android/jni_string.h"
9 #include "base/android/scoped_java_ref.h" 9 #include "base/android/scoped_java_ref.h"
10 #include "base/test/test_support_android.h" 10 #include "base/test/test_support_android.h"
(...skipping 13 matching lines...) Expand all
24 std::vector<uint8_t> data; 24 std::vector<uint8_t> data;
25 size_t num_handles; 25 size_t num_handles;
26 std::string error_message; 26 std::string error_message;
27 if (!test::ParseValidationTestInput( 27 if (!test::ParseValidationTestInput(
28 input, &data, &num_handles, &error_message)) { 28 input, &data, &num_handles, &error_message)) {
29 ScopedJavaLocalRef<jstring> j_error_message = 29 ScopedJavaLocalRef<jstring> j_error_message =
30 base::android::ConvertUTF8ToJavaString(env, error_message); 30 base::android::ConvertUTF8ToJavaString(env, error_message);
31 return Java_ValidationTestUtil_buildData( 31 return Java_ValidationTestUtil_buildData(
32 env, NULL, 0, j_error_message.obj()).Release(); 32 env, NULL, 0, j_error_message.obj()).Release();
33 } 33 }
34 34 void* data_ptr = &data[0];
35 if (!data_ptr) {
36 DCHECK(!data.size());
37 data_ptr = &data;
38 }
35 jobject byte_buffer = 39 jobject byte_buffer =
36 env->NewDirectByteBuffer(&data[0], data.size()); 40 env->NewDirectByteBuffer(data_ptr, data.size());
37 return Java_ValidationTestUtil_buildData(env, byte_buffer, num_handles, NULL) 41 return Java_ValidationTestUtil_buildData(env, byte_buffer, num_handles, NULL)
38 .Release(); 42 .Release();
39 } 43 }
40 44
41 } // namespace android 45 } // namespace android
42 } // namespace mojo 46 } // namespace mojo
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698