fixed shouldInterceptRequest String url Android, added initial tests using custom classes and functions

This commit is contained in:
Lorenzo Pichilli 2019-11-12 02:13:20 +01:00
parent 65f2d1061d
commit 8894ae1b1e
10 changed files with 551 additions and 183 deletions

View File

@ -15,15 +15,16 @@
</component>
<component name="ChangeListManager">
<list default="true" id="9b41f7a2-a71e-4923-91fb-249d7815b3e7" name="Default" comment="">
<change afterPath="$PROJECT_DIR$/example/test/custom_widget_test.dart" afterDir="false" />
<change afterPath="$PROJECT_DIR$/example/test/in_app_webview_initial_file_test.dart" afterDir="false" />
<change afterPath="$PROJECT_DIR$/example/test/in_app_webview_initial_url_test.dart" afterDir="false" />
<change afterPath="$PROJECT_DIR$/example/test/in_app_webview_on_load_resource_test.dart" afterDir="false" />
<change afterPath="$PROJECT_DIR$/example/test/main_test.dart" afterDir="false" />
<change afterPath="$PROJECT_DIR$/example/test/util_test.dart" afterDir="false" />
<change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" />
<change beforePath="$PROJECT_DIR$/CHANGELOG.md" beforeDir="false" afterPath="$PROJECT_DIR$/CHANGELOG.md" afterDir="false" />
<change beforePath="$PROJECT_DIR$/android/src/main/java/com/pichillilorenzo/flutter_inappbrowser/InAppWebView/InAppWebView.java" beforeDir="false" afterPath="$PROJECT_DIR$/android/src/main/java/com/pichillilorenzo/flutter_inappbrowser/InAppWebView/InAppWebView.java" afterDir="false" />
<change beforePath="$PROJECT_DIR$/android/src/main/java/com/pichillilorenzo/flutter_inappbrowser/InAppWebView/InAppWebViewClient.java" beforeDir="false" afterPath="$PROJECT_DIR$/android/src/main/java/com/pichillilorenzo/flutter_inappbrowser/InAppWebView/InAppWebViewClient.java" afterDir="false" />
<change beforePath="$PROJECT_DIR$/example/assets/index.html" beforeDir="false" afterPath="$PROJECT_DIR$/example/assets/index.html" afterDir="false" />
<change beforePath="$PROJECT_DIR$/example/lib/inline_example.screen.dart" beforeDir="false" afterPath="$PROJECT_DIR$/example/lib/inline_example.screen.dart" afterDir="false" />
<change beforePath="$PROJECT_DIR$/ios/Classes/InAppWebView.swift" beforeDir="false" afterPath="$PROJECT_DIR$/ios/Classes/InAppWebView.swift" afterDir="false" />
<change beforePath="$PROJECT_DIR$/lib/src/in_app_webview.dart" beforeDir="false" afterPath="$PROJECT_DIR$/lib/src/in_app_webview.dart" afterDir="false" />
<change beforePath="$PROJECT_DIR$/lib/src/types.dart" beforeDir="false" afterPath="$PROJECT_DIR$/lib/src/types.dart" afterDir="false" />
<change beforePath="$PROJECT_DIR$/example/lib/main.dart" beforeDir="false" afterPath="$PROJECT_DIR$/example/lib/main.dart" afterDir="false" />
<change beforePath="$PROJECT_DIR$/example/pubspec.yaml" beforeDir="false" afterPath="$PROJECT_DIR$/example/pubspec.yaml" afterDir="false" />
</list>
<ignored path="$PROJECT_DIR$/.dart_tool/" />
<ignored path="$PROJECT_DIR$/.idea/" />
@ -46,8 +47,8 @@
<file pinned="false" current-in-tab="false">
<entry file="file://$PROJECT_DIR$/lib/src/in_app_webview.dart">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="127">
<caret line="1105" column="38" selection-start-line="1105" selection-start-column="12" selection-end-line="1105" selection-end-column="38" />
<state relative-caret-position="175">
<caret line="253" column="38" selection-start-line="253" selection-start-column="38" selection-end-line="253" selection-end-column="38" />
<folding>
<element signature="e#0#17#0" expanded="true" />
</folding>
@ -55,23 +56,11 @@
</provider>
</entry>
</file>
<file pinned="false" current-in-tab="false">
<entry file="file://$PROJECT_DIR$/lib/src/types.dart">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="20">
<caret line="939" column="17" selection-start-line="939" selection-start-column="6" selection-end-line="939" selection-end-column="17" />
<folding>
<element signature="e#0#20#0" expanded="true" />
</folding>
</state>
</provider>
</entry>
</file>
<file pinned="false" current-in-tab="false">
<entry file="file://$PROJECT_DIR$/example/lib/inline_example.screen.dart">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="703">
<caret line="195" column="46" lean-forward="true" selection-start-line="195" selection-start-column="46" selection-end-line="195" selection-end-column="46" />
<state relative-caret-position="4">
<caret line="90" column="44" selection-start-line="90" selection-start-column="25" selection-end-line="90" selection-end-column="44" />
<folding>
<element signature="e#0#20#0" expanded="true" />
</folding>
@ -79,11 +68,26 @@
</provider>
</entry>
</file>
<file pinned="false" current-in-tab="false">
<entry file="file://$PROJECT_DIR$/nodejs_server_test_auth_basic_and_ssl/index.js">
<file pinned="false" current-in-tab="true">
<entry file="file://$PROJECT_DIR$/example/test/in_app_webview_on_load_resource_test.dart">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="258">
<caret line="127" column="25" selection-start-line="127" selection-start-column="10" selection-end-line="127" selection-end-column="25" />
<state relative-caret-position="255">
<caret line="17" column="64" selection-start-line="17" selection-start-column="64" selection-end-line="17" selection-end-column="64" />
<folding>
<element signature="e#0#39#0" expanded="true" />
</folding>
</state>
</provider>
</entry>
</file>
<file pinned="false" current-in-tab="false">
<entry file="file://$PROJECT_DIR$/example/test/in_app_webview_initial_file_test.dart">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="120">
<caret line="8" column="73" selection-start-line="8" selection-start-column="73" selection-end-line="8" selection-end-column="73" />
<folding>
<element signature="e#0#39#0" expanded="true" />
</folding>
</state>
</provider>
</entry>
@ -91,17 +95,41 @@
<file pinned="false" current-in-tab="false">
<entry file="file://$PROJECT_DIR$/example/assets/index.html">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="446">
<caret line="88" selection-start-line="88" selection-end-line="88" />
<state relative-caret-position="301">
<caret line="39" column="61" selection-start-line="39" selection-start-column="25" selection-end-line="39" selection-end-column="61" />
</state>
</provider>
</entry>
</file>
<file pinned="false" current-in-tab="true">
<entry file="file://$PROJECT_DIR$/CHANGELOG.md">
<file pinned="false" current-in-tab="false">
<entry file="file://$PROJECT_DIR$/example/test/in_app_webview_initial_url_test.dart">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="322">
<caret line="44" column="52" lean-forward="true" selection-start-line="44" selection-start-column="52" selection-end-line="44" selection-end-column="52" />
<state relative-caret-position="-260">
<caret line="5" column="33" selection-start-line="5" selection-start-column="33" selection-end-line="5" selection-end-column="33" />
<folding>
<element signature="e#0#39#0" expanded="true" />
</folding>
</state>
</provider>
</entry>
</file>
<file pinned="false" current-in-tab="false">
<entry file="file://$PROJECT_DIR$/example/test/util_test.dart">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="97">
<caret line="35" column="74" selection-start-line="35" selection-start-column="74" selection-end-line="35" selection-end-column="74" />
<folding>
<element signature="e#0#42#0" expanded="true" />
</folding>
</state>
</provider>
</entry>
</file>
<file pinned="false" current-in-tab="false">
<entry file="file://$PROJECT_DIR$/example/test/main_test.dart">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="-231">
<caret column="20" selection-start-column="20" selection-end-column="20" />
</state>
</provider>
</entry>
@ -118,7 +146,6 @@
</component>
<component name="FindInProjectRecents">
<findStrings>
<find>ClientCertResponse</find>
<find>weBVIEWCONTROL</find>
<find>getFa</find>
<find>supportZoom</find>
@ -148,6 +175,7 @@
<find>flutterInAppBrowserPlatformReady</find>
<find>evaluateJ</find>
<find>AjaxRequest</find>
<find>_onPlatformViewCreated</find>
</findStrings>
<replaceStrings>
<replace>activity.getPreferences(0)</replace>
@ -173,20 +201,6 @@
<component name="IdeDocumentHistory">
<option name="CHANGED_PATHS">
<list>
<option value="$PROJECT_DIR$/LICENSE" />
<option value="$PROJECT_DIR$/android/src/main/java/com/pichillilorenzo/flutter_inappbrowser/InAppBrowserDialog.java" />
<option value="$PROJECT_DIR$/android/src/main/java/com/pichillilorenzo/flutter_inappbrowser/InAppBrowserClient.java" />
<option value="$PROJECT_DIR$/android/src/main/java/com/pichillilorenzo/flutter_inappbrowser/InAppBrowser.java" />
<option value="$PROJECT_DIR$/example/ios/Podfile" />
<option value="$PROJECT_DIR$/example/html/css/style.css" />
<option value="$PROJECT_DIR$/example/html/index.html" />
<option value="$PROJECT_DIR$/example/ios/Flutter/Generated.xcconfig" />
<option value="$PROJECT_DIR$/android/gradle/wrapper/gradle-wrapper.properties" />
<option value="$PROJECT_DIR$/example/android/app/build.gradle" />
<option value="$PROJECT_DIR$/example/android/gradle.properties" />
<option value="$PROJECT_DIR$/example/android/build.gradle" />
<option value="$PROJECT_DIR$/example/assets/page-3.html" />
<option value="$PROJECT_DIR$/example/assets/page-2.html" />
<option value="$PROJECT_DIR$/example/assets/page-1.html" />
<option value="$PROJECT_DIR$/example/assets/css/style.css" />
<option value="$PROJECT_DIR$/ios/Classes/InAppWebView.swift" />
@ -196,7 +210,6 @@
<option value="$PROJECT_DIR$/lib/src/in_app_localhost_server.dart" />
<option value="$PROJECT_DIR$/lib/src/web_history.dart" />
<option value="$PROJECT_DIR$/example/ios/Runner/Info.plist" />
<option value="$PROJECT_DIR$/example/lib/main.dart" />
<option value="$PROJECT_DIR$/lib/src/credentials_database.dart" />
<option value="$PROJECT_DIR$/lib/flutter_inappbrowser.dart" />
<option value="$PROJECT_DIR$/lib/src/channel_manager.dart" />
@ -205,10 +218,8 @@
<option value="$PROJECT_DIR$/lib/t_rex_runner/index.css" />
<option value="$PROJECT_DIR$/lib/t_rex_runner/index.html" />
<option value="$PROJECT_DIR$/lib/t_rex_runner/t-rex.html" />
<option value="$PROJECT_DIR$/pubspec.yaml" />
<option value="$PROJECT_DIR$/lib/t_rex_runner/t-rex.css" />
<option value="$PROJECT_DIR$/example/lib/test.dart" />
<option value="$PROJECT_DIR$/example/pubspec.yaml" />
<option value="$PROJECT_DIR$/ios/flutter_inappbrowser.podspec" />
<option value="$PROJECT_DIR$/nodejs_server_test_auth_basic_and_ssl/index.js" />
<option value="$PROJECT_DIR$/lib/src/webview_options.dart" />
@ -219,15 +230,32 @@
<option value="$PROJECT_DIR$/example/lib/chrome_safari_example.screen.dart" />
<option value="$PROJECT_DIR$/lib/src/in_app_browser.dart" />
<option value="$PROJECT_DIR$/example/lib/webview_example.screen.dart" />
<option value="$PROJECT_DIR$/example/lib/inline_example.screen.dart" />
<option value="$PROJECT_DIR$/lib/src/types.dart" />
<option value="$PROJECT_DIR$/lib/src/in_app_webview.dart" />
<option value="$PROJECT_DIR$/example/assets/index.html" />
<option value="$PROJECT_DIR$/CHANGELOG.md" />
<option value="$PROJECT_DIR$/example/lib/main.dart" />
<option value="$PROJECT_DIR$/tests/in_app_weview_widget.dart" />
<option value="$PROJECT_DIR$/tests/in_app_webview_widget.dart" />
<option value="$PROJECT_DIR$/tests/in_app_webview_test.dart" />
<option value="$PROJECT_DIR$/lib/src/in_app_webview.dart" />
<option value="$PROJECT_DIR$/example/lib/inline_example.screen.dart" />
<option value="$PROJECT_DIR$/test/in_app_webview_test.dart" />
<option value="$PROJECT_DIR$/test/in_app_webview_initial_url.dart" />
<option value="$PROJECT_DIR$/test/in_app_webview_initial_url_test.dart" />
<option value="$PROJECT_DIR$/test/main_test.dart" />
<option value="$PROJECT_DIR$/pubspec.yaml" />
<option value="$PROJECT_DIR$/example/test/custom_widget_test.dart" />
<option value="$PROJECT_DIR$/example/test/custom_assert.dart" />
<option value="$PROJECT_DIR$/example/pubspec.yaml" />
<option value="$PROJECT_DIR$/example/test/main_test.dart" />
<option value="$PROJECT_DIR$/example/test/in_app_webview_initial_url_test.dart" />
<option value="$PROJECT_DIR$/example/test/in_app_webview_initial_file_test.dart" />
<option value="$PROJECT_DIR$/example/test/util_test.dart" />
<option value="$PROJECT_DIR$/example/test/in_app_webview_on_load_resource_test.dart" />
</list>
</option>
</component>
<component name="ProjectFrameBounds" extendedState="6">
<component name="ProjectFrameBounds">
<option name="y" value="23" />
<option name="width" value="1920" />
<option name="height" value="1057" />
@ -238,6 +266,17 @@
<foldersAlwaysOnTop value="true" />
</navigator>
<panes>
<pane id="Scope">
<subPane subId="Project Files">
<expand>
<path>
<item name="Root" type="cbb8eebc:String" user="Root" />
<item name="flutter_inappbrowser" type="cbb8eebc:String" user="flutter_inappbrowser" />
</path>
</expand>
<select />
</subPane>
</pane>
<pane id="AndroidView">
<subPane>
<expand>
@ -267,6 +306,7 @@
<select />
</subPane>
</pane>
<pane id="PackagesPane" />
<pane id="ProjectPane">
<subPane>
<expand>
@ -288,19 +328,19 @@
<path>
<item name="flutter_inappbrowser" type="b2602c69:ProjectViewProjectNode" />
<item name="flutter_inappbrowser" type="462c0819:PsiDirectoryNode" />
<item name="example" type="462c0819:PsiDirectoryNode" />
<item name="lib" type="462c0819:PsiDirectoryNode" />
</path>
<path>
<item name="flutter_inappbrowser" type="b2602c69:ProjectViewProjectNode" />
<item name="flutter_inappbrowser" type="462c0819:PsiDirectoryNode" />
<item name="lib" type="462c0819:PsiDirectoryNode" />
<item name="src" type="462c0819:PsiDirectoryNode" />
<item name="example" type="462c0819:PsiDirectoryNode" />
<item name="test" type="462c0819:PsiDirectoryNode" />
</path>
<path>
<item name="flutter_inappbrowser" type="b2602c69:ProjectViewProjectNode" />
<item name="flutter_inappbrowser" type="462c0819:PsiDirectoryNode" />
<item name="lib" type="462c0819:PsiDirectoryNode" />
<item name="t_rex_runner" type="462c0819:PsiDirectoryNode" />
</path>
<path>
<item name="flutter_inappbrowser" type="b2602c69:ProjectViewProjectNode" />
@ -310,18 +350,6 @@
<select />
</subPane>
</pane>
<pane id="PackagesPane" />
<pane id="Scope">
<subPane subId="Project Files">
<expand>
<path>
<item name="Root" type="cbb8eebc:String" user="Root" />
<item name="flutter_inappbrowser" type="cbb8eebc:String" user="flutter_inappbrowser" />
</path>
</expand>
<select />
</subPane>
</pane>
</panes>
</component>
<component name="PropertiesComponent">
@ -333,27 +361,27 @@
<property name="android.project.structure.proportion" value="0.15" />
<property name="dart.analysis.tool.window.force.activate" value="false" />
<property name="io.flutter.reload.alreadyRun" value="true" />
<property name="last_opened_file_path" value="$PROJECT_DIR$/example/assets" />
<property name="project.structure.last.edited" value="SDK Location" />
<property name="last_opened_file_path" value="$PROJECT_DIR$/example/test" />
<property name="project.structure.last.edited" value="Project" />
<property name="project.structure.proportion" value="0.15" />
<property name="project.structure.side.proportion" value="0.2" />
<property name="settings.editor.selected.configurable" value="preferences.sourceCode.Other File Types" />
<property name="settings.editor.selected.configurable" value="preferences.externalTools" />
<property name="show.migrate.to.gradle.popup" value="false" />
</component>
<component name="RecentsManager">
<key name="MoveFile.RECENT_KEYS">
<recent name="$PROJECT_DIR$/example" />
<recent name="$PROJECT_DIR$/example/lib" />
<recent name="$PROJECT_DIR$/lib" />
<recent name="$PROJECT_DIR$/nodejs_server_test_auth_basic_and_ssl/assets" />
<recent name="$PROJECT_DIR$/example/assets" />
</key>
<key name="CopyFile.RECENT_KEYS">
<recent name="$PROJECT_DIR$/example/test" />
<recent name="$PROJECT_DIR$/example/assets" />
<recent name="$PROJECT_DIR$" />
<recent name="$PROJECT_DIR$/example" />
<recent name="$PROJECT_DIR$/example/assets/images" />
<recent name="$PROJECT_DIR$/android/libs" />
</key>
<key name="MoveFile.RECENT_KEYS">
<recent name="$PROJECT_DIR$/nodejs_server_test_auth_basic_and_ssl/assets" />
<recent name="$PROJECT_DIR$/lib" />
<recent name="$PROJECT_DIR$/example/assets" />
<recent name="$PROJECT_DIR$/lib/src" />
<recent name="$PROJECT_DIR$/lib/in_app_browser.dart" />
</key>
</component>
<component name="RunDashboard">
@ -384,12 +412,6 @@
<option name="Make" enabled="true" />
</method>
</configuration>
<configuration default="true" type="Application" factoryName="Application">
<option name="WORKING_DIRECTORY" value="$PROJECT_DIR$" />
<method v="2">
<option name="Make" enabled="true" />
</method>
</configuration>
<configuration default="true" type="JetRunConfigurationType" factoryName="Kotlin">
<module name="flutter_webview" />
<option name="VM_PARAMETERS" />
@ -486,7 +508,7 @@
<window_info id="Resources Explorer" order="8" />
<window_info anchor="bottom" id="Message" order="0" />
<window_info anchor="bottom" id="Find" order="1" weight="0.32642487" />
<window_info anchor="bottom" id="Run" order="2" sideWeight="0.49574015" weight="0.48290154" />
<window_info anchor="bottom" id="Run" order="2" sideWeight="0.49574015" weight="0.6279793" />
<window_info anchor="bottom" id="Debug" order="3" weight="0.34196892" />
<window_info anchor="bottom" id="Cvs" order="4" weight="0.25" />
<window_info anchor="bottom" id="Inspection" order="5" weight="0.4" />
@ -494,8 +516,8 @@
<window_info anchor="bottom" id="Android Profiler" order="7" show_stripe_button="false" />
<window_info anchor="bottom" id="Event Log" order="8" sideWeight="0.50692225" side_tool="true" weight="0.38445595" />
<window_info anchor="bottom" id="Version Control" order="9" weight="0.32953367" />
<window_info active="true" anchor="bottom" id="Terminal" order="10" sideWeight="0.49533224" visible="true" weight="0.41658032" />
<window_info anchor="bottom" id="Messages" order="11" weight="0.3253886" />
<window_info active="true" anchor="bottom" id="Terminal" order="10" sideWeight="0.49533224" visible="true" weight="0.54300517" />
<window_info anchor="bottom" id="Messages" order="11" weight="0.3896373" />
<window_info anchor="bottom" id="Dependency Viewer" order="12" weight="0.32800853" />
<window_info anchor="bottom" id="Logcat" order="13" weight="0.32953367" />
<window_info anchor="bottom" id="Dart Analysis" order="14" sideWeight="0.4968051" weight="0.3253886" />
@ -524,54 +546,6 @@
</ignored-roots>
</component>
<component name="editorHistoryManager">
<entry file="file://$PROJECT_DIR$/example/assets/client1-crt.crt" />
<entry file="file://$PROJECT_DIR$/pubspec.lock">
<provider selected="true" editor-type-id="text-editor" />
</entry>
<entry file="file://$PROJECT_DIR$/.gitignore">
<provider selected="true" editor-type-id="text-editor" />
</entry>
<entry file="file://$PROJECT_DIR$/.packages">
<provider selected="true" editor-type-id="text-editor" />
</entry>
<entry file="file://$PROJECT_DIR$/nodejs_server_test_auth_basic_and_ssl/.gitignore">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="204">
<caret line="42" column="12" selection-start-line="42" selection-start-column="5" selection-end-line="42" selection-end-column="12" />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/lib/src/channel_manager.dart">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="180">
<caret line="12" column="9" selection-start-line="12" selection-start-column="9" selection-end-line="12" selection-end-column="9" />
<folding>
<element signature="e#0#20#0" expanded="true" />
</folding>
</state>
</provider>
</entry>
<entry file="file://$USER_HOME$/flutter/bin/cache/pkg/sky_engine/lib/core/uri.dart">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="15">
<caret line="37" column="15" selection-start-line="37" selection-start-column="15" selection-end-line="37" selection-end-column="15" />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/example/android/gradle.properties">
<provider selected="true" editor-type-id="text-editor" />
</entry>
<entry file="file://$PROJECT_DIR$/android/local.properties">
<provider selected="true" editor-type-id="text-editor" />
</entry>
<entry file="file://$PROJECT_DIR$/android/gradle.properties" />
<entry file="file://$PROJECT_DIR$/android/build.gradle">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="256">
<caret line="25" selection-start-line="25" selection-end-line="25" />
</state>
</provider>
</entry>
<entry file="file://$USER_HOME$/flutter/bin/cache/pkg/sky_engine/lib/io/file.dart">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="-1206">
@ -586,16 +560,6 @@
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/example/lib/main.dart">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="45">
<caret line="12" column="23" selection-start-line="12" selection-start-column="3" selection-end-line="12" selection-end-column="23" />
<folding>
<element signature="e#0#20#0" expanded="true" />
</folding>
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/lib/t_rex_runner/assets/novas-coisas.gif" />
<entry file="file://$PROJECT_DIR$/lib/t_rex_runner/assets/t-rex-runner-19janil.gif" />
<entry file="file://$PROJECT_DIR$/lib/t_rex_runner/assets/t-rex-runner-bot.gif" />
@ -623,13 +587,6 @@
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/pubspec.yaml">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="178">
<caret line="28" column="58" selection-start-line="28" selection-start-column="58" selection-end-line="28" selection-end-column="58" />
</state>
</provider>
</entry>
<entry file="file://$USER_HOME$/flutter/bin/cache/dart-sdk/lib/collection/linked_hash_map.dart">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="137">
@ -660,13 +617,6 @@
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/example/pubspec.yaml">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="116">
<caret line="23" column="28" selection-start-line="23" selection-start-column="28" selection-end-line="23" selection-end-column="28" />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/lib/src/cookie_manager.dart">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="613">
@ -753,24 +703,85 @@
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/lib/src/types.dart">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="13980">
<caret line="939" column="17" selection-start-line="939" selection-start-column="6" selection-end-line="939" selection-end-column="17" />
<folding>
<element signature="e#0#20#0" expanded="true" />
</folding>
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/nodejs_server_test_auth_basic_and_ssl/index.js">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="258">
<state relative-caret-position="1905">
<caret line="127" column="25" selection-start-line="127" selection-start-column="10" selection-end-line="127" selection-end-column="25" />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/example/assets/index.html">
<entry file="file://$PROJECT_DIR$/CHANGELOG.md">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="446">
<caret line="88" selection-start-line="88" selection-end-line="88" />
<state relative-caret-position="660">
<caret line="44" column="52" selection-start-line="44" selection-start-column="52" selection-end-line="44" selection-end-column="52" />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/tests/in_app_webview_widget.dart">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="480">
<caret line="32" column="29" selection-start-line="32" selection-start-column="29" selection-end-line="32" selection-end-column="29" />
<folding>
<element signature="e#0#20#0" expanded="true" />
</folding>
</state>
</provider>
</entry>
<entry file="file://$USER_HOME$/flutter/bin/cache/pkg/sky_engine/lib/core/print.dart">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="90">
<caret line="8" column="5" selection-start-line="8" selection-start-column="5" selection-end-line="8" selection-end-column="5" />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/tests/in_app_webview_test.dart">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="750">
<caret line="50" column="33" selection-start-line="50" selection-start-column="7" selection-end-line="50" selection-end-column="33" />
<folding>
<element signature="e#0#25#0" expanded="true" />
</folding>
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/example/lib/main.dart">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="-55">
<caret line="16" column="42" lean-forward="true" selection-start-line="16" selection-start-column="42" selection-end-line="16" selection-end-column="42" />
<folding>
<element signature="e#0#20#0" expanded="true" />
</folding>
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/example/pubspec.yaml">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="69">
<caret line="12" column="32" selection-start-line="12" selection-start-column="32" selection-end-line="12" selection-end-column="32" />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/pubspec.yaml">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="9">
<caret line="25" lean-forward="true" selection-start-line="25" selection-end-line="25" />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/example/lib/inline_example.screen.dart">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="703">
<caret line="195" column="46" lean-forward="true" selection-start-line="195" selection-start-column="46" selection-end-line="195" selection-end-column="46" />
<state relative-caret-position="4">
<caret line="90" column="44" selection-start-line="90" selection-start-column="25" selection-end-line="90" selection-end-column="44" />
<folding>
<element signature="e#0#20#0" expanded="true" />
</folding>
@ -779,28 +790,93 @@
</entry>
<entry file="file://$PROJECT_DIR$/lib/src/in_app_webview.dart">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="127">
<caret line="1105" column="38" selection-start-line="1105" selection-start-column="12" selection-end-line="1105" selection-end-column="38" />
<state relative-caret-position="175">
<caret line="253" column="38" selection-start-line="253" selection-start-column="38" selection-end-line="253" selection-end-column="38" />
<folding>
<element signature="e#0#17#0" expanded="true" />
</folding>
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/lib/src/types.dart">
<entry file="file://$PROJECT_DIR$/example/assets/index.html">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="20">
<caret line="939" column="17" selection-start-line="939" selection-start-column="6" selection-end-line="939" selection-end-column="17" />
<state relative-caret-position="301">
<caret line="39" column="61" selection-start-line="39" selection-start-column="25" selection-end-line="39" selection-end-column="61" />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/example/test/custom_widget_test.dart">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="150">
<caret line="10" column="16" selection-start-line="10" selection-start-column="16" selection-end-line="10" selection-end-column="16" />
<folding>
<element signature="e#0#20#0" expanded="true" />
<element signature="e#0#42#0" expanded="true" />
</folding>
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/CHANGELOG.md">
<entry file="file://$PROJECT_DIR$/README.md">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="322">
<caret line="44" column="52" lean-forward="true" selection-start-line="44" selection-start-column="52" selection-end-line="44" selection-end-column="52" />
<state>
<folding>
<element signature="e#0#20#0" expanded="true" />
<element signature="e#0#39#0" expanded="true" />
<element signature="e#0#39#0" expanded="true" />
</folding>
</state>
</provider>
</entry>
<entry file="file://$USER_HOME$/flutter/.pub-cache/hosted/pub.dartlang.org/ansicolor-1.0.2/lib/ansicolor.dart">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="277">
<caret line="65" column="7" selection-start-line="65" selection-start-column="7" selection-end-line="65" selection-end-column="7" />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/example/test/in_app_webview_initial_url_test.dart">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="-260">
<caret line="5" column="33" selection-start-line="5" selection-start-column="33" selection-end-line="5" selection-end-column="33" />
<folding>
<element signature="e#0#39#0" expanded="true" />
</folding>
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/example/test/main_test.dart">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="-231">
<caret column="20" selection-start-column="20" selection-end-column="20" />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/example/test/util_test.dart">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="97">
<caret line="35" column="74" selection-start-line="35" selection-start-column="74" selection-end-line="35" selection-end-column="74" />
<folding>
<element signature="e#0#42#0" expanded="true" />
</folding>
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/example/test/in_app_webview_initial_file_test.dart">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="120">
<caret line="8" column="73" selection-start-line="8" selection-start-column="73" selection-end-line="8" selection-end-column="73" />
<folding>
<element signature="e#0#39#0" expanded="true" />
</folding>
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/example/test/in_app_webview_on_load_resource_test.dart">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="255">
<caret line="17" column="64" selection-start-line="17" selection-start-column="64" selection-end-line="17" selection-end-column="64" />
<folding>
<element signature="e#0#39#0" expanded="true" />
</folding>
</state>
</provider>
</entry>

