updated flutter driver tests, fixed javascript code for fetch request interception
This commit is contained in:
parent
3869f89326
commit
e2bd307664
|
@ -15,7 +15,16 @@
|
|||
</component>
|
||||
<component name="ChangeListManager">
|
||||
<list default="true" id="9b41f7a2-a71e-4923-91fb-249d7815b3e7" name="Default" comment="">
|
||||
<change beforePath="$PROJECT_DIR$/lib/src/in_app_webview.dart" beforeDir="false" afterPath="$PROJECT_DIR$/lib/src/in_app_webview.dart" afterDir="false" />
|
||||
<change afterPath="$PROJECT_DIR$/example/test_assets/in_app_webview_fetch_test.html" afterDir="false" />
|
||||
<change afterPath="$PROJECT_DIR$/example/test_assets/in_app_webview_on_load_resource_custom_scheme_test.html" afterDir="false" />
|
||||
<change afterPath="$PROJECT_DIR$/example/test_driver/in_app_webview_fetch_test.dart" afterDir="false" />
|
||||
<change afterPath="$PROJECT_DIR$/example/test_driver/in_app_webview_on_load_resource_custom_scheme_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$/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$/example/pubspec.yaml" beforeDir="false" afterPath="$PROJECT_DIR$/example/pubspec.yaml" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/example/test_driver/app_test.dart" beforeDir="false" afterPath="$PROJECT_DIR$/example/test_driver/app_test.dart" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/example/test_driver/main_test.dart" beforeDir="false" afterPath="$PROJECT_DIR$/example/test_driver/main_test.dart" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/ios/Classes/InAppWebView.swift" beforeDir="false" afterPath="$PROJECT_DIR$/ios/Classes/InAppWebView.swift" afterDir="false" />
|
||||
</list>
|
||||
<ignored path="$PROJECT_DIR$/.dart_tool/" />
|
||||
<ignored path="$PROJECT_DIR$/.idea/" />
|
||||
|
@ -35,11 +44,41 @@
|
|||
<component name="ExecutionTargetManager" SELECTED_TARGET="Pixel_3_XL_API_24" />
|
||||
<component name="FileEditorManager">
|
||||
<leaf SIDE_TABS_SIZE_LIMIT_KEY="300">
|
||||
<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="544">
|
||||
<caret line="312" column="85" selection-start-line="312" selection-start-column="85" selection-end-line="312" selection-end-column="85" />
|
||||
<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$/lib/src/types.dart">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state relative-caret-position="490">
|
||||
<caret line="1284" selection-start-line="1284" selection-end-line="1284" />
|
||||
</state>
|
||||
</provider>
|
||||
</entry>
|
||||
</file>
|
||||
<file pinned="false" current-in-tab="false">
|
||||
<entry file="file://$PROJECT_DIR$/example/test_driver/in_app_webview_on_load_resource_custom_scheme_test.dart">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state relative-caret-position="-54">
|
||||
<caret line="17" column="66" selection-start-line="17" selection-start-column="24" selection-end-line="17" selection-end-column="66" />
|
||||
</state>
|
||||
</provider>
|
||||
</entry>
|
||||
</file>
|
||||
<file pinned="false" current-in-tab="true">
|
||||
<entry file="file://$PROJECT_DIR$/lib/src/in_app_webview.dart">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state relative-caret-position="483">
|
||||
<caret line="191" column="89" selection-start-line="191" selection-start-column="89" selection-end-line="191" selection-end-column="89" />
|
||||
<state relative-caret-position="511">
|
||||
<caret line="684" column="79" lean-forward="true" selection-start-line="684" selection-start-column="79" selection-end-line="684" selection-end-column="79" />
|
||||
<folding>
|
||||
<element signature="e#0#17#0" expanded="true" />
|
||||
</folding>
|
||||
|
@ -47,6 +86,39 @@
|
|||
</provider>
|
||||
</entry>
|
||||
</file>
|
||||
<file pinned="false" current-in-tab="false">
|
||||
<entry file="file://$PROJECT_DIR$/example/test_driver/app_test.dart">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state relative-caret-position="255">
|
||||
<caret line="67" column="45" selection-start-line="67" selection-start-column="45" selection-end-line="67" selection-end-column="45" />
|
||||
<folding>
|
||||
<element signature="e#35#55#0" expanded="true" />
|
||||
</folding>
|
||||
</state>
|
||||
</provider>
|
||||
</entry>
|
||||
</file>
|
||||
<file pinned="false" current-in-tab="false">
|
||||
<entry file="file://$PROJECT_DIR$/example/test_assets/in_app_webview_fetch_test.html">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state relative-caret-position="135">
|
||||
<caret line="9" column="33" selection-start-line="9" selection-start-column="33" selection-end-line="9" selection-end-column="33" />
|
||||
</state>
|
||||
</provider>
|
||||
</entry>
|
||||
</file>
|
||||
<file pinned="false" current-in-tab="false">
|
||||
<entry file="file://$PROJECT_DIR$/example/test_driver/in_app_webview_fetch_test.dart">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state relative-caret-position="315">
|
||||
<caret line="48" column="95" selection-start-line="48" selection-start-column="95" selection-end-line="48" selection-end-column="95" />
|
||||
<folding>
|
||||
<element signature="e#0#22#0" expanded="true" />
|
||||
</folding>
|
||||
</state>
|
||||
</provider>
|
||||
</entry>
|
||||
</file>
|
||||
</leaf>
|
||||
</component>
|
||||
<component name="FileTemplateManagerImpl">
|
||||
|
@ -59,7 +131,6 @@
|
|||
</component>
|
||||
<component name="FindInProjectRecents">
|
||||
<findStrings>
|
||||
<find>AndroidInAppWebViewModeMenuItem</find>
|
||||
<find>AndroidInAppWebViewMixedContentMode</find>
|
||||
<find>IosInAppWebViewSelectionGranularity</find>
|
||||
<find>preferredContent</find>
|
||||
|
@ -89,6 +160,7 @@
|
|||
<find>t-rex</find>
|
||||
<find>ajaxReq</find>
|
||||
<find>window.</find>
|
||||
<find>shouldInterceptFetchRequest</find>
|
||||
</findStrings>
|
||||
<replaceStrings>
|
||||
<replace>activity.getPreferences(0)</replace>
|
||||
|
@ -114,10 +186,6 @@
|
|||
<component name="IdeDocumentHistory">
|
||||
<option name="CHANGED_PATHS">
|
||||
<list>
|
||||
<option value="$PROJECT_DIR$/example/test/custom_widget_test.dart" />
|
||||
<option value="$PROJECT_DIR$/example/test/custom_assert.dart" />
|
||||
<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" />
|
||||
|
@ -134,7 +202,6 @@
|
|||
<option value="$PROJECT_DIR$/CHANGELOG.md" />
|
||||
<option value="$PROJECT_DIR$/flutter_inappbrowser_tests/assets/index.html" />
|
||||
<option value="$PROJECT_DIR$/example/assets/index.html" />
|
||||
<option value="$PROJECT_DIR$/lib/src/types.dart" />
|
||||
<option value="$PROJECT_DIR$/lib/src/content_blocker.dart" />
|
||||
<option value="$PROJECT_DIR$/nodejs_server_test_auth_basic_and_ssl/index.js" />
|
||||
<option value="$PROJECT_DIR$/flutter_inappbrowser_tests/lib/custom_widget_test.dart" />
|
||||
|
@ -153,22 +220,27 @@
|
|||
<option value="$PROJECT_DIR$/example/lib/inline_example.screen.dart" />
|
||||
<option value="$PROJECT_DIR$/example/test_driver/streamController.dart" />
|
||||
<option value="$PROJECT_DIR$/example/test_driver/app.dart" />
|
||||
<option value="$PROJECT_DIR$/example/test_driver/main_test.dart" />
|
||||
<option value="$PROJECT_DIR$/example/test_driver/in_app_webview_ajax_test.dart" />
|
||||
<option value="$PROJECT_DIR$/example/test_driver/custom_widget_test.dart" />
|
||||
<option value="$PROJECT_DIR$/example/test_driver/in_app_webview_initial_file_test.dart" />
|
||||
<option value="$PROJECT_DIR$/example/test_driver/in_app_webview_initial_url_test.dart" />
|
||||
<option value="$PROJECT_DIR$/example/test_driver/in_app_webview_javascript_handler_test.dart" />
|
||||
<option value="$PROJECT_DIR$/example/test_driver/in_app_webview_on_load_resource_test.dart" />
|
||||
<option value="$PROJECT_DIR$/example/test_driver/util_test.dart" />
|
||||
<option value="$PROJECT_DIR$/example/pubspec.yaml" />
|
||||
<option value="$PROJECT_DIR$/example/test_driver/app_test.dart" />
|
||||
<option value="$PROJECT_DIR$/lib/src/in_app_browser.dart" />
|
||||
<option value="$PROJECT_DIR$/example/test_driver/custom_widget_test.dart" />
|
||||
<option value="$PROJECT_DIR$/example/test_driver/in_app_webview_on_load_resource_custom_scheme_test.dart" />
|
||||
<option value="$PROJECT_DIR$/example/test_driver/main_test.dart" />
|
||||
<option value="$PROJECT_DIR$/example/pubspec.yaml" />
|
||||
<option value="$PROJECT_DIR$/example/test_assets/in_app_webview_on_load_resource_custom_scheme_test.html" />
|
||||
<option value="$PROJECT_DIR$/example/test_driver/app_test.dart" />
|
||||
<option value="$PROJECT_DIR$/example/test_assets/in_app_webview_fetch_test.html" />
|
||||
<option value="$PROJECT_DIR$/example/test_driver/in_app_webview_fetch_test.dart" />
|
||||
<option value="$PROJECT_DIR$/lib/src/types.dart" />
|
||||
<option value="$PROJECT_DIR$/lib/src/in_app_webview.dart" />
|
||||
</list>
|
||||
</option>
|
||||
</component>
|
||||
<component name="ProjectFrameBounds">
|
||||
<component name="ProjectFrameBounds" extendedState="6">
|
||||
<option name="y" value="23" />
|
||||
<option name="width" value="1920" />
|
||||
<option name="height" value="1057" />
|
||||
|
@ -192,6 +264,35 @@
|
|||
<item name="flutter_inappbrowser" type="462c0819:PsiDirectoryNode" />
|
||||
<item name="example" type="462c0819:PsiDirectoryNode" />
|
||||
</path>
|
||||
<path>
|
||||
<item name="flutter_inappbrowser" type="b2602c69:ProjectViewProjectNode" />
|
||||
<item name="flutter_inappbrowser" type="462c0819:PsiDirectoryNode" />
|
||||
<item name="example" type="462c0819:PsiDirectoryNode" />
|
||||
<item name="assets" type="462c0819:PsiDirectoryNode" />
|
||||
</path>
|
||||
<path>
|
||||
<item name="flutter_inappbrowser" type="b2602c69:ProjectViewProjectNode" />
|
||||
<item name="flutter_inappbrowser" type="462c0819:PsiDirectoryNode" />
|
||||
<item name="example" type="462c0819:PsiDirectoryNode" />
|
||||
<item name="test_assets" type="462c0819:PsiDirectoryNode" />
|
||||
</path>
|
||||
<path>
|
||||
<item name="flutter_inappbrowser" type="b2602c69:ProjectViewProjectNode" />
|
||||
<item name="flutter_inappbrowser" type="462c0819:PsiDirectoryNode" />
|
||||
<item name="example" type="462c0819:PsiDirectoryNode" />
|
||||
<item name="test_driver" 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" />
|
||||
</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" />
|
||||
</path>
|
||||
<path>
|
||||
<item name="flutter_inappbrowser" type="b2602c69:ProjectViewProjectNode" />
|
||||
<item name="External Libraries" type="cb654da1:ExternalLibrariesNode" />
|
||||
|
@ -259,13 +360,6 @@
|
|||
<property name="show.migrate.to.gradle.popup" value="false" />
|
||||
</component>
|
||||
<component name="RecentsManager">
|
||||
<key name="CopyFile.RECENT_KEYS">
|
||||
<recent name="$PROJECT_DIR$/example/test_assets" />
|
||||
<recent name="$PROJECT_DIR$/test_driver" />
|
||||
<recent name="$PROJECT_DIR$/flutter_inappbrowser_tests/lib" />
|
||||
<recent name="$PROJECT_DIR$/flutter_inappbrowser_tests/assets" />
|
||||
<recent name="$PROJECT_DIR$/flutter_inappbrowser_tests" />
|
||||
</key>
|
||||
<key name="MoveFile.RECENT_KEYS">
|
||||
<recent name="$PROJECT_DIR$/flutter_inappbrowser_tests/assets" />
|
||||
<recent name="$PROJECT_DIR$/example" />
|
||||
|
@ -273,6 +367,13 @@
|
|||
<recent name="$PROJECT_DIR$/lib" />
|
||||
<recent name="$PROJECT_DIR$/nodejs_server_test_auth_basic_and_ssl/assets" />
|
||||
</key>
|
||||
<key name="CopyFile.RECENT_KEYS">
|
||||
<recent name="$PROJECT_DIR$/example/test_assets" />
|
||||
<recent name="$PROJECT_DIR$/example/test_driver" />
|
||||
<recent name="$PROJECT_DIR$/test_driver" />
|
||||
<recent name="$PROJECT_DIR$/flutter_inappbrowser_tests/lib" />
|
||||
<recent name="$PROJECT_DIR$/flutter_inappbrowser_tests/assets" />
|
||||
</key>
|
||||
</component>
|
||||
<component name="RunDashboard">
|
||||
<option name="ruleStates">
|
||||
|
@ -387,7 +488,7 @@
|
|||
<frame x="0" y="23" width="1920" height="1057" extended-state="6" />
|
||||
<editor active="true" />
|
||||
<layout>
|
||||
<window_info content_ui="combo" id="Project" order="0" sideWeight="0.6529745" visible="true" weight="0.21991481" />
|
||||
<window_info active="true" content_ui="combo" id="Project" order="0" sideWeight="0.6529745" visible="true" weight="0.2087327" />
|
||||
<window_info id="Structure" order="1" sideWeight="0.34702548" side_tool="true" weight="0.15867944" />
|
||||
<window_info id="Designer" order="2" />
|
||||
<window_info id="Build Variants" order="3" side_tool="true" />
|
||||
|
@ -406,7 +507,7 @@
|
|||
<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.3388601" />
|
||||
<window_info anchor="bottom" id="Terminal" order="10" sideWeight="0.49533224" visible="true" weight="0.3388601" />
|
||||
<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" />
|
||||
|
@ -437,26 +538,6 @@
|
|||
</ignored-roots>
|
||||
</component>
|
||||
<component name="editorHistoryManager">
|
||||
<entry file="file://$PROJECT_DIR$/flutter_inappbrowser_tests/assets/in_app_webview_on_load_resource_test.html" />
|
||||
<entry file="file://$PROJECT_DIR$/flutter_inappbrowser_tests/assets/page-1.html" />
|
||||
<entry file="file://$PROJECT_DIR$/CHANGELOG.md">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state relative-caret-position="440">
|
||||
<caret line="47" selection-start-line="47" selection-end-line="47" />
|
||||
</state>
|
||||
</provider>
|
||||
</entry>
|
||||
<entry file="file://$PROJECT_DIR$/flutter_inappbrowser_tests/assets/in_app_webview_javascript_handler_test.html" />
|
||||
<entry file="file://$PROJECT_DIR$/flutter_inappbrowser_tests/assets/index.html" />
|
||||
<entry file="file://$PROJECT_DIR$/flutter_inappbrowser_tests/lib/util_test.dart" />
|
||||
<entry file="file://$PROJECT_DIR$/flutter_inappbrowser_tests/lib/custom_widget_test.dart" />
|
||||
<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="1995">
|
||||
<caret line="133" column="35" selection-start-line="133" selection-start-column="35" selection-end-line="133" selection-end-column="35" />
|
||||
</state>
|
||||
</provider>
|
||||
</entry>
|
||||
<entry file="file://$PROJECT_DIR$/flutter_inappbrowser_tests/ios/Runner/GeneratedPluginRegistrant.m" />
|
||||
<entry file="file://$PROJECT_DIR$/flutter_inappbrowser_tests/ios/Runner/AppDelegate.swift" />
|
||||
<entry file="file://$PROJECT_DIR$/flutter_inappbrowser_tests/ios/Podfile" />
|
||||
|
@ -474,13 +555,6 @@
|
|||
<entry file="file://$PROJECT_DIR$/flutter_inappbrowser_tests/lib/in_app_webview_javascript_handler_test.dart" />
|
||||
<entry file="file://$PROJECT_DIR$/flutter_inappbrowser_tests/lib/main_test.dart" />
|
||||
<entry file="file://$PROJECT_DIR$/flutter_inappbrowser_tests/assets/in_app_webview_ajax_test.html" />
|
||||
<entry file="file://$PROJECT_DIR$/lib/src/types.dart">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state relative-caret-position="17160">
|
||||
<caret line="1151" column="38" selection-start-line="1151" selection-start-column="38" selection-end-line="1151" selection-end-column="38" />
|
||||
</state>
|
||||
</provider>
|
||||
</entry>
|
||||
<entry file="file://$PROJECT_DIR$/test_driver/custom_widget_test.dart" />
|
||||
<entry file="file://$PROJECT_DIR$/test_driver/main_test.dart" />
|
||||
<entry file="file://$PROJECT_DIR$/test_driver/app.dart" />
|
||||
|
@ -504,16 +578,6 @@
|
|||
</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="501">
|
||||
<caret line="103" column="41" selection-start-line="103" selection-start-column="41" selection-end-line="103" selection-end-column="41" />
|
||||
<folding>
|
||||
<element signature="e#0#20#0" expanded="true" />
|
||||
</folding>
|
||||
</state>
|
||||
</provider>
|
||||
</entry>
|
||||
<entry file="file://$PROJECT_DIR$/example/.flutter-plugins">
|
||||
<provider selected="true" editor-type-id="text-editor" />
|
||||
</entry>
|
||||
|
@ -546,97 +610,9 @@
|
|||
</state>
|
||||
</provider>
|
||||
</entry>
|
||||
<entry file="file://$PROJECT_DIR$/example/test_assets/in_app_webview_initial_file_test.html">
|
||||
<provider selected="true" editor-type-id="text-editor" />
|
||||
</entry>
|
||||
<entry file="file://$PROJECT_DIR$/example/assets/index.html">
|
||||
<entry file="file://$PROJECT_DIR$/example/test_assets/index.html">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state relative-caret-position="547">
|
||||
<caret line="98" column="15" selection-start-line="96" selection-start-column="12" selection-end-line="98" selection-end-column="15" />
|
||||
</state>
|
||||
</provider>
|
||||
</entry>
|
||||
<entry file="file://$PROJECT_DIR$/example/test_assets/in_app_webview_on_load_resource_test.html">
|
||||
<provider selected="true" editor-type-id="text-editor" />
|
||||
</entry>
|
||||
<entry file="file://$PROJECT_DIR$/example/test_driver/in_app_webview_ajax_test.dart">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state relative-caret-position="135">
|
||||
<caret line="9" column="70" selection-start-line="9" selection-start-column="70" selection-end-line="9" selection-end-column="70" />
|
||||
<folding>
|
||||
<element signature="e#0#39#0" expanded="true" />
|
||||
</folding>
|
||||
</state>
|
||||
</provider>
|
||||
</entry>
|
||||
<entry file="file://$PROJECT_DIR$/example/test_driver/custom_widget_test.dart">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state relative-caret-position="105">
|
||||
<caret line="7" column="41" selection-start-line="7" selection-start-column="41" selection-end-line="7" selection-end-column="41" />
|
||||
<folding>
|
||||
<element signature="e#0#38#0" expanded="true" />
|
||||
</folding>
|
||||
</state>
|
||||
</provider>
|
||||
</entry>
|
||||
<entry file="file://$PROJECT_DIR$/example/test_driver/in_app_webview_initial_file_test.dart">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state relative-caret-position="150">
|
||||
<caret line="10" selection-start-line="10" selection-end-line="10" />
|
||||
<folding>
|
||||
<element signature="e#0#39#0" expanded="true" />
|
||||
</folding>
|
||||
</state>
|
||||
</provider>
|
||||
</entry>
|
||||
<entry file="file://$PROJECT_DIR$/example/test_driver/in_app_webview_javascript_handler_test.dart">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state relative-caret-position="360">
|
||||
<caret line="24" column="2" selection-start-line="24" selection-start-column="2" selection-end-line="24" selection-end-column="2" />
|
||||
<folding>
|
||||
<element signature="e#0#39#0" expanded="true" />
|
||||
</folding>
|
||||
</state>
|
||||
</provider>
|
||||
</entry>
|
||||
<entry file="file://$PROJECT_DIR$/example/test_driver/in_app_webview_initial_url_test.dart">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state relative-caret-position="150">
|
||||
<caret line="10" selection-start-line="10" selection-end-line="10" />
|
||||
<folding>
|
||||
<element signature="e#0#39#0" expanded="true" />
|
||||
</folding>
|
||||
</state>
|
||||
</provider>
|
||||
</entry>
|
||||
<entry file="file://$PROJECT_DIR$/example/test_driver/in_app_webview_on_load_resource_test.dart">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state relative-caret-position="150">
|
||||
<caret line="10" column="2" selection-start-line="10" selection-start-column="2" selection-end-line="10" selection-end-column="2" />
|
||||
<folding>
|
||||
<element signature="e#0#39#0" expanded="true" />
|
||||
</folding>
|
||||
</state>
|
||||
</provider>
|
||||
</entry>
|
||||
<entry file="file://$PROJECT_DIR$/example/test_driver/main_test.dart">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state relative-caret-position="82">
|
||||
<caret line="13" column="12" selection-start-line="13" selection-start-column="6" selection-end-line="13" selection-end-column="12" />
|
||||
<folding>
|
||||
<element signature="e#0#20#0" expanded="true" />
|
||||
</folding>
|
||||
</state>
|
||||
</provider>
|
||||
</entry>
|
||||
<entry file="file://$PROJECT_DIR$/example/test_driver/app_test.dart">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state relative-caret-position="-876">
|
||||
<caret line="11" column="4" selection-start-line="11" selection-start-column="4" selection-end-line="11" selection-end-column="4" />
|
||||
<folding>
|
||||
<element signature="e#35#55#0" expanded="true" />
|
||||
</folding>
|
||||
</state>
|
||||
<state relative-caret-position="-1678" />
|
||||
</provider>
|
||||
</entry>
|
||||
<entry file="file://$PROJECT_DIR$/example/test_driver/util_test.dart">
|
||||
|
@ -649,22 +625,156 @@
|
|||
</state>
|
||||
</provider>
|
||||
</entry>
|
||||
<entry file="file://$PROJECT_DIR$/example/test_assets/index.html">
|
||||
<entry file="file://$PROJECT_DIR$/example/test_driver/custom_widget_test.dart">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state relative-caret-position="-1678" />
|
||||
<state relative-caret-position="225">
|
||||
<caret line="15" column="49" lean-forward="true" selection-start-line="15" selection-start-column="49" selection-end-line="16" selection-end-column="33" />
|
||||
<folding>
|
||||
<element signature="e#0#38#0" expanded="true" />
|
||||
</folding>
|
||||
</state>
|
||||
</provider>
|
||||
</entry>
|
||||
<entry file="file://$PROJECT_DIR$/example/assets/page-1.html">
|
||||
<provider selected="true" editor-type-id="text-editor" />
|
||||
</entry>
|
||||
<entry file="file://$PROJECT_DIR$/example/test_driver/in_app_webview_aja_test.dart">
|
||||
<provider selected="true" editor-type-id="text-editor" />
|
||||
</entry>
|
||||
<entry file="file://$USER_HOME$/flutter/bin/cache/pkg/sky_engine/lib/convert/codec.dart">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state relative-caret-position="204">
|
||||
<caret line="20" column="4" selection-start-line="20" selection-start-column="4" selection-end-line="20" selection-end-column="4" />
|
||||
</state>
|
||||
</provider>
|
||||
</entry>
|
||||
<entry file="file://$PROJECT_DIR$/example/test_assets/in_app_webview_ajax_test.html">
|
||||
<provider selected="true" editor-type-id="text-editor" />
|
||||
</entry>
|
||||
<entry file="file://$PROJECT_DIR$/example/assets/index.html">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state relative-caret-position="173">
|
||||
<caret line="80" column="65" selection-start-line="80" selection-start-column="12" selection-end-line="80" selection-end-column="65" />
|
||||
</state>
|
||||
</provider>
|
||||
</entry>
|
||||
<entry file="file://$PROJECT_DIR$/example/test_driver/in_app_webview_initial_file_test.dart">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state relative-caret-position="-152">
|
||||
<caret line="10" selection-start-line="10" selection-end-line="10" />
|
||||
</state>
|
||||
</provider>
|
||||
</entry>
|
||||
<entry file="file://$PROJECT_DIR$/example/test_driver/in_app_webview_initial_url_test.dart">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state relative-caret-position="-109">
|
||||
<caret line="10" selection-start-line="10" selection-end-line="10" />
|
||||
</state>
|
||||
</provider>
|
||||
</entry>
|
||||
<entry file="file://$PROJECT_DIR$/example/test_driver/in_app_webview_ajax_test.dart">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state relative-caret-position="314">
|
||||
<caret line="57" column="134" selection-start-line="57" selection-start-column="24" selection-end-line="57" selection-end-column="134" />
|
||||
</state>
|
||||
</provider>
|
||||
</entry>
|
||||
<entry file="file://$PROJECT_DIR$/example/test_driver/in_app_webview_javascript_handler_test.dart">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state relative-caret-position="3">
|
||||
<caret line="30" selection-start-line="30" selection-end-line="30" />
|
||||
</state>
|
||||
</provider>
|
||||
</entry>
|
||||
<entry file="file://$PROJECT_DIR$/example/test_driver/main_test.dart">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state relative-caret-position="195">
|
||||
<caret line="24" column="46" selection-start-line="24" selection-start-column="46" selection-end-line="24" selection-end-column="46" />
|
||||
</state>
|
||||
</provider>
|
||||
</entry>
|
||||
<entry file="file://$PROJECT_DIR$/example/test_assets/in_app_webview_initial_file_test.html">
|
||||
<provider selected="true" editor-type-id="text-editor" />
|
||||
</entry>
|
||||
<entry file="file://$PROJECT_DIR$/example/test_driver/in_app_webview_on_load_resource_test.dart">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state relative-caret-position="-332">
|
||||
<caret line="10" selection-start-line="10" selection-end-line="10" />
|
||||
</state>
|
||||
</provider>
|
||||
</entry>
|
||||
<entry file="file://$PROJECT_DIR$/example/test_assets/in_app_webview_on_load_resource_test.html">
|
||||
<provider selected="true" editor-type-id="text-editor" />
|
||||
</entry>
|
||||
<entry file="file://$PROJECT_DIR$/example/pubspec.yaml">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state relative-caret-position="130">
|
||||
<caret line="23" column="28" selection-start-line="23" selection-start-column="28" selection-end-line="23" selection-end-column="28" />
|
||||
<state relative-caret-position="400">
|
||||
<caret line="57" column="6" selection-start-line="57" selection-start-column="6" selection-end-line="57" selection-end-column="6" />
|
||||
</state>
|
||||
</provider>
|
||||
</entry>
|
||||
<entry file="file://$PROJECT_DIR$/example/test_driver/in_app_webview_fetch_test.dart">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state relative-caret-position="315">
|
||||
<caret line="48" column="95" selection-start-line="48" selection-start-column="95" selection-end-line="48" selection-end-column="95" />
|
||||
<folding>
|
||||
<element signature="e#0#22#0" expanded="true" />
|
||||
</folding>
|
||||
</state>
|
||||
</provider>
|
||||
</entry>
|
||||
<entry file="file://$PROJECT_DIR$/example/test_driver/app_test.dart">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state relative-caret-position="255">
|
||||
<caret line="67" column="45" selection-start-line="67" selection-start-column="45" selection-end-line="67" selection-end-column="45" />
|
||||
<folding>
|
||||
<element signature="e#35#55#0" expanded="true" />
|
||||
</folding>
|
||||
</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="544">
|
||||
<caret line="312" column="85" selection-start-line="312" selection-start-column="85" selection-end-line="312" selection-end-column="85" />
|
||||
<folding>
|
||||
<element signature="e#0#20#0" expanded="true" />
|
||||
</folding>
|
||||
</state>
|
||||
</provider>
|
||||
</entry>
|
||||
<entry file="file://$PROJECT_DIR$/lib/src/types.dart">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state relative-caret-position="490">
|
||||
<caret line="1284" selection-start-line="1284" selection-end-line="1284" />
|
||||
</state>
|
||||
</provider>
|
||||
</entry>
|
||||
<entry file="file://$PROJECT_DIR$/example/test_assets/in_app_webview_on_load_resource_custom_scheme_test.html">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state relative-caret-position="300">
|
||||
<caret line="20" column="11" selection-start-line="20" selection-start-column="11" selection-end-line="20" selection-end-column="11" />
|
||||
</state>
|
||||
</provider>
|
||||
</entry>
|
||||
<entry file="file://$PROJECT_DIR$/example/test_assets/in_app_webview_fetch_test.html">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state relative-caret-position="135">
|
||||
<caret line="9" column="33" selection-start-line="9" selection-start-column="33" selection-end-line="9" selection-end-column="33" />
|
||||
</state>
|
||||
</provider>
|
||||
</entry>
|
||||
<entry file="file://$PROJECT_DIR$/example/test_driver/in_app_webview_on_load_resource_custom_scheme_test.dart">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state relative-caret-position="-54">
|
||||
<caret line="17" column="66" selection-start-line="17" selection-start-column="24" selection-end-line="17" selection-end-column="66" />
|
||||
</state>
|
||||
</provider>
|
||||
</entry>
|
||||
<entry file="file://$PROJECT_DIR$/lib/src/in_app_webview.dart">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state relative-caret-position="483">
|
||||
<caret line="191" column="89" selection-start-line="191" selection-start-column="89" selection-end-line="191" selection-end-column="89" />
|
||||
<state relative-caret-position="511">
|
||||
<caret line="684" column="79" lean-forward="true" selection-start-line="684" selection-start-column="79" selection-end-line="684" selection-end-column="79" />
|
||||
<folding>
|
||||
<element signature="e#0#17#0" expanded="true" />
|
||||
</folding>
|
||||
|
|
|
@ -445,22 +445,44 @@ final public class InAppWebView extends InputAwareWebView {
|
|||
" controller.abort();" +
|
||||
" break;" +
|
||||
" }" +
|
||||
" var resultResource = (result.url != null) ? result.url : resource;" +
|
||||
" var resultInit = init;" +
|
||||
" if (result.init != null) {" +
|
||||
" resultInit.method = result.method;" +
|
||||
" resultInit.headers = convertJsonToHeaders(result.headers);" +
|
||||
" resultInit.body = convertArrayIntBodyToUint8Array(result.body);" +
|
||||
" resultInit.mode = result.mode;" +
|
||||
" resultInit.credentials = convertJsonToCredential(result.credentials);" +
|
||||
" resultInit.cache = result.cache;" +
|
||||
" resultInit.redirect = result.redirect;" +
|
||||
" resultInit.referrer = result.referrer;" +
|
||||
" resultInit.referrerPolicy = result.referrerPolicy;" +
|
||||
" resultInit.integrity = result.integrity;" +
|
||||
" resultInit.keepalive = result.keepalive;" +
|
||||
" resource = (result.url != null) ? result.url : resource;" +
|
||||
" if (init == null) {" +
|
||||
" init = {};" +
|
||||
" }" +
|
||||
" return fetch(resultResource, resultInit);" +
|
||||
" if (result.method != null && result.method.length > 0) {" +
|
||||
" init.method = result.method;" +
|
||||
" }" +
|
||||
" if (result.headers != null && Object.keys(result.headers).length > 0) {" +
|
||||
" init.headers = convertJsonToHeaders(result.headers);" +
|
||||
" }" +
|
||||
" if (result.body != null && result.body.length > 0) {" +
|
||||
" init.body = convertArrayIntBodyToUint8Array(result.body);" +
|
||||
" }" +
|
||||
" if (result.mode != null && result.mode.length > 0) {" +
|
||||
" init.mode = result.mode;" +
|
||||
" }" +
|
||||
" if (result.credentials != null) {" +
|
||||
" init.credentials = convertJsonToCredential(result.credentials);" +
|
||||
" }" +
|
||||
" if (result.cache != null && result.cache.length > 0) {" +
|
||||
" init.cache = result.cache;" +
|
||||
" }" +
|
||||
" if (result.redirect != null && result.redirect.length > 0) {" +
|
||||
" init.redirect = result.redirect;" +
|
||||
" }" +
|
||||
" if (result.referrer != null && result.referrer.length > 0) {" +
|
||||
" init.referrer = result.referrer;" +
|
||||
" }" +
|
||||
" if (result.referrerPolicy != null && result.referrerPolicy.length > 0) {" +
|
||||
" init.referrerPolicy = result.referrerPolicy;" +
|
||||
" }" +
|
||||
" if (result.integrity != null && result.integrity.length > 0) {" +
|
||||
" init.integrity = result.integrity;" +
|
||||
" }" +
|
||||
" if (result.keepalive != null) {" +
|
||||
" init.keepalive = result.keepalive;" +
|
||||
" }" +
|
||||
" return fetch(resource, init);" +
|
||||
" }" +
|
||||
" return fetch(resource, init);" +
|
||||
" });" +
|
||||
|
|
|
@ -54,6 +54,8 @@ flutter:
|
|||
- test_assets/in_app_webview_on_load_resource_test.html
|
||||
- test_assets/in_app_webview_javascript_handler_test.html
|
||||
- test_assets/in_app_webview_ajax_test.html
|
||||
- test_assets/in_app_webview_fetch_test.html
|
||||
- test_assets/in_app_webview_on_load_resource_custom_scheme_test.html
|
||||
- test_assets/css/
|
||||
- test_assets/images/
|
||||
- test_assets/favicon.ico
|
||||
|
|
|
@ -0,0 +1,40 @@
|
|||
<!doctype html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta name="viewport" content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0">
|
||||
<meta http-equiv="X-UA-Compatible" content="ie=edge">
|
||||
<title>InAppWebViewFetchTest</title>
|
||||
</head>
|
||||
<body>
|
||||
<h1>InAppWebViewFetchTest</h1>
|
||||
<script>
|
||||
window.addEventListener('flutterInAppBrowserPlatformReady', function(event) {
|
||||
fetch(new Request("http://192.168.1.20:8082/test-download-file")).then(function(response) {
|
||||
window.flutter_inappbrowser.callHandler('fetchGet', response.status);
|
||||
}).catch(function(error) {
|
||||
window.flutter_inappbrowser.callHandler('fetchGet', "ERROR: " + error);
|
||||
});
|
||||
|
||||
fetch("http://192.168.1.20:8082/test-ajax-post", {
|
||||
method: 'POST',
|
||||
body: JSON.stringify({
|
||||
firstname: 'Foo',
|
||||
lastname: 'Bar'
|
||||
}),
|
||||
headers: {
|
||||
'Content-Type': 'application/json'
|
||||
}
|
||||
}).then(function(response) {
|
||||
response.json().then(function(value) {
|
||||
window.flutter_inappbrowser.callHandler('fetchPost', value);
|
||||
}).catch(function(error) {
|
||||
window.flutter_inappbrowser.callHandler('fetchPost', "ERROR: " + error);
|
||||
});
|
||||
}).catch(function(error) {
|
||||
window.flutter_inappbrowser.callHandler('fetchPost', "ERROR: " + error);
|
||||
});
|
||||
});
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
|
@ -0,0 +1,23 @@
|
|||
<!doctype html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta name="viewport" content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0">
|
||||
<meta http-equiv="X-UA-Compatible" content="ie=edge">
|
||||
<title>InAppWebViewOnLoadResourceCustomSchemeTest</title>
|
||||
</head>
|
||||
<body class="text-center">
|
||||
<div class="cover-container d-flex w-100 h-100 p-3 mx-auto flex-column">
|
||||
<main role="main" class="inner cover">
|
||||
<h1 class="cover-heading">InAppWebViewOnLoadResourceCustomSchemeTest</h1>
|
||||
<img id="image" src="my-special-custom-scheme://images/flutter-logo.svg" alt="flutter logo">
|
||||
</main>
|
||||
</div>
|
||||
</body>
|
||||
<script>
|
||||
var image = document.querySelector("#image");
|
||||
image.addEventListener('load', function() {
|
||||
window.flutter_inappbrowser.callHandler('imageLoaded');
|
||||
});
|
||||
</script>
|
||||
</html>
|
|
@ -1,7 +1,6 @@
|
|||
// Imports the Flutter Driver API.
|
||||
import 'dart:async';
|
||||
|
||||
import 'package:flutter/cupertino.dart';
|
||||
import 'package:flutter_driver/flutter_driver.dart';
|
||||
import 'package:test/test.dart';
|
||||
|
||||
|
@ -22,21 +21,14 @@ void main() {
|
|||
}
|
||||
});
|
||||
|
||||
myTest({@required String name, @required Function callback, Timeout timeout}) {
|
||||
timeout = (timeout == null) ? new Timeout(new Duration(minutes: 5)) : timeout;
|
||||
test(name, () async {
|
||||
await Future.delayed(const Duration(milliseconds: 2000));
|
||||
callback();
|
||||
}, timeout: timeout);
|
||||
}
|
||||
|
||||
//
|
||||
// IMPORTANT NOTE!!!
|
||||
// These tests need to follow the same order of "var routes" in "buildRoutes()" function
|
||||
// defined in main_test.dart
|
||||
//
|
||||
|
||||
myTest(name: 'InAppWebViewInitialUrlTest', callback: () async {
|
||||
test('InAppWebViewInitialUrlTest', () async {
|
||||
await Future.delayed(const Duration(milliseconds: 2000));
|
||||
final appBarTitle = find.byValueKey('AppBarTitle');
|
||||
|
||||
while((await driver.getText(appBarTitle)) == "InAppWebViewInitialUrlTest") {
|
||||
|
@ -45,9 +37,10 @@ void main() {
|
|||
|
||||
String url = await driver.getText(appBarTitle);
|
||||
expect(url, "https://flutter.dev/");
|
||||
});
|
||||
}, timeout: new Timeout(new Duration(minutes: 5)));
|
||||
|
||||
myTest(name: 'InAppWebViewInitialFileTest', callback: () async {
|
||||
test('InAppWebViewInitialFileTest', () async {
|
||||
await Future.delayed(const Duration(milliseconds: 2000));
|
||||
final appBarTitle = find.byValueKey('AppBarTitle');
|
||||
|
||||
while((await driver.getText(appBarTitle)) == "InAppWebViewInitialFileTest") {
|
||||
|
@ -56,9 +49,10 @@ void main() {
|
|||
|
||||
String title = await driver.getText(appBarTitle);
|
||||
expect(title, "true");
|
||||
});
|
||||
}, timeout: new Timeout(new Duration(minutes: 5)));
|
||||
|
||||
myTest(name: 'InAppWebViewOnLoadResourceTest', callback: () async {
|
||||
test('InAppWebViewOnLoadResourceTest', () async {
|
||||
await Future.delayed(const Duration(milliseconds: 2000));
|
||||
List<String> resourceList = [
|
||||
"https://getbootstrap.com/docs/4.3/dist/css/bootstrap.min.css",
|
||||
"https://code.jquery.com/jquery-3.3.1.min.js",
|
||||
|
@ -71,13 +65,13 @@ void main() {
|
|||
}
|
||||
|
||||
String title = await driver.getText(appBarTitle);
|
||||
print(title);
|
||||
for (String resource in resourceList) {
|
||||
expect(true, title.contains(resource));
|
||||
}
|
||||
});
|
||||
}, timeout: new Timeout(new Duration(minutes: 5)));
|
||||
|
||||
myTest(name: 'InAppWebViewJavaScriptHandlerTest', callback: () async {
|
||||
test('InAppWebViewJavaScriptHandlerTest', () async {
|
||||
await Future.delayed(const Duration(milliseconds: 2000));
|
||||
final appBarTitle = find.byValueKey('AppBarTitle');
|
||||
|
||||
while((await driver.getText(appBarTitle)) == "InAppWebViewJavaScriptHandlerTest") {
|
||||
|
@ -86,9 +80,10 @@ void main() {
|
|||
|
||||
String title = await driver.getText(appBarTitle);
|
||||
expect(true, !title.contains("false"));
|
||||
});
|
||||
}, timeout: new Timeout(new Duration(minutes: 5)));
|
||||
|
||||
myTest(name: 'InAppWebViewAjaxTest', callback: () async {
|
||||
test('InAppWebViewAjaxTest', () async {
|
||||
await Future.delayed(const Duration(milliseconds: 2000));
|
||||
final appBarTitle = find.byValueKey('AppBarTitle');
|
||||
|
||||
while((await driver.getText(appBarTitle)) == "InAppWebViewAjaxTest") {
|
||||
|
@ -97,6 +92,31 @@ void main() {
|
|||
|
||||
String title = await driver.getText(appBarTitle);
|
||||
expect(title, "Lorenzo Pichilli Lorenzo Pichilli");
|
||||
});
|
||||
}, timeout: new Timeout(new Duration(minutes: 5)));
|
||||
|
||||
test('InAppWebViewOnLoadResourceCustomSchemeTest', () async {
|
||||
await Future.delayed(const Duration(milliseconds: 2000));
|
||||
final appBarTitle = find.byValueKey('AppBarTitle');
|
||||
|
||||
while((await driver.getText(appBarTitle)) == "InAppWebViewOnLoadResourceCustomSchemeTest") {
|
||||
await Future.delayed(const Duration(milliseconds: 1000));
|
||||
}
|
||||
|
||||
String title = await driver.getText(appBarTitle);
|
||||
expect(title, "true");
|
||||
}, timeout: new Timeout(new Duration(minutes: 5)));
|
||||
|
||||
test('InAppWebViewFetchTest', () async {
|
||||
await Future.delayed(const Duration(milliseconds: 2000));
|
||||
final appBarTitle = find.byValueKey('AppBarTitle');
|
||||
|
||||
while((await driver.getText(appBarTitle)) == "InAppWebViewFetchTest") {
|
||||
await Future.delayed(const Duration(milliseconds: 1000));
|
||||
}
|
||||
|
||||
String title = await driver.getText(appBarTitle);
|
||||
expect(true, title.contains("Lorenzo Pichilli") && title.contains("200"));
|
||||
}, timeout: new Timeout(new Duration(minutes: 5)));
|
||||
|
||||
});
|
||||
}
|
|
@ -0,0 +1,85 @@
|
|||
import 'dart:convert';
|
||||
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
import 'package:flutter_inappbrowser/flutter_inappbrowser.dart';
|
||||
|
||||
import 'main_test.dart';
|
||||
import 'util_test.dart';
|
||||
import 'custom_widget_test.dart';
|
||||
|
||||
class InAppWebViewFetchTest extends WidgetTest {
|
||||
final InAppWebViewFetchTestState state = InAppWebViewFetchTestState();
|
||||
|
||||
@override
|
||||
InAppWebViewFetchTestState createState() => state;
|
||||
}
|
||||
|
||||
class InAppWebViewFetchTestState extends WidgetTestState {
|
||||
String appBarTitle = "InAppWebViewFetchTest";
|
||||
int totTests = 2;
|
||||
int testsDone = 0;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Scaffold(
|
||||
appBar: myAppBar(state: this, title: appBarTitle),
|
||||
body: Container(
|
||||
child: Column(children: <Widget>[
|
||||
Expanded(
|
||||
child: Container(
|
||||
child: InAppWebView(
|
||||
initialFile: "test_assets/in_app_webview_fetch_test.html",
|
||||
initialHeaders: {},
|
||||
initialOptions: InAppWebViewWidgetOptions(
|
||||
inAppWebViewOptions: InAppWebViewOptions(
|
||||
clearCache: true,
|
||||
debuggingEnabled: true,
|
||||
useShouldInterceptFetchRequest: true,
|
||||
)
|
||||
),
|
||||
onWebViewCreated: (InAppWebViewController controller) {
|
||||
webView = controller;
|
||||
|
||||
webView.addJavaScriptHandler(handlerName: "fetchGet", callback: (args) {
|
||||
appBarTitle = (appBarTitle == "InAppWebViewFetchTest") ? args[0].toString() : appBarTitle + " " + args[0].toString();
|
||||
updateCountTest(context: context);
|
||||
});
|
||||
|
||||
webView.addJavaScriptHandler(handlerName: "fetchPost", callback: (args) {
|
||||
appBarTitle = (appBarTitle == "InAppWebViewFetchTest") ? args[0]["fullname"] : appBarTitle + " " + args[0]["fullname"];
|
||||
updateCountTest(context: context);
|
||||
});
|
||||
},
|
||||
onLoadStart: (InAppWebViewController controller, String url) {
|
||||
|
||||
},
|
||||
onLoadStop: (InAppWebViewController controller, String url) {
|
||||
|
||||
},
|
||||
shouldInterceptFetchRequest: (InAppWebViewController controller, FetchRequest fetchRequest) async {
|
||||
if (fetchRequest.url.endsWith("/test-ajax-post")) {
|
||||
fetchRequest.body = utf8.encode("""{
|
||||
"firstname": "Lorenzo",
|
||||
"lastname": "Pichilli"
|
||||
}
|
||||
""");
|
||||
}
|
||||
return fetchRequest;
|
||||
},
|
||||
),
|
||||
),
|
||||
),
|
||||
])
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
void updateCountTest({@required BuildContext context}) {
|
||||
testsDone++;
|
||||
if (testsDone == totTests) {
|
||||
setState(() { });
|
||||
nextTest(context: context, state: this);
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,69 @@
|
|||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter/services.dart';
|
||||
|
||||
import 'package:flutter_inappbrowser/flutter_inappbrowser.dart';
|
||||
|
||||
import 'main_test.dart';
|
||||
import 'util_test.dart';
|
||||
import 'custom_widget_test.dart';
|
||||
|
||||
class InAppWebViewOnLoadResourceCustomSchemeTest extends WidgetTest {
|
||||
final InAppWebViewOnLoadResourceCustomSchemeTestState state = InAppWebViewOnLoadResourceCustomSchemeTestState();
|
||||
|
||||
@override
|
||||
InAppWebViewOnLoadResourceCustomSchemeTestState createState() => state;
|
||||
}
|
||||
|
||||
class InAppWebViewOnLoadResourceCustomSchemeTestState extends WidgetTestState {
|
||||
String appBarTitle = "InAppWebViewOnLoadResourceCustomSchemeTest";
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Scaffold(
|
||||
appBar: myAppBar(state: this, title: appBarTitle),
|
||||
body: Container(
|
||||
child: Column(children: <Widget>[
|
||||
Expanded(
|
||||
child: Container(
|
||||
child: InAppWebView(
|
||||
initialFile: "test_assets/in_app_webview_on_load_resource_custom_scheme_test.html",
|
||||
initialHeaders: {},
|
||||
initialOptions: InAppWebViewWidgetOptions(
|
||||
inAppWebViewOptions: InAppWebViewOptions(
|
||||
clearCache: true,
|
||||
debuggingEnabled: true,
|
||||
resourceCustomSchemes: ["my-special-custom-scheme"]
|
||||
)
|
||||
),
|
||||
onWebViewCreated: (InAppWebViewController controller) {
|
||||
webView = controller;
|
||||
|
||||
webView.addJavaScriptHandler(handlerName: "imageLoaded", callback: (args) {
|
||||
setState(() {
|
||||
appBarTitle = "true";
|
||||
});
|
||||
nextTest(context: context, state: this);
|
||||
});
|
||||
},
|
||||
onLoadStart: (InAppWebViewController controller, String url) {
|
||||
|
||||
},
|
||||
onLoadStop: (InAppWebViewController controller, String url) {
|
||||
|
||||
},
|
||||
onLoadResourceCustomScheme: (InAppWebViewController controller, String scheme, String url) async {
|
||||
if (scheme == "my-special-custom-scheme") {
|
||||
var bytes = await rootBundle.load("test_assets/" + url.replaceFirst("my-special-custom-scheme://", "", 0));
|
||||
var response = new CustomSchemeResponse(data: bytes.buffer.asUint8List(), contentType: "image/svg+xml", contentEnconding: "utf-8");
|
||||
return response;
|
||||
}
|
||||
return null;
|
||||
},
|
||||
),
|
||||
),
|
||||
),
|
||||
])
|
||||
)
|
||||
);
|
||||
}
|
||||
}
|
|
@ -4,9 +4,11 @@ import 'package:flutter/material.dart';
|
|||
|
||||
import 'custom_widget_test.dart';
|
||||
import 'in_app_webview_ajax_test.dart';
|
||||
import 'in_app_webview_fetch_test.dart';
|
||||
import 'in_app_webview_initial_file_test.dart';
|
||||
import 'in_app_webview_initial_url_test.dart';
|
||||
import 'in_app_webview_javascript_handler_test.dart';
|
||||
import 'in_app_webview_on_load_resource_custom_scheme_test.dart';
|
||||
import 'in_app_webview_on_load_resource_test.dart';
|
||||
|
||||
List<String> testRoutes = [];
|
||||
|
@ -17,6 +19,8 @@ Map<String, WidgetBuilder> buildRoutes({@required BuildContext context}) {
|
|||
'/InAppWebViewOnLoadResourceTest': (context) => InAppWebViewOnLoadResourceTest(),
|
||||
'/InAppWebViewJavaScriptHandlerTest': (context) => InAppWebViewJavaScriptHandlerTest(),
|
||||
'/InAppWebViewAjaxTest': (context) => InAppWebViewAjaxTest(),
|
||||
'/InAppWebViewOnLoadResourceCustomSchemeTest': (context) => InAppWebViewOnLoadResourceCustomSchemeTest(),
|
||||
'/InAppWebViewFetchTest': (context) => InAppWebViewFetchTest(),
|
||||
};
|
||||
routes.forEach((k, v) => testRoutes.add(k));
|
||||
return routes;
|
||||
|
|
|
@ -597,22 +597,44 @@ let interceptFetchRequestsJS = """
|
|||
controller.abort();
|
||||
break;
|
||||
}
|
||||
var resultResource = (result.url != null) ? result.url : resource;
|
||||
var resultInit = init;
|
||||
if (result.init != null) {
|
||||
resultInit.method = result.method;
|
||||
resultInit.headers = convertJsonToHeaders(result.headers);
|
||||
resultInit.body = convertArrayIntBodyToUint8Array(result.body);
|
||||
resultInit.mode = result.mode;
|
||||
resultInit.credentials = convertJsonToCredential(result.credentials);
|
||||
resultInit.cache = result.cache;
|
||||
resultInit.redirect = result.redirect;
|
||||
resultInit.referrer = result.referrer;
|
||||
resultInit.referrerPolicy = result.referrerPolicy;
|
||||
resultInit.integrity = result.integrity;
|
||||
resultInit.keepalive = result.keepalive;
|
||||
resource = (result.url != null) ? result.url : resource;
|
||||
if (init == null) {
|
||||
init = {};
|
||||
}
|
||||
return fetch(resultResource, resultInit);
|
||||
if (result.method != null && result.method.length > 0) {
|
||||
init.method = result.method;
|
||||
}
|
||||
if (result.headers != null && Object.keys(result.headers).length > 0) {
|
||||
init.headers = convertJsonToHeaders(result.headers);
|
||||
}
|
||||
if (result.body != null && result.body.length > 0) {
|
||||
init.body = convertArrayIntBodyToUint8Array(result.body);
|
||||
}
|
||||
if (result.mode != null && result.mode.length > 0) {
|
||||
init.mode = result.mode;
|
||||
}
|
||||
if (result.credentials != null) {
|
||||
init.credentials = convertJsonToCredential(result.credentials);
|
||||
}
|
||||
if (result.cache != null && result.cache.length > 0) {
|
||||
init.cache = result.cache;
|
||||
}
|
||||
if (result.redirect != null && result.redirect.length > 0) {
|
||||
init.redirect = result.redirect;
|
||||
}
|
||||
if (result.referrer != null && result.referrer.length > 0) {
|
||||
init.referrer = result.referrer;
|
||||
}
|
||||
if (result.referrerPolicy != null && result.referrerPolicy.length > 0) {
|
||||
init.referrerPolicy = result.referrerPolicy;
|
||||
}
|
||||
if (result.integrity != null && result.integrity.length > 0) {
|
||||
init.integrity = result.integrity;
|
||||
}
|
||||
if (result.keepalive != null) {
|
||||
init.keepalive = result.keepalive;
|
||||
}
|
||||
return fetch(resource, init);
|
||||
}
|
||||
return fetch(resource, init);
|
||||
});
|
||||
|
|
Loading…
Reference in New Issue