This repository has been archived by the owner on Feb 22, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 9.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[webview_flutter_android] Expose the Java InstanceManager (#6421)
- Loading branch information
1 parent
7c6c784
commit 0177355
Showing
6 changed files
with
65 additions
and
1 deletion.
There are no files selected for viewing
4 changes: 4 additions & 0 deletions
4
packages/webview_flutter/webview_flutter_android/CHANGELOG.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
45 changes: 45 additions & 0 deletions
45
...oid/android/src/test/java/io/flutter/plugins/webviewflutter/WebViewFlutterPluginTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
// Copyright 2013 The Flutter Authors. All rights reserved. | ||
// Use of this source code is governed by a BSD-style license that can be | ||
// found in the LICENSE file. | ||
|
||
package io.flutter.plugins.webviewflutter; | ||
|
||
import static org.junit.Assert.assertNotNull; | ||
import static org.mockito.Mockito.when; | ||
|
||
import android.content.Context; | ||
import io.flutter.embedding.engine.plugins.FlutterPlugin; | ||
import io.flutter.plugin.common.BinaryMessenger; | ||
import io.flutter.plugin.platform.PlatformViewRegistry; | ||
import org.junit.Rule; | ||
import org.junit.Test; | ||
import org.mockito.Mock; | ||
import org.mockito.junit.MockitoJUnit; | ||
import org.mockito.junit.MockitoRule; | ||
|
||
public class WebViewFlutterPluginTest { | ||
@Rule public MockitoRule mockitoRule = MockitoJUnit.rule(); | ||
|
||
@Mock Context mockContext; | ||
|
||
@Mock BinaryMessenger mockBinaryMessenger; | ||
|
||
@Mock PlatformViewRegistry mockViewRegistry; | ||
|
||
@Mock FlutterPlugin.FlutterPluginBinding mockPluginBinding; | ||
|
||
@Test | ||
public void getInstanceManagerAfterOnAttachedToEngine() { | ||
final WebViewFlutterPlugin webViewFlutterPlugin = new WebViewFlutterPlugin(); | ||
|
||
when(mockPluginBinding.getApplicationContext()).thenReturn(mockContext); | ||
when(mockPluginBinding.getPlatformViewRegistry()).thenReturn(mockViewRegistry); | ||
when(mockPluginBinding.getBinaryMessenger()).thenReturn(mockBinaryMessenger); | ||
|
||
webViewFlutterPlugin.onAttachedToEngine(mockPluginBinding); | ||
|
||
assertNotNull(webViewFlutterPlugin.getInstanceManager()); | ||
|
||
webViewFlutterPlugin.onDetachedFromEngine(mockPluginBinding); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters