Commit 8894ae1b authored by Lorenzo Pichilli's avatar Lorenzo Pichilli

fixed shouldInterceptRequest String url Android, added initial tests using...

fixed shouldInterceptRequest String url Android, added initial tests using custom classes and functions
parent 65f2d106
...@@ -15,15 +15,16 @@ ...@@ -15,15 +15,16 @@
</component> </component>
<component name="ChangeListManager"> <component name="ChangeListManager">
<list default="true" id="9b41f7a2-a71e-4923-91fb-249d7815b3e7" name="Default" comment=""> <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$/.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$/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/main.dart" beforeDir="false" afterPath="$PROJECT_DIR$/example/lib/main.dart" 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$/example/pubspec.yaml" beforeDir="false" afterPath="$PROJECT_DIR$/example/pubspec.yaml" 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" />
</list> </list>
<ignored path="$PROJECT_DIR$/.dart_tool/" /> <ignored path="$PROJECT_DIR$/.dart_tool/" />
<ignored path="$PROJECT_DIR$/.idea/" /> <ignored path="$PROJECT_DIR$/.idea/" />
...@@ -46,8 +47,8 @@ ...@@ -46,8 +47,8 @@
<file pinned="false" current-in-tab="false"> <file pinned="false" current-in-tab="false">
<entry file="file://$PROJECT_DIR$/lib/src/in_app_webview.dart"> <entry file="file://$PROJECT_DIR$/lib/src/in_app_webview.dart">
<provider selected="true" editor-type-id="text-editor"> <provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="127"> <state relative-caret-position="175">
<caret line="1105" column="38" selection-start-line="1105" selection-start-column="12" selection-end-line="1105" selection-end-column="38" /> <caret line="253" column="38" selection-start-line="253" selection-start-column="38" selection-end-line="253" selection-end-column="38" />
<folding> <folding>
<element signature="e#0#17#0" expanded="true" /> <element signature="e#0#17#0" expanded="true" />
</folding> </folding>
...@@ -56,10 +57,10 @@ ...@@ -56,10 +57,10 @@
</entry> </entry>
</file> </file>
<file pinned="false" current-in-tab="false"> <file pinned="false" current-in-tab="false">
<entry file="file://$PROJECT_DIR$/lib/src/types.dart"> <entry file="file://$PROJECT_DIR$/example/lib/inline_example.screen.dart">
<provider selected="true" editor-type-id="text-editor"> <provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="20"> <state relative-caret-position="4">
<caret line="939" column="17" selection-start-line="939" selection-start-column="6" selection-end-line="939" selection-end-column="17" /> <caret line="90" column="44" selection-start-line="90" selection-start-column="25" selection-end-line="90" selection-end-column="44" />
<folding> <folding>
<element signature="e#0#20#0" expanded="true" /> <element signature="e#0#20#0" expanded="true" />
</folding> </folding>
...@@ -67,23 +68,26 @@ ...@@ -67,23 +68,26 @@
</provider> </provider>
</entry> </entry>
</file> </file>
<file pinned="false" current-in-tab="false"> <file pinned="false" current-in-tab="true">
<entry file="file://$PROJECT_DIR$/example/lib/inline_example.screen.dart"> <entry file="file://$PROJECT_DIR$/example/test/in_app_webview_on_load_resource_test.dart">
<provider selected="true" editor-type-id="text-editor"> <provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="703"> <state relative-caret-position="255">
<caret line="195" column="46" lean-forward="true" selection-start-line="195" selection-start-column="46" selection-end-line="195" selection-end-column="46" /> <caret line="17" column="64" selection-start-line="17" selection-start-column="64" selection-end-line="17" selection-end-column="64" />
<folding> <folding>
<element signature="e#0#20#0" expanded="true" /> <element signature="e#0#39#0" expanded="true" />
</folding> </folding>
</state> </state>
</provider> </provider>
</entry> </entry>
</file> </file>
<file pinned="false" current-in-tab="false"> <file pinned="false" current-in-tab="false">
<entry file="file://$PROJECT_DIR$/nodejs_server_test_auth_basic_and_ssl/index.js"> <entry file="file://$PROJECT_DIR$/example/test/in_app_webview_initial_file_test.dart">
<provider selected="true" editor-type-id="text-editor"> <provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="258"> <state relative-caret-position="120">
<caret line="127" column="25" selection-start-line="127" selection-start-column="10" selection-end-line="127" selection-end-column="25" /> <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> </state>
</provider> </provider>
</entry> </entry>
...@@ -91,17 +95,41 @@ ...@@ -91,17 +95,41 @@
<file pinned="false" current-in-tab="false"> <file pinned="false" current-in-tab="false">
<entry file="file://$PROJECT_DIR$/example/assets/index.html"> <entry file="file://$PROJECT_DIR$/example/assets/index.html">
<provider selected="true" editor-type-id="text-editor"> <provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="446"> <state relative-caret-position="301">
<caret line="88" selection-start-line="88" selection-end-line="88" /> <caret line="39" column="61" selection-start-line="39" selection-start-column="25" selection-end-line="39" selection-end-column="61" />
</state> </state>
</provider> </provider>
</entry> </entry>
</file> </file>
<file pinned="false" current-in-tab="true"> <file pinned="false" current-in-tab="false">
<entry file="file://$PROJECT_DIR$/CHANGELOG.md"> <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>
</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"> <provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="322"> <state relative-caret-position="-231">
<caret line="44" column="52" lean-forward="true" selection-start-line="44" selection-start-column="52" selection-end-line="44" selection-end-column="52" /> <caret column="20" selection-start-column="20" selection-end-column="20" />
</state> </state>
</provider> </provider>
</entry> </entry>
...@@ -118,7 +146,6 @@ ...@@ -118,7 +146,6 @@
</component> </component>
<component name="FindInProjectRecents"> <component name="FindInProjectRecents">
<findStrings> <findStrings>
<find>ClientCertResponse</find>
<find>weBVIEWCONTROL</find> <find>weBVIEWCONTROL</find>
<find>getFa</find> <find>getFa</find>
<find>supportZoom</find> <find>supportZoom</find>
...@@ -148,6 +175,7 @@ ...@@ -148,6 +175,7 @@
<find>flutterInAppBrowserPlatformReady</find> <find>flutterInAppBrowserPlatformReady</find>
<find>evaluateJ</find> <find>evaluateJ</find>
<find>AjaxRequest</find> <find>AjaxRequest</find>
<find>_onPlatformViewCreated</find>
</findStrings> </findStrings>
<replaceStrings> <replaceStrings>
<replace>activity.getPreferences(0)</replace> <replace>activity.getPreferences(0)</replace>
...@@ -173,20 +201,6 @@ ...@@ -173,20 +201,6 @@
<component name="IdeDocumentHistory"> <component name="IdeDocumentHistory">
<option name="CHANGED_PATHS"> <option name="CHANGED_PATHS">
<list> <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/page-1.html" />
<option value="$PROJECT_DIR$/example/assets/css/style.css" /> <option value="$PROJECT_DIR$/example/assets/css/style.css" />
<option value="$PROJECT_DIR$/ios/Classes/InAppWebView.swift" /> <option value="$PROJECT_DIR$/ios/Classes/InAppWebView.swift" />
...@@ -196,7 +210,6 @@ ...@@ -196,7 +210,6 @@
<option value="$PROJECT_DIR$/lib/src/in_app_localhost_server.dart" /> <option value="$PROJECT_DIR$/lib/src/in_app_localhost_server.dart" />
<option value="$PROJECT_DIR$/lib/src/web_history.dart" /> <option value="$PROJECT_DIR$/lib/src/web_history.dart" />
<option value="$PROJECT_DIR$/example/ios/Runner/Info.plist" /> <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/src/credentials_database.dart" />
<option value="$PROJECT_DIR$/lib/flutter_inappbrowser.dart" /> <option value="$PROJECT_DIR$/lib/flutter_inappbrowser.dart" />
<option value="$PROJECT_DIR$/lib/src/channel_manager.dart" /> <option value="$PROJECT_DIR$/lib/src/channel_manager.dart" />
...@@ -205,10 +218,8 @@ ...@@ -205,10 +218,8 @@
<option value="$PROJECT_DIR$/lib/t_rex_runner/index.css" /> <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/index.html" />
<option value="$PROJECT_DIR$/lib/t_rex_runner/t-rex.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$/lib/t_rex_runner/t-rex.css" />
<option value="$PROJECT_DIR$/example/lib/test.dart" /> <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$/ios/flutter_inappbrowser.podspec" />
<option value="$PROJECT_DIR$/nodejs_server_test_auth_basic_and_ssl/index.js" /> <option value="$PROJECT_DIR$/nodejs_server_test_auth_basic_and_ssl/index.js" />
<option value="$PROJECT_DIR$/lib/src/webview_options.dart" /> <option value="$PROJECT_DIR$/lib/src/webview_options.dart" />
...@@ -219,15 +230,32 @@ ...@@ -219,15 +230,32 @@
<option value="$PROJECT_DIR$/example/lib/chrome_safari_example.screen.dart" /> <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$/lib/src/in_app_browser.dart" />
<option value="$PROJECT_DIR$/example/lib/webview_example.screen.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/types.dart" />
<option value="$PROJECT_DIR$/lib/src/in_app_webview.dart" />
<option value="$PROJECT_DIR$/example/assets/index.html" /> <option value="$PROJECT_DIR$/example/assets/index.html" />
<option value="$PROJECT_DIR$/CHANGELOG.md" /> <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> </list>
</option> </option>
</component> </component>
<component name="ProjectFrameBounds" extendedState="6"> <component name="ProjectFrameBounds">
<option name="y" value="23" /> <option name="y" value="23" />
<option name="width" value="1920" /> <option name="width" value="1920" />
<option name="height" value="1057" /> <option name="height" value="1057" />
...@@ -238,6 +266,17 @@ ...@@ -238,6 +266,17 @@
<foldersAlwaysOnTop value="true" /> <foldersAlwaysOnTop value="true" />
</navigator> </navigator>
<panes> <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"> <pane id="AndroidView">
<subPane> <subPane>
<expand> <expand>
...@@ -267,6 +306,7 @@ ...@@ -267,6 +306,7 @@
<select /> <select />
</subPane> </subPane>
</pane> </pane>
<pane id="PackagesPane" />
<pane id="ProjectPane"> <pane id="ProjectPane">
<subPane> <subPane>
<expand> <expand>
...@@ -288,19 +328,19 @@ ...@@ -288,19 +328,19 @@
<path> <path>
<item name="flutter_inappbrowser" type="b2602c69:ProjectViewProjectNode" /> <item name="flutter_inappbrowser" type="b2602c69:ProjectViewProjectNode" />
<item name="flutter_inappbrowser" type="462c0819:PsiDirectoryNode" /> <item name="flutter_inappbrowser" type="462c0819:PsiDirectoryNode" />
<item name="example" type="462c0819:PsiDirectoryNode" />
<item name="lib" type="462c0819:PsiDirectoryNode" /> <item name="lib" type="462c0819:PsiDirectoryNode" />
</path> </path>
<path> <path>
<item name="flutter_inappbrowser" type="b2602c69:ProjectViewProjectNode" /> <item name="flutter_inappbrowser" type="b2602c69:ProjectViewProjectNode" />
<item name="flutter_inappbrowser" type="462c0819:PsiDirectoryNode" /> <item name="flutter_inappbrowser" type="462c0819:PsiDirectoryNode" />
<item name="lib" type="462c0819:PsiDirectoryNode" /> <item name="example" type="462c0819:PsiDirectoryNode" />
<item name="src" type="462c0819:PsiDirectoryNode" /> <item name="test" type="462c0819:PsiDirectoryNode" />
</path> </path>
<path> <path>
<item name="flutter_inappbrowser" type="b2602c69:ProjectViewProjectNode" /> <item name="flutter_inappbrowser" type="b2602c69:ProjectViewProjectNode" />
<item name="flutter_inappbrowser" type="462c0819:PsiDirectoryNode" /> <item name="flutter_inappbrowser" type="462c0819:PsiDirectoryNode" />
<item name="lib" type="462c0819:PsiDirectoryNode" /> <item name="lib" type="462c0819:PsiDirectoryNode" />
<item name="t_rex_runner" type="462c0819:PsiDirectoryNode" />
</path> </path>
<path> <path>
<item name="flutter_inappbrowser" type="b2602c69:ProjectViewProjectNode" /> <item name="flutter_inappbrowser" type="b2602c69:ProjectViewProjectNode" />
...@@ -310,18 +350,6 @@ ...@@ -310,18 +350,6 @@
<select /> <select />
</subPane> </subPane>
</pane> </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> </panes>
</component> </component>
<component name="PropertiesComponent"> <component name="PropertiesComponent">
...@@ -333,27 +361,27 @@ ...@@ -333,27 +361,27 @@
<property name="android.project.structure.proportion" value="0.15" /> <property name="android.project.structure.proportion" value="0.15" />
<property name="dart.analysis.tool.window.force.activate" value="false" /> <property name="dart.analysis.tool.window.force.activate" value="false" />
<property name="io.flutter.reload.alreadyRun" value="true" /> <property name="io.flutter.reload.alreadyRun" value="true" />
<property name="last_opened_file_path" value="$PROJECT_DIR$/example/assets" /> <property name="last_opened_file_path" value="$PROJECT_DIR$/example/test" />
<property name="project.structure.last.edited" value="SDK Location" /> <property name="project.structure.last.edited" value="Project" />
<property name="project.structure.proportion" value="0.15" /> <property name="project.structure.proportion" value="0.15" />
<property name="project.structure.side.proportion" value="0.2" /> <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" /> <property name="show.migrate.to.gradle.popup" value="false" />
</component> </component>
<component name="RecentsManager"> <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"> <key name="CopyFile.RECENT_KEYS">
<recent name="$PROJECT_DIR$/example/test" />
<recent name="$PROJECT_DIR$/example/assets" /> <recent name="$PROJECT_DIR$/example/assets" />
<recent name="$PROJECT_DIR$" /> <recent name="$PROJECT_DIR$" />
<recent name="$PROJECT_DIR$/example" /> <recent name="$PROJECT_DIR$/example" />
<recent name="$PROJECT_DIR$/example/assets/images" /> <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> </key>
</component> </component>
<component name="RunDashboard"> <component name="RunDashboard">
...@@ -384,12 +412,6 @@ ...@@ -384,12 +412,6 @@
<option name="Make" enabled="true" /> <option name="Make" enabled="true" />
</method> </method>
</configuration> </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"> <configuration default="true" type="JetRunConfigurationType" factoryName="Kotlin">
<module name="flutter_webview" /> <module name="flutter_webview" />
<option name="VM_PARAMETERS" /> <option name="VM_PARAMETERS" />
...@@ -486,7 +508,7 @@ ...@@ -486,7 +508,7 @@
<window_info id="Resources Explorer" order="8" /> <window_info id="Resources Explorer" order="8" />
<window_info anchor="bottom" id="Message" order="0" /> <window_info anchor="bottom" id="Message" order="0" />
<window_info anchor="bottom" id="Find" order="1" weight="0.32642487" /> <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="Debug" order="3" weight="0.34196892" />
<window_info anchor="bottom" id="Cvs" order="4" weight="0.25" /> <window_info anchor="bottom" id="Cvs" order="4" weight="0.25" />
<window_info anchor="bottom" id="Inspection" order="5" weight="0.4" /> <window_info anchor="bottom" id="Inspection" order="5" weight="0.4" />
...@@ -494,8 +516,8 @@ ...@@ -494,8 +516,8 @@
<window_info anchor="bottom" id="Android Profiler" order="7" show_stripe_button="false" /> <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="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 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 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.3253886" /> <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="Dependency Viewer" order="12" weight="0.32800853" />
<window_info anchor="bottom" id="Logcat" order="13" weight="0.32953367" /> <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" /> <window_info anchor="bottom" id="Dart Analysis" order="14" sideWeight="0.4968051" weight="0.3253886" />
...@@ -524,54 +546,6 @@ ...@@ -524,54 +546,6 @@
</ignored-roots> </ignored-roots>
</component> </component>
<component name="editorHistoryManager"> <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"> <entry file="file://$USER_HOME$/flutter/bin/cache/pkg/sky_engine/lib/io/file.dart">
<provider selected="true" editor-type-id="text-editor"> <provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="-1206"> <state relative-caret-position="-1206">
...@@ -586,16 +560,6 @@ ...@@ -586,16 +560,6 @@
</state> </state>
</provider> </provider>
</entry> </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/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-19janil.gif" />
<entry file="file://$PROJECT_DIR$/lib/t_rex_runner/assets/t-rex-runner-bot.gif" /> <entry file="file://$PROJECT_DIR$/lib/t_rex_runner/assets/t-rex-runner-bot.gif" />
...@@ -623,13 +587,6 @@ ...@@ -623,13 +587,6 @@
</state> </state>
</provider> </provider>
</entry> </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"> <entry file="file://$USER_HOME$/flutter/bin/cache/dart-sdk/lib/collection/linked_hash_map.dart">
<provider selected="true" editor-type-id="text-editor"> <provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="137"> <state relative-caret-position="137">
...@@ -660,13 +617,6 @@ ...@@ -660,13 +617,6 @@
</state> </state>
</provider> </provider>
</entry> </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"> <entry file="file://$PROJECT_DIR$/lib/src/cookie_manager.dart">
<provider selected="true" editor-type-id="text-editor"> <provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="613"> <state relative-caret-position="613">
...@@ -753,24 +703,85 @@ ...@@ -753,24 +703,85 @@
</state> </state>
</provider> </provider>
</entry> </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"> <entry file="file://$PROJECT_DIR$/nodejs_server_test_auth_basic_and_ssl/index.js">
<provider selected="true" editor-type-id="text-editor"> <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" /> <caret line="127" column="25" selection-start-line="127" selection-start-column="10" selection-end-line="127" selection-end-column="25" />
</state> </state>
</provider> </provider>
</entry> </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="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"> <provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="446"> <state relative-caret-position="9">
<caret line="88" selection-start-line="88" selection-end-line="88" /> <caret line="25" lean-forward="true" selection-start-line="25" selection-end-line="25" />
</state> </state>
</provider> </provider>
</entry> </entry>
<entry file="file://$PROJECT_DIR$/example/lib/inline_example.screen.dart"> <entry file="file://$PROJECT_DIR$/example/lib/inline_example.screen.dart">
<provider selected="true" editor-type-id="text-editor"> <provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="703"> <state relative-caret-position="4">
<caret line="195" column="46" lean-forward="true" selection-start-line="195" selection-start-column="46" selection-end-line="195" selection-end-column="46" /> <caret line="90" column="44" selection-start-line="90" selection-start-column="25" selection-end-line="90" selection-end-column="44" />
<folding> <folding>
<element signature="e#0#20#0" expanded="true" /> <element signature="e#0#20#0" expanded="true" />
</folding> </folding>
...@@ -779,28 +790,93 @@ ...@@ -779,28 +790,93 @@
</entry> </entry>
<entry file="file://$PROJECT_DIR$/lib/src/in_app_webview.dart"> <entry file="file://$PROJECT_DIR$/lib/src/in_app_webview.dart">
<provider selected="true" editor-type-id="text-editor"> <provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="127"> <state relative-caret-position="175">
<caret line="1105" column="38" selection-start-line="1105" selection-start-column="12" selection-end-line="1105" selection-end-column="38" /> <caret line="253" column="38" selection-start-line="253" selection-start-column="38" selection-end-line="253" selection-end-column="38" />
<folding> <folding>
<element signature="e#0#17#0" expanded="true" /> <element signature="e#0#17#0" expanded="true" />
</folding> </folding>
</state> </state>
</provider> </provider>
</entry> </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"> <provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="20"> <state relative-caret-position="301">
<caret line="939" column="17" selection-start-line="939" selection-start-column="6" selection-end-line="939" selection-end-column="17" /> <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#42#0" expanded="true" />
</folding>
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/README.md">
<provider selected="true" editor-type-id="text-editor">
<state>
<folding> <folding>
<element signature="e#0#20#0" expanded="true" /> <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> </folding>
</state> </state>
</provider> </provider>
</entry> </entry>
<entry file="file://$PROJECT_DIR$/CHANGELOG.md"> <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"> <provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="322"> <state relative-caret-position="-260">
<caret line="44" column="52" lean-forward="true" selection-start-line="44" selection-start-column="52" selection-end-line="44" selection-end-column="52" /> <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> </state>
</provider> </provider>
</entry> </entry>
......
...@@ -567,10 +567,17 @@ public class InAppWebViewClient extends WebViewClient { ...@@ -567,10 +567,17 @@ public class InAppWebViewClient extends WebViewClient {
URI uri; URI uri;
try { try {
uri = new URI(url); uri = new URI(url);
} catch (URISyntaxException e) { } catch (URISyntaxException uriExpection) {
e.printStackTrace(); String[] urlSplitted = url.split(":");
Log.e(LOG_TAG, e.getMessage()); String scheme = urlSplitted[0];
return null; 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(); String scheme = uri.getScheme();
......
...@@ -25,9 +25,6 @@ class MyApp extends StatefulWidget { ...@@ -25,9 +25,6 @@ class MyApp extends StatefulWidget {
} }
class _MyAppState extends State<MyApp> { class _MyAppState extends State<MyApp> {
InAppWebViewController webView;
String url = "";
double progress = 0;
@override @override
void initState() { void initState() {
......
...@@ -26,6 +26,7 @@ dependencies: ...@@ -26,6 +26,7 @@ dependencies:
dev_dependencies: dev_dependencies:
flutter_test: flutter_test:
sdk: flutter sdk: flutter
ansicolor: 1.0.2
flutter_inappbrowser: flutter_inappbrowser:
path: ../ path: ../
......
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;
}
}
\ No newline at end of file
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);
},
),
),
),
])
)
);
}
}
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);
},
),
),
),
])
)
);
}
}
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);
}
}
),
),
),
])
)
);
}
}
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()
}
);
}
}
\ No newline at end of file
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;
}
\ No newline at end of file
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment