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

Side by Side Diff: base/test/android/jni_test_util.cc

Issue 2735113003: Changing SpawnChild to return a struct.
Patch Set: Created 3 years, 9 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 | « base/test/android/jni_test_util.h ('k') | base/test/multiprocess_test.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 // Copyright 2017 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #include "base/test/android/jni_test_util.h"
6
7 #include "base/android/jni_android.h"
8
9 namespace base {
10 namespace android {
11 namespace test {
12
13 ScopedJavaLocalRef<jobject> CreateJavaPoint(jint x, jint y) {
14 JNIEnv* env = AttachCurrentThread();
15
16 ScopedJavaLocalRef<jclass> point_jclass =
17 GetClass(env, "android/graphics/Point");
18
19 jmethodID point_constructor = MethodID::Get<MethodID::TYPE_INSTANCE>(
20 env, point_jclass.obj(), "<init>", "(II)V");
21
22 jobject point_obj =
23 env->NewObject(point_jclass.obj(), point_constructor, x, y);
24 return ScopedJavaLocalRef<jobject>(env, point_obj);
25 }
26
27 bool AreJavaObjectsEqual(jobject object1, jobject object2) {
28 if (object1 == nullptr || object2 == nullptr)
29 return object1 == object2;
30
31 JNIEnv* env = AttachCurrentThread();
32
33 ScopedJavaLocalRef<jclass> object_jclass = GetClass(env, "java/lang/Object");
34
35 jmethodID equal_method_id = MethodID::Get<MethodID::TYPE_INSTANCE>(
36 env, object_jclass.obj(), "equals", "(Ljava/lang/Object;)Z");
37
38 bool result = env->CallBooleanMethod(object1, equal_method_id, object2);
39 CheckException(env);
40 return result;
41 }
42
43 } // namespace test
44 } // namespace android
45 } // namespace base
OLDNEW
« no previous file with comments | « base/test/android/jni_test_util.h ('k') | base/test/multiprocess_test.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698