View File

@ -567,10 +567,17 @@ public class InAppWebViewClient extends WebViewClient {
URI uri;
try {
uri = new URI(url);
} catch (URISyntaxException e) {
e.printStackTrace();
Log.e(LOG_TAG, e.getMessage());
return null;
} catch (URISyntaxException uriExpection) {
String[] urlSplitted = url.split(":");
String scheme = urlSplitted[0];
try {
URL tempUrl = new URL(url.replace(scheme, "https"));
uri = new URI(scheme, tempUrl.getUserInfo(), tempUrl.getHost(), tempUrl.getPort(), tempUrl.getPath(), tempUrl.getQuery(), tempUrl.getRef());
} catch (Exception e) {
e.printStackTrace();
Log.d(LOG_TAG, e.getMessage());
return null;
}
}
String scheme = uri.getScheme();

View File

@ -25,9 +25,6 @@ class MyApp extends StatefulWidget {
}
class _MyAppState extends State<MyApp> {
InAppWebViewController webView;
String url = "";
double progress = 0;
@override
void initState() {

View File

@ -26,6 +26,7 @@ dependencies:
dev_dependencies:
flutter_test:
sdk: flutter
ansicolor: 1.0.2
flutter_inappbrowser:
path: ../

View File

@ -0,0 +1,18 @@
import 'package:ansicolor/ansicolor.dart';
import 'package:flutter/widgets.dart';
class WidgetTest extends StatefulWidget {
final String name;
WidgetTest({this.name, Key key}): super(key: key) {
AnsiPen pen = new AnsiPen()..white()..rgb(r: 1.0, g: 0.8, b: 0.2);
print("\n");
print(pen("'" + this.name + "' test loading..."));
print("\n");
}
@override
State<StatefulWidget> createState() {
return null;
}
}

View File

@ -0,0 +1,50 @@
import 'package:flutter/material.dart';
import 'package:flutter_inappbrowser/flutter_inappbrowser.dart';
import 'util_test.dart';
import 'custom_widget_test.dart';
class InAppWebViewInitialFileTest extends WidgetTest {
InAppWebViewInitialFileTest(): super(name: "InAppWebViewInitialFileTest");
@override
_InAppWebViewInitialFileTestState createState() => new _InAppWebViewInitialFileTestState();
}
class _InAppWebViewInitialFileTestState extends State<InAppWebViewInitialFileTest> {
InAppWebViewController webView;
String initialUrl = "https://flutter.dev/";
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
title: Text('InAppWebViewInitialFileTest'),
),
body: Container(
child: Column(children: <Widget>[
Expanded(
child: Container(
child: InAppWebView(
initialFile: "assets/index.html",
initialHeaders: {},
initialOptions: InAppWebViewWidgetOptions(),
onWebViewCreated: (InAppWebViewController controller) {
webView = controller;
},
onLoadStart: (InAppWebViewController controller, String url) {
},
onLoadStop: (InAppWebViewController controller, String url) {
customAssert(widget: widget, name: "initialFile", value: true);
nextTest(context: context);
},
),
),
),
])
)
);
}
}

