Fix network blocking via cache flags.

According docs the LOAD_ONLY_FROM_CACHE flag guarantees that
any navigation with it will fail if it cannot serve the
resource from the cache (or some equivalent local store).
However, this flag is used only by http_cache_transaction
which isn't created if we are using network context without
http cache at all.
Without cache there is only a http_network_transaction which
completely ignore LOAD_ONLY_FROM_CACHE flag and doesn't fail
requests with it.

Also, this CL fixes `setBlockNetworkLoads` for android webview
without cache.
https://cs.chromium.org/chromium/src/third_party/android_tools/sdk/sources/android-25/android/webkit/WebSettings.java?type=cs&q=setBlockNetworkLoads&g=0&l=887

Change-Id: I04c027fe671f83020cba580fa5c763b09fb00886
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1556775
Commit-Queue: Maks Orlovich <[email protected]>
Reviewed-by: Maks Orlovich <[email protected]>
Cr-Commit-Position: refs/heads/master@{#649888}
diff --git a/net/http/http_network_transaction.cc b/net/http/http_network_transaction.cc
index 118a1ff..f425393 100644
--- a/net/http/http_network_transaction.cc
+++ b/net/http/http_network_transaction.cc
@@ -165,6 +165,9 @@
 int HttpNetworkTransaction::Start(const HttpRequestInfo* request_info,
                                   CompletionOnceCallback callback,
                                   const NetLogWithSource& net_log) {
+  if (request_info->load_flags & LOAD_ONLY_FROM_CACHE)
+    return ERR_CACHE_MISS;
+
   DCHECK(request_info->traffic_annotation.is_valid());
   net_log_ = net_log;
   request_ = request_info;