1
    2
    3
    4
    5
    6
    7
    8
    9
   10
   11
   12
   13
   14
   15
   16
   17
   18
   19
   20
   21
   22
   23
   24
   25
   26

base / android / token_android_unittest.cc [blame]

// Copyright 2024 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#include "base/android/token_android.h"

#include "base/android/jni_android.h"
#include "testing/gtest/include/gtest/gtest.h"

namespace base {
namespace android {

TEST(TokenAndroid, CreateToken) {
  JNIEnv* env = AttachCurrentThread();
  uint64_t high = 0xDEADBEEF12345678;
  uint64_t low = 0xABCDEF0123456789;

  base::Token token(high, low);
  ScopedJavaLocalRef<jobject> j_token = TokenAndroid::Create(env, token);
  base::Token result = TokenAndroid::FromJavaToken(env, j_token);

  EXPECT_EQ(token, result);
}

}  // namespace android
}  // namespace base