OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 "base/android/jni_array.h" | 5 #include "base/android/jni_array.h" |
6 | 6 |
7 #include "base/android/jni_android.h" | 7 #include "base/android/jni_android.h" |
8 #include "base/android/scoped_java_ref.h" | 8 #include "base/android/scoped_java_ref.h" |
9 #include "testing/gtest/include/gtest/gtest.h" | 9 #include "testing/gtest/googletest/include/gtest/gtest.h" |
10 | 10 |
11 namespace base { | 11 namespace base { |
12 namespace android { | 12 namespace android { |
13 | 13 |
14 TEST(JniArray, BasicConversions) { | 14 TEST(JniArray, BasicConversions) { |
15 const uint8_t kBytes[] = {0, 1, 2, 3}; | 15 const uint8_t kBytes[] = {0, 1, 2, 3}; |
16 const size_t kLen = arraysize(kBytes); | 16 const size_t kLen = arraysize(kBytes); |
17 JNIEnv* env = AttachCurrentThread(); | 17 JNIEnv* env = AttachCurrentThread(); |
18 ScopedJavaLocalRef<jbyteArray> bytes = ToJavaByteArray(env, kBytes, kLen); | 18 ScopedJavaLocalRef<jbyteArray> bytes = ToJavaByteArray(env, kBytes, kLen); |
19 ASSERT_TRUE(bytes.obj()); | 19 ASSERT_TRUE(bytes.obj()); |
(...skipping 264 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
284 | 284 |
285 EXPECT_EQ(kNumItems, out.size()); | 285 EXPECT_EQ(kNumItems, out.size()); |
286 CheckIntArrayConversion(env, int_array0, out[0], kLen0); | 286 CheckIntArrayConversion(env, int_array0, out[0], kLen0); |
287 CheckIntArrayConversion(env, int_array1, out[1], kLen1); | 287 CheckIntArrayConversion(env, int_array1, out[1], kLen1); |
288 CheckIntArrayConversion(env, int_array2, out[2], kLen2); | 288 CheckIntArrayConversion(env, int_array2, out[2], kLen2); |
289 CheckIntArrayConversion(env, int_array3, out[3], kLen3); | 289 CheckIntArrayConversion(env, int_array3, out[3], kLen3); |
290 } | 290 } |
291 | 291 |
292 } // namespace android | 292 } // namespace android |
293 } // namespace base | 293 } // namespace base |
OLD | NEW |