Remove use of JSONReader::DeprecatedRead from activity_log
[chromium-blink-merge.git] / base / android / jni_string_unittest.cc
blob3da8b870e6649bfc4140ef2881fe21a30c205471
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
3 // found in the LICENSE file.
5 #include "base/android/jni_string.h"
7 #include "base/android/jni_android.h"
8 #include "base/android/scoped_java_ref.h"
9 #include "base/strings/utf_string_conversions.h"
10 #include "testing/gtest/include/gtest/gtest.h"
12 namespace base {
13 namespace android {
15 TEST(JniString, BasicConversionsUTF8) {
16 const std::string kSimpleString = "SimpleTest8";
17 JNIEnv* env = AttachCurrentThread();
18 std::string result =
19 ConvertJavaStringToUTF8(ConvertUTF8ToJavaString(env, kSimpleString));
20 EXPECT_EQ(kSimpleString, result);
23 TEST(JniString, BasicConversionsUTF16) {
24 const string16 kSimpleString = UTF8ToUTF16("SimpleTest16");
25 JNIEnv* env = AttachCurrentThread();
26 string16 result =
27 ConvertJavaStringToUTF16(ConvertUTF16ToJavaString(env, kSimpleString));
28 EXPECT_EQ(kSimpleString, result);
31 TEST(JniString, EmptyConversionUTF8) {
32 const std::string kEmptyString = "";
33 JNIEnv* env = AttachCurrentThread();
34 std::string result =
35 ConvertJavaStringToUTF8(ConvertUTF8ToJavaString(env, kEmptyString));
36 EXPECT_EQ(kEmptyString, result);
39 TEST(JniString, EmptyConversionUTF16) {
40 const string16 kEmptyString = UTF8ToUTF16("");
41 JNIEnv* env = AttachCurrentThread();
42 string16 result =
43 ConvertJavaStringToUTF16(ConvertUTF16ToJavaString(env, kEmptyString));
44 EXPECT_EQ(kEmptyString, result);
47 } // namespace android
48 } // namespace base