blob: 9ea6df61eace6401ee7d24e8e3cf16b101cbac60 [file] [log] [blame]
Avi Drissman4e1b7bc32022-09-15 14:03:501// Copyright 2019 The Chromium Authors
Donn Denman9b12031a2019-08-21 16:45:372// Use of this source code is governed by a BSD-style license that can be
3// found in the LICENSE file.
4
Theo Cristeaa964e87e2024-12-04 18:08:405#include "ui/android/test_view_android_delegate.h"
Donn Denman9b12031a2019-08-21 16:45:376
7#include "base/android/scoped_java_ref.h"
Donn Denman9b12031a2019-08-21 16:45:378#include "ui/android/view_android.h"
9
Andrew Grieveecb885bb2024-05-29 18:14:1910// Must come after all headers that specialize FromJniType() / ToJniType().
Theo Cristeaa964e87e2024-12-04 18:08:4011#include "ui/android/ui_javatest_jni_headers/TestViewAndroidDelegate_jni.h"
Andrew Grieveecb885bb2024-05-29 18:14:1912
Theo Cristeaa964e87e2024-12-04 18:08:4013namespace ui {
Donn Denman9b12031a2019-08-21 16:45:3714
15TestViewAndroidDelegate::TestViewAndroidDelegate() {}
16TestViewAndroidDelegate::~TestViewAndroidDelegate() {}
17
18void TestViewAndroidDelegate::SetupTestDelegate(ui::ViewAndroid* view_android) {
19 JNIEnv* env = base::android::AttachCurrentThread();
20 auto test_delegate = Java_TestViewAndroidDelegate_create(env);
21 view_android->SetDelegate(test_delegate);
22 j_delegate_.Reset(test_delegate);
23}
24
25void TestViewAndroidDelegate::InsetViewportBottom(int bottom) {
26 JNIEnv* env = base::android::AttachCurrentThread();
27 Java_TestViewAndroidDelegate_insetViewportBottom(env, j_delegate_, bottom);
28}
29
Theo Cristeaa964e87e2024-12-04 18:08:4030} // namespace ui