View File

@ -0,0 +1,50 @@
import 'package:flutter/material.dart';
import 'package:flutter_inappbrowser/flutter_inappbrowser.dart';
import 'util_test.dart';
import 'custom_widget_test.dart';
class InAppWebViewInitialUrlTest extends WidgetTest {
InAppWebViewInitialUrlTest(): super(name: "InAppWebViewInitialUrlTest");
@override
_InAppWebViewInitialUrlTestState createState() => new _InAppWebViewInitialUrlTestState();
}
class _InAppWebViewInitialUrlTestState extends State<InAppWebViewInitialUrlTest> {
InAppWebViewController webView;
String initialUrl = "https://flutter.dev/";
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
title: Text('InAppWebViewInitialUrlTest'),
),
body: Container(
child: Column(children: <Widget>[
Expanded(
child: Container(
child: InAppWebView(
initialUrl: initialUrl,
initialHeaders: {},
initialOptions: InAppWebViewWidgetOptions(),
onWebViewCreated: (InAppWebViewController controller) {
webView = controller;
},
onLoadStart: (InAppWebViewController controller, String url) {
},
onLoadStop: (InAppWebViewController controller, String url) {
customAssert(widget: widget, name: "initialUrl", value: url == initialUrl);
nextTest(context: context);
},
),
),
),
])
)
);
}
}

