Handle deleting cookies with session-only policy in network service

The ContentSettings for cookies are now synced to the network service,
which allows us to delete cookies properly when the session ends.

SessionCleanupCookieStore and tests are mostly moved over from
QuotaPolicyCookieStore.

Bug: 848801
Cq-Include-Trybots: luci.chromium.try:ios-simulator-full-configs;master.tryserver.chromium.android:android_cronet_tester;master.tryserver.chromium.linux:linux_mojo;master.tryserver.chromium.mac:ios-simulator-cronet
Change-Id: I53f8d7f6cb6439d3b39fad22c406bf058b758e52
Reviewed-on: https://chromium-review.googlesource.com/1090035
Commit-Queue: Clark DuVall <[email protected]>
Reviewed-by: Daniel Cheng <[email protected]>
Reviewed-by: Christian Dullweber <[email protected]>
Reviewed-by: John Abd-El-Malek <[email protected]>
Cr-Commit-Position: refs/heads/master@{#567428}
diff --git a/content/browser/browser_context.cc b/content/browser/browser_context.cc
index 69271e3..569e77c 100644
--- a/content/browser/browser_context.cc
+++ b/content/browser/browser_context.cc
@@ -419,13 +419,14 @@
         BrowserThread::IO, FROM_HERE,
         base::BindOnce(
             &SaveSessionStateOnIOThread,
-            base::WrapRefCounted(
-                BrowserContext::GetDefaultStoragePartition(browser_context)
-                    ->GetURLRequestContext()),
+            base::WrapRefCounted(storage_partition->GetURLRequestContext()),
             static_cast<AppCacheServiceImpl*>(
                 storage_partition->GetAppCacheService())));
   }
 
+  storage_partition->GetCookieManagerForBrowserProcess()
+      ->SetForceKeepSessionState();
+
   DOMStorageContextWrapper* dom_storage_context_proxy =
       static_cast<DOMStorageContextWrapper*>(
           storage_partition->GetDOMStorageContext());