Flutter Engine
The Flutter Engine
MemoryLeakTests.java
Go to the documentation of this file.
1// Copyright 2013 The Flutter 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.
4
5package dev.flutter.scenariosui;
6
7import android.content.Intent;
8import androidx.annotation.NonNull;
9import androidx.test.ext.junit.runners.AndroidJUnit4;
10import androidx.test.filters.LargeTest;
11import androidx.test.rule.ActivityTestRule;
12import dev.flutter.scenarios.PlatformViewsActivity;
13import leakcanary.FailTestOnLeak;
14import org.junit.Rule;
15import org.junit.Test;
16import org.junit.runner.RunWith;
17
18@RunWith(AndroidJUnit4.class)
19@LargeTest
20public class MemoryLeakTests {
21 @Rule @NonNull
22 public ActivityTestRule<PlatformViewsActivity> activityRule =
23 new ActivityTestRule<>(
24 PlatformViewsActivity.class, /*initialTouchMode=*/ false, /*launchActivity=*/ false);
25
26 @Test
27 @FailTestOnLeak
29 Intent intent = new Intent(Intent.ACTION_MAIN);
30 intent.putExtra("scenario_name", "platform_view");
31 intent.putExtra("use_android_view", true);
32 intent.putExtra("view_type", PlatformViewsActivity.TEXT_VIEW_PV);
33
34 activityRule.launchActivity(intent);
35 }
36}
ActivityTestRule< PlatformViewsActivity > activityRule