New issue
Advanced search Search tips

Issue 755567 link

Starred by 1 user

Issue metadata

Status: Assigned
Owner:
Cc:
Components:
EstimatedDays: ----
NextAction: ----
OS: Android
Pri: 3
Type: Bug

Blocking:
issue 725019



Sign in to add a comment

Find all static android.webkit methods, and ensure we have test coverage for them.

Project Member Reported by gsennton@chromium.org, Aug 15 2017

Issue description

This issue was raised when discussion the testing of the WebView Support Library - we want to make static android.webkit methods work correctly, and don't work weirdly with the support library.

(torne@/aluo@ is this a good description of what we discussed in NY?)
 
Note that we want global WebView state to be global across both android.webkit and the WebView support library because parts of native will have to be global across both anyway. (Another benefit is it's easier to make sure something is completely global rather than global per support library vs. normal android.webkit).
Cc: ntfschr@chromium.org
Static methods on WebView class are:

- clearClientCertPreferences (new)
- enableSlowWholeDocumentDraw (new)
- findAddress
- getCurrentWebViewPackage (new)
- getSafeBrowsingPrivacyPolicyUrl (new)
- setWebContentsDebuggingEnabled
- startSafeBrowsing (new)

I assume we only need coverage for the new methods, is that right?
I think there are two different points here:
1. we want test coverage for all static methods (not only the new ones)
2. we want to ensure all the new static methods (the ones that will be in the support library) work as expected in the support library vs. android.webkit (i.e. if they need to share state then they should)
Existing tests:
- clearClientCertPreferences is tested in WebViewSslTest
- findAddress is tested in WebViewTest
- getCurrentWebViewPackage is essentially tested in GTS: WebViewDisablingTest
- getSafeBrowsingPrivacyPolicyUrl is tested in WebViewTest
- startSafeBrowsing has several tests in WebViewTest


Non-existing tests:
- enableSlowWholeDocumentDraw doesn't have a CTS test - I don't know how we would test that though
- setWebContentsDebuggingEnabled doesn't seem to have a CTS test, but not sure how we would implement a test for that..
I think all we need here is a test ensuring that some static method (i.e. some method using WebViewFactoryProvider.Statics) works correctly between WebView and the WebView Support Library (WebViewCompat).

Nate, what do you think about using WebView.setSafeBrowsingWhitelist for this?

I.e. doing something like

1. WebView.setSafeBrowsingWhitelist(foo)
2. ensure the whitelist is set correctly by navigating somewhere
3. WebViewCompat.setSafeBrowsingWhitelist(bar)
4. ensure the whitelist is set correctly by navigating somewhere
That API could be good. There's a few ways to use this in a test:

 - whitelist either chrome://safe-browsing/match?type=malware or type=phishing (the only URLs guaranteed to be flagged as malicious)
 - pass the empty list to reset the whitelist
 - pass bad input, verify the callback is invoked and indicates failure

I wrote CTS tests for setSafeBrowsingWhitelist, feel free to copy those.
Owner: ntfschr@chromium.org
Status: Assigned (was: Available)
I'll take this

Sign in to add a comment