| 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 <stddef.h> |
| 7 #include <stdint.h> | 8 #include <stdint.h> |
| 8 | 9 |
| 9 #include <limits> | 10 #include <limits> |
| 10 | 11 |
| 11 #include "base/android/jni_android.h" | 12 #include "base/android/jni_android.h" |
| 12 #include "base/android/scoped_java_ref.h" | 13 #include "base/android/scoped_java_ref.h" |
| 14 #include "base/macros.h" |
| 13 #include "testing/gtest/include/gtest/gtest.h" | 15 #include "testing/gtest/include/gtest/gtest.h" |
| 14 | 16 |
| 15 namespace base { | 17 namespace base { |
| 16 namespace android { | 18 namespace android { |
| 17 | 19 |
| 18 TEST(JniArray, BasicConversions) { | 20 TEST(JniArray, BasicConversions) { |
| 19 const uint8_t kBytes[] = {0, 1, 2, 3}; | 21 const uint8_t kBytes[] = {0, 1, 2, 3}; |
| 20 const size_t kLen = arraysize(kBytes); | 22 const size_t kLen = arraysize(kBytes); |
| 21 JNIEnv* env = AttachCurrentThread(); | 23 JNIEnv* env = AttachCurrentThread(); |
| 22 ScopedJavaLocalRef<jbyteArray> bytes = ToJavaByteArray(env, kBytes, kLen); | 24 ScopedJavaLocalRef<jbyteArray> bytes = ToJavaByteArray(env, kBytes, kLen); |
| (...skipping 268 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 291 | 293 |
| 292 EXPECT_EQ(kNumItems, out.size()); | 294 EXPECT_EQ(kNumItems, out.size()); |
| 293 CheckIntArrayConversion(env, int_array0, out[0], kLen0); | 295 CheckIntArrayConversion(env, int_array0, out[0], kLen0); |
| 294 CheckIntArrayConversion(env, int_array1, out[1], kLen1); | 296 CheckIntArrayConversion(env, int_array1, out[1], kLen1); |
| 295 CheckIntArrayConversion(env, int_array2, out[2], kLen2); | 297 CheckIntArrayConversion(env, int_array2, out[2], kLen2); |
| 296 CheckIntArrayConversion(env, int_array3, out[3], kLen3); | 298 CheckIntArrayConversion(env, int_array3, out[3], kLen3); |
| 297 } | 299 } |
| 298 | 300 |
| 299 } // namespace android | 301 } // namespace android |
| 300 } // namespace base | 302 } // namespace base |
| OLD | NEW |