Description<webview> Implement clear http cache API.
HTTP cache clearing methods have been refactored into a
separate class: StoragePartitionBrowsingDataRemover in
http://crrev.com/1033013003/
One method was exposed in WebCacheManager so we can
clear renderer/ cache for a given render process.
<webview> already has a set of data it can clear, this
CL adds "cache" to that set, similar to chrome.browsingData
API.
BUG=406437
Test=Load a <webview> in a chrome app, e.g.
the browser sample app:
https://github.com/GoogleChrome/chrome-app-samples/tree/master/samples/webview-samples/browser
Open inspector for the webview: from chrome://inspect,
switch to Apps, and inspect the tab that says "Google"
under "Browser sample". Switch to network tab in that inspector so you can monitor http requests.
Visit some page in the <webview>, for my test case,
I visited http://www.google.ca
Now look at the network tab for image requests (cause it
should be much simpler), e.g. nav_logo_195.png
Reload the page couple of times, observer the status code
for the image request, it should say 304 OK.
Now open the app's inspector: Same as above, but inspect "Browser sample"
instead. Call <webview> clear cache api from its console:
document.querySelector('webview').clearData(
{since: 1},
{cache: true},
function() { window.console.log('clear complete'); })
Expect "clear complete" message to show in app's console.
Now reload the page one more time and check the same
image's request, it should say 200 OK instead of 304.
Committed: https://crrev.com/cbff2a79e3aafa333159dbc467efcb8a5dc124f7
Cr-Commit-Position: refs/heads/master@{#322678}
Patch Set 1 #Patch Set 2 : revert storage_partition changes + started adding test, but cache does not work yet #Patch Set 3 : update #Patch Set 4 : Clean up for review + add test using mock + git cl format #Patch Set 5 : add actual tests #Patch Set 6 : Sync after http://crrev.com/1033013003 #
Total comments: 2
Patch Set 7 : add todo for SPBDRemover moving to components/ + sync #Patch Set 8 : Sync, resolve conflict #Patch Set 9 : fix compile error on mac/android: std::set initializer list makes them unhappy #Messages
Total messages: 18 (5 generated)
|