View File

@ -0,0 +1,66 @@
import 'package:flutter/material.dart';
import 'package:flutter_inappbrowser/flutter_inappbrowser.dart';
import 'util_test.dart';
import 'custom_widget_test.dart';
class InAppWebViewOnLoadResourceTest extends WidgetTest {
InAppWebViewOnLoadResourceTest(): super(name: "InAppWebViewOnLoadResourceTest");
@override
_InAppWebViewOnLoadResourceTestState createState() => new _InAppWebViewOnLoadResourceTestState();
}
class _InAppWebViewOnLoadResourceTestState extends State<InAppWebViewOnLoadResourceTest> {
InAppWebViewController webView;
List<String> resourceList = [
"http://getbootstrap.com/docs/4.3/dist/css/bootstrap.min.css",
"https://code.jquery.com/jquery-3.3.1.min.js",
"https://via.placeholder.com/100x50"
];
int countResources = 0;
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
title: Text('InAppWebViewOnLoadResourceTest'),
),
body: Container(
child: Column(children: <Widget>[
Expanded(
child: Container(
child: InAppWebView(
initialFile: "assets/index.html",
initialHeaders: {},
initialOptions: InAppWebViewWidgetOptions(
inAppWebViewOptions: InAppWebViewOptions(
clearCache: true,
useOnLoadResource: true
)
),
onWebViewCreated: (InAppWebViewController controller) {
webView = controller;
},
onLoadStart: (InAppWebViewController controller, String url) {
},
onLoadStop: (InAppWebViewController controller, String url) {
},
onLoadResource: (InAppWebViewController controller, LoadedResource response) {
customAssert(widget: widget, name: "onLoadResource", value: resourceList.contains(response.url));
countResources++;
if (countResources == resourceList.length) {
nextTest(context: context);
}
}
),
),
),
])
)
);
}
}

