Clean up NullWebViewUtils and test activities.
Most methods of NullWebViewUtils are used to implement an
exception-catching pattern that's error-prone and hard to understand,
which predates the introduction of a WebView feature flag. The different
WebView test activities in CTS have also drifted out of sync with each
other over time.
Clean this up with the following changes:
- Remove all methods of NullWebView except for isWebViewAvailable, and
reimplement that just as a check for the feature flag.
- Guard creation of WebViews in test activities with isWebViewAvailable
instead of trying to catch the exception when creation fails. Failure
to create the WebView will now always result in a simple crash of the
test on devices which claim to have the feature, which is easier to
debug and understand than relying on storing and rethrowing the
exception later.
- Make sure the different activities all detach and destroy their
WebView correctly.
- Set the WebView's size to match_parent in all layouts using it as
wrap_contents is inadvisable.
Bug: 147616868
Test: atest CtsWebkitTestCases CtsHostsideWebViewTests \
EphemeralTest#testWebViewLoads \
android.text.cts.EmojiTest#testEmojiGlyphWebView
Change-Id: Ieca3ee77639104f2b1ad405290f1d1808bdd835a
7 files changed