Revert "Integrate compose consent dialog with related profile prefs"
This reverts commit 26f02504dba860df330cd27a9f23421831015924.
Reason for revert: Might be causing test failures, e.g. https://ci.chromium.org/ui/p/chromium/builders/ci/Linux%20MSan%20Tests/44516/overview
https://ci.chromium.org/ui/p/chromium/builders/ci/Linux%20ChromiumOS%20MSan%20Tests
Original change's description:
> Integrate compose consent dialog with related profile prefs
>
> Bug: b:310040153
> Change-Id: I385e4a5806d635a4b5707af038af1caaa51726e8
> Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5049645
> Reviewed-by: John Lee <[email protected]>
> Commit-Queue: Anthony Cui <[email protected]>
> Reviewed-by: Dominic Farolino <[email protected]>
> Reviewed-by: Peter Williamson <[email protected]>
> Cr-Commit-Position: refs/heads/main@{#1230353}
Bug: b:310040153
Change-Id: Ib3d687ca3c684de708d3bf39088dc95d329bc190
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5069535
Owners-Override: Rakina Zata Amni <[email protected]>
Commit-Queue: Rakina Zata Amni <[email protected]>
Auto-Submit: Rakina Zata Amni <[email protected]>
Bot-Commit: Rubber Stamper <[email protected]>
Cr-Commit-Position: refs/heads/main@{#1230463}
diff --git a/chrome/browser/compose/compose_dialog_browsertest.cc b/chrome/browser/compose/compose_dialog_browsertest.cc
index 6f1a25e8..c52e52a0 100644
--- a/chrome/browser/compose/compose_dialog_browsertest.cc
+++ b/chrome/browser/compose/compose_dialog_browsertest.cc
@@ -10,22 +10,19 @@
#include "chrome/browser/ui/browser.h"
#include "chrome/browser/ui/tabs/tab_enums.h"
#include "chrome/browser/ui/tabs/tab_strip_model.h"
-#include "chrome/common/pref_names.h"
#include "chrome/test/base/in_process_browser_test.h"
#include "chrome/test/base/ui_test_utils.h"
#include "components/compose/core/browser/compose_features.h"
#include "components/optimization_guide/core/optimization_guide_features.h"
-#include "components/prefs/pref_service.h"
-#include "components/unified_consent/pref_names.h"
#include "content/public/browser/web_contents.h"
#include "content/public/test/browser_test.h"
#include "content/public/test/browser_test_utils.h"
#include "ui/gfx/geometry/point_conversions.h"
-using ComposeClientPrefsBrowserTest = InProcessBrowserTest;
-
namespace compose {
+// IDC_CONTEXT_COMPOSE
+
class ComposeSessionBrowserTest : public InProcessBrowserTest {
public:
void SetUp() override {
@@ -73,75 +70,4 @@
TabCloseTypes::CLOSE_NONE);
}
-IN_PROC_BROWSER_TEST_F(ComposeClientPrefsBrowserTest,
- GetConsentStateFromPrefs) {
- auto* web_contents = browser()->tab_strip_model()->GetActiveWebContents();
- ASSERT_NE(nullptr, ChromeComposeClient::FromWebContents(web_contents));
- auto* client = ChromeComposeClient::FromWebContents(web_contents);
- PrefService* prefs = browser()->profile()->GetPrefs();
-
- // By default both kPageContentCollectionEnabled and
- // kPrefHasAcceptedComposeConsent should be false
- EXPECT_EQ(client->GetConsentStateFromPrefs(),
- compose::mojom::ConsentState::kUnset);
-
- // Consent enabled but not acknowledged from compose
- prefs->SetBoolean(unified_consent::prefs::kPageContentCollectionEnabled,
- true);
- EXPECT_EQ(client->GetConsentStateFromPrefs(),
- compose::mojom::ConsentState::kExternalConsented);
-
-#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX)
- // Consent enabled and acknowledged from compose
- prefs->SetBoolean(prefs::kPrefHasAcceptedComposeConsent, true);
- EXPECT_EQ(client->GetConsentStateFromPrefs(),
- compose::mojom::ConsentState::kConsented);
-
- // Consent disabled since being acknowledged from compose
- prefs->SetBoolean(unified_consent::prefs::kPageContentCollectionEnabled,
- false);
- EXPECT_EQ(client->GetConsentStateFromPrefs(),
- compose::mojom::ConsentState::kUnset);
-#endif
-}
-
-IN_PROC_BROWSER_TEST_F(ComposeClientPrefsBrowserTest, ApproveConsent) {
- auto* web_contents = browser()->tab_strip_model()->GetActiveWebContents();
- ASSERT_NE(nullptr, ChromeComposeClient::FromWebContents(web_contents));
- auto* client = ChromeComposeClient::FromWebContents(web_contents);
- PrefService* prefs = browser()->profile()->GetPrefs();
-
- // By default both kPageContentCollectionEnabled and
- // kPrefHasAcceptedComposeConsent should be false
- EXPECT_EQ(client->GetConsentStateFromPrefs(),
- compose::mojom::ConsentState::kUnset);
-
- client->ApproveConsent();
- ASSERT_TRUE(
- prefs->GetBoolean(unified_consent::prefs::kPageContentCollectionEnabled));
-#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX)
- ASSERT_TRUE(prefs->GetBoolean(prefs::kPrefHasAcceptedComposeConsent));
-#endif
-}
-
-IN_PROC_BROWSER_TEST_F(ComposeClientPrefsBrowserTest,
- AcknowledgeConsentDisclaimer) {
- auto* web_contents = browser()->tab_strip_model()->GetActiveWebContents();
- ASSERT_NE(nullptr, ChromeComposeClient::FromWebContents(web_contents));
- auto* client = ChromeComposeClient::FromWebContents(web_contents);
- PrefService* prefs = browser()->profile()->GetPrefs();
-
- // By default both kPageContentCollectionEnabled and
- // kPrefHasAcceptedComposeConsent should be false
- EXPECT_EQ(client->GetConsentStateFromPrefs(),
- compose::mojom::ConsentState::kUnset);
-
- client->AcknowledgeConsentDisclaimer();
- ASSERT_FALSE(
- prefs->GetBoolean(unified_consent::prefs::kPageContentCollectionEnabled));
-#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX)
- ASSERT_TRUE(prefs->GetBoolean(prefs::kPrefHasAcceptedComposeConsent));
-#endif
-}
-
} // namespace compose