| // Copyright 2019 The Chromium Authors. All rights reserved. |
| // Use of this source code is governed by a BSD-style license that can be |
| // found in the LICENSE file. |
| #include "android_webview/test/webview_instrumentation_test_native_jni/MemoryMetricsLoggerUtils_jni.h" |
| #include "base/run_loop.h" |
| #include "base/test/bind.h" |
| #include "base/test/task_environment.h" |
| #include "base/test/test_timeouts.h" |
| #include "components/embedder_support/android/metrics/memory_metrics_logger.h" |
| namespace android_webview { |
| jboolean JNI_MemoryMetricsLoggerUtils_ForceRecordHistograms(JNIEnv* env) { |
| auto* memory_metrics_logger = |
| ::metrics::MemoryMetricsLogger::GetInstanceForTesting(); |
| if (!memory_metrics_logger) |
| TestTimeouts::Initialize(); |
| base::test::SingleThreadTaskEnvironment task_environment; |
| memory_metrics_logger->ScheduleRecordForTesting( |
| base::BindLambdaForTesting([&](bool success) { |
| } // namespace android_webview |