Stop using BlockThirdPartyCookies preference in content_settings/

The boolean BlockThirdPartyCookies preference was replaced by
CookieControlsMode enum. Existing settings were migrated since M83.
The preference is still used in the UI and extension APIs and will be
removed in followup CLs.

Tbr: [email protected]
Bug: 1104836
Change-Id: I44f896c4191af2b49decdc01696f2974b99b9120
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2366721
Commit-Queue: Christian Dullweber <[email protected]>
Reviewed-by: Peter Conn <[email protected]>
Reviewed-by: Josh Karlin <[email protected]>
Reviewed-by: Tsuyoshi Horo <[email protected]>
Reviewed-by: Balazs Engedy <[email protected]>
Reviewed-by: Ryan Sturm <[email protected]>
Reviewed-by: Kamila Hasanbega <[email protected]>
Reviewed-by: Maksim Ivanov <[email protected]>
Cr-Commit-Position: refs/heads/master@{#801347}
diff --git a/chrome/browser/chrome_worker_browsertest.cc b/chrome/browser/chrome_worker_browsertest.cc
index b00e12ce..3123805 100644
--- a/chrome/browser/chrome_worker_browsertest.cc
+++ b/chrome/browser/chrome_worker_browsertest.cc
@@ -11,6 +11,7 @@
 #include "chrome/browser/ui/browser.h"
 #include "chrome/test/base/in_process_browser_test.h"
 #include "chrome/test/base/ui_test_utils.h"
+#include "components/content_settings/core/browser/cookie_settings.h"
 #include "components/content_settings/core/common/pref_names.h"
 #include "components/prefs/pref_service.h"
 #include "content/public/browser/browser_context.h"
@@ -20,8 +21,6 @@
 #include "net/test/embedded_test_server/http_request.h"
 #include "net/test/embedded_test_server/http_response.h"
 
-enum class EnableThirdPartyCookieBlocking { kEnable, kDisable };
-
 // A simple fixture used for testing dedicated workers and shared workers. The
 // fixture stashes the HTTP request to the worker script for inspecting the
 // headers.
@@ -47,15 +46,13 @@
   // third-party cookie blocking configuration.
   // This is the regression test for https://crbug.com/933287.
   void TestWorkerScriptFetchWithThirdPartyCookieBlocking(
-      EnableThirdPartyCookieBlocking enable_third_party_cookie_blocking,
+      content_settings::CookieControlsMode cookie_controls_mode,
       const std::string& test_url) {
     const std::string kCookie = "foo=bar";
 
     // Set up third-party cookie blocking.
-    browser()->profile()->GetPrefs()->SetBoolean(
-        prefs::kBlockThirdPartyCookies,
-        enable_third_party_cookie_blocking ==
-            EnableThirdPartyCookieBlocking::kEnable);
+    browser()->profile()->GetPrefs()->SetInteger(
+        prefs::kCookieControlsMode, static_cast<int>(cookie_controls_mode));
 
     // Make sure cookies are not set.
     ASSERT_TRUE(
@@ -112,27 +109,27 @@
 IN_PROC_BROWSER_TEST_F(ChromeWorkerBrowserTest,
                        DedicatedWorkerScriptFetchWithThirdPartyBlocking) {
   TestWorkerScriptFetchWithThirdPartyCookieBlocking(
-      EnableThirdPartyCookieBlocking::kEnable,
+      content_settings::CookieControlsMode::kBlockThirdParty,
       "/workers/create_dedicated_worker.html?worker_url=/capture");
 }
 
 IN_PROC_BROWSER_TEST_F(ChromeWorkerBrowserTest,
                        DedicatedWorkerScriptFetchWithoutThirdPartyBlocking) {
   TestWorkerScriptFetchWithThirdPartyCookieBlocking(
-      EnableThirdPartyCookieBlocking::kDisable,
+      content_settings::CookieControlsMode::kOff,
       "/workers/create_dedicated_worker.html?worker_url=/capture");
 }
 
 IN_PROC_BROWSER_TEST_F(ChromeWorkerBrowserTest,
                        SharedWorkerScriptFetchWithThirdPartyBlocking) {
   TestWorkerScriptFetchWithThirdPartyCookieBlocking(
-      EnableThirdPartyCookieBlocking::kEnable,
+      content_settings::CookieControlsMode::kBlockThirdParty,
       "/workers/create_shared_worker.html?worker_url=/capture");
 }
 
 IN_PROC_BROWSER_TEST_F(ChromeWorkerBrowserTest,
                        SharedWorkerScriptFetchWithoutThirdPartyBlocking) {
   TestWorkerScriptFetchWithThirdPartyCookieBlocking(
-      EnableThirdPartyCookieBlocking::kDisable,
+      content_settings::CookieControlsMode::kOff,
       "/workers/create_shared_worker.html?worker_url=/capture");
 }