Commit ab0cbaf9 authored by Justin Cohen's avatar Justin Cohen Committed by Commit Bot

[ios] Re-enable WebViewRestorableStateTest.EncodeDecode on older devices.

The KeepRendererProcess alive logic still hasn't been ported to ios/web_view.
Manually add the restored web_view to the view hiearchy for this case.

Bug: 1001965, 944077
Change-Id: I4e810b68bfebd1bc44320cc376a8a6e16743393a
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1791272
Commit-Queue: Justin Cohen <justincohen@chromium.org>
Auto-Submit: Justin Cohen <justincohen@chromium.org>
Reviewed-by: default avatarEugene But <eugenebut@chromium.org>
Cr-Commit-Position: refs/heads/master@{#695027}
parent 340a17ae
...@@ -22,13 +22,6 @@ namespace ios_web_view { ...@@ -22,13 +22,6 @@ namespace ios_web_view {
// methods. // methods.
typedef ios_web_view::WebViewInttestBase WebViewRestorableStateTest; typedef ios_web_view::WebViewInttestBase WebViewRestorableStateTest;
TEST_F(WebViewRestorableStateTest, EncodeDecode) { TEST_F(WebViewRestorableStateTest, EncodeDecode) {
#if !TARGET_IPHONE_SIMULATOR
if (@available(iOS 12.2, *)) {
} else {
// crbug.com/(1001965): Test disabled on iOS 12.1 and older devices.
return;
}
#endif
// Load 2 URLs to create non-default state. // Load 2 URLs to create non-default state.
ASSERT_FALSE([web_view_ lastCommittedURL]); ASSERT_FALSE([web_view_ lastCommittedURL]);
ASSERT_FALSE([web_view_ visibleURL]); ASSERT_FALSE([web_view_ visibleURL]);
...@@ -46,6 +39,13 @@ TEST_F(WebViewRestorableStateTest, EncodeDecode) { ...@@ -46,6 +39,13 @@ TEST_F(WebViewRestorableStateTest, EncodeDecode) {
// Create second web view and restore its state from the first web view. // Create second web view and restore its state from the first web view.
CWVWebView* restored_web_view = test::CreateWebView(); CWVWebView* restored_web_view = test::CreateWebView();
test::CopyWebViewState(web_view_, restored_web_view); test::CopyWebViewState(web_view_, restored_web_view);
// The WKWebView must be present in the view hierarchy in order to prevent
// WebKit optimizations which may pause internal parts of the web view
// without notice. Work around this by adding the view directly.
// TODO(crbug.com/944077): Remove this workaround once fixed in ios/web_view.
UIViewController* view_controller =
[[[UIApplication sharedApplication] keyWindow] rootViewController];
[view_controller.view addSubview:restored_web_view];
// Wait for restore to finish. // Wait for restore to finish.
ASSERT_TRUE(WaitUntilConditionOrTimeout(kWaitForPageLoadTimeout, ^bool { ASSERT_TRUE(WaitUntilConditionOrTimeout(kWaitForPageLoadTimeout, ^bool {
......
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