View File

@ -0,0 +1,43 @@
import 'dart:async';
import 'package:flutter/material.dart';
import 'in_app_webview_initial_file_test.dart';
import 'in_app_webview_initial_url_test.dart';
import 'in_app_webview_on_load_resource_test.dart';
Future main() async {
runApp(new MyApp());
}
class MyApp extends StatefulWidget {
@override
_MyAppState createState() => new _MyAppState();
}
class _MyAppState extends State<MyApp> {
@override
void initState() {
super.initState();
}
@override
void dispose() {
super.dispose();
}
@override
Widget build(BuildContext context) {
return MaterialApp(
title: 'flutter_inappbrowser tests',
initialRoute: '/',
routes: {
'/': (context) => InAppWebViewInitialUrlTest(),
'/InAppWebViewInitialFileTest': (context) => InAppWebViewInitialFileTest(),
'/InAppWebViewOnLoadResourceTest': (context) => InAppWebViewOnLoadResourceTest()
}
);
}
}

View File

@ -0,0 +1,60 @@
import 'package:ansicolor/ansicolor.dart';
import 'package:flutter/foundation.dart';
import 'package:flutter/material.dart';
import 'custom_widget_test.dart';
int countTestPassed = 0;
int countTestFailed = 0;
int currentTest = 0;
List<String> testRoutes = [
'/',
'/InAppWebViewInitialFileTest',
'/InAppWebViewOnLoadResourceTest'
];
void nextTest({@required BuildContext context}) {
if (currentTest + 1 < testRoutes.length) {
currentTest++;
String nextRoute = testRoutes[currentTest];
Navigator.pushReplacementNamed(context, nextRoute);
} else {
AnsiPen penError = new AnsiPen()..white()..rgb(r: 1.0, g: 0.0, b: 0.0);
AnsiPen penSuccess = new AnsiPen()..white()..rgb(r: 0.0, g: 1.0, b: 0.0);
if (countTestFailed > 0)
print("\n" + penError("Total tests failed $countTestFailed.") + "\n");
if (countTestPassed > 0)
print("\n" + penSuccess("Total tests passed $countTestPassed.") + "\n");
}
}
bool customAssert({WidgetTest widget, String name, @required bool value}) {
try {
assert(value);
} catch (e, stackTrace) {
String message = "${widget != null ? "'" + widget.name + "' - " : ""} ERROR - Failed assertion: ";
List<String> stakTraceSplitted = stackTrace.toString().split("\n");
String lineCallingAssert = stakTraceSplitted[3].trim().substring(2).trim();
AnsiPen penError = new AnsiPen()..white()..rgb(r: 1.0, g: 0.0, b: 0.0);
print("\n" + penError(message + lineCallingAssert) + "\n");
countTestFailed++;
return false;
}
countTestPassed++;
try {
throw Exception();
} on Exception catch(e, stackTrace) {
String message = "${widget != null ? "'" + widget.name + "' - " : ""} Test ";
message += (name != null) ? "'$name' " : "";
message += "passed!";
List<String> stakTraceSplitted = stackTrace.toString().split("\n");
String lineCallingAssert = stakTraceSplitted[1].trim().substring(2).trim();
message += " $lineCallingAssert";
AnsiPen pen = new AnsiPen()..white()..rgb(r: 1.0, g: 0.8, b: 0.2);
print("\n" + pen(message) + "\n");
}
return true;
}