Commit 49e0abec authored by Mihai Sardarescu's avatar Mihai Sardarescu Committed by Commit Bot

Disable unified consent for sync_settings_table_view_controller unit tests.

SyncSettingsTableViewController is only used pre-Unified Consent and
DCHECKs that Unified Consent is disabled. This CL ensures that
SyncSettingsTableViewControllerTest runs with Unified Consent disable.

This is a pre-requisite for enabling Unified Consent by default on iOS.

Bug: 960260
Change-Id: I0499985052763eeac1fb640701b341ccdcdfc949
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1611605Reviewed-by: default avatarGauthier Ambard <gambard@chromium.org>
Commit-Queue: Mihai Sardarescu <msarda@chromium.org>
Cr-Commit-Position: refs/heads/master@{#659482}
parent 2f8c0cf3
...@@ -72,6 +72,7 @@ source_set("unit_tests") { ...@@ -72,6 +72,7 @@ source_set("unit_tests") {
"//components/sync_preferences", "//components/sync_preferences",
"//components/sync_preferences:test_support", "//components/sync_preferences:test_support",
"//components/unified_consent", "//components/unified_consent",
"//components/unified_consent:test_support",
"//ios/chrome/app/strings", "//ios/chrome/app/strings",
"//ios/chrome/browser", "//ios/chrome/browser",
"//ios/chrome/browser", "//ios/chrome/browser",
......
...@@ -212,6 +212,7 @@ typedef NS_ENUM(NSInteger, ItemType) { ...@@ -212,6 +212,7 @@ typedef NS_ENUM(NSInteger, ItemType) {
- (instancetype)initWithBrowserState:(ios::ChromeBrowserState*)browserState - (instancetype)initWithBrowserState:(ios::ChromeBrowserState*)browserState
allowSwitchSyncAccount:(BOOL)allowSwitchSyncAccount { allowSwitchSyncAccount:(BOOL)allowSwitchSyncAccount {
DCHECK(!unified_consent::IsUnifiedConsentFeatureEnabled());
DCHECK(browserState); DCHECK(browserState);
UITableViewStyle style = base::FeatureList::IsEnabled(kSettingsRefresh) UITableViewStyle style = base::FeatureList::IsEnabled(kSettingsRefresh)
? UITableViewStylePlain ? UITableViewStylePlain
...@@ -912,7 +913,6 @@ typedef NS_ENUM(NSInteger, ItemType) { ...@@ -912,7 +913,6 @@ typedef NS_ENUM(NSInteger, ItemType) {
- (BOOL)shouldDisplaySyncError { - (BOOL)shouldDisplaySyncError {
SyncSetupService::SyncServiceState state = SyncSetupService::SyncServiceState state =
_syncSetupService->GetSyncServiceState(); _syncSetupService->GetSyncServiceState();
DCHECK(!unified_consent::IsUnifiedConsentFeatureEnabled());
// Without unity, kSyncSettingsNotConfirmed should not be shown. // Without unity, kSyncSettingsNotConfirmed should not be shown.
return state != SyncSetupService::kNoSyncServiceError && return state != SyncSetupService::kNoSyncServiceError &&
state != SyncSetupService::kSyncSettingsNotConfirmed; state != SyncSetupService::kSyncSettingsNotConfirmed;
......
...@@ -16,6 +16,7 @@ ...@@ -16,6 +16,7 @@
#include "components/sync_preferences/pref_service_mock_factory.h" #include "components/sync_preferences/pref_service_mock_factory.h"
#include "components/sync_preferences/pref_service_syncable.h" #include "components/sync_preferences/pref_service_syncable.h"
#include "components/unified_consent/feature.h" #include "components/unified_consent/feature.h"
#include "components/unified_consent/scoped_unified_consent.h"
#include "ios/chrome/browser/application_context.h" #include "ios/chrome/browser/application_context.h"
#include "ios/chrome/browser/browser_state/test_chrome_browser_state.h" #include "ios/chrome/browser/browser_state/test_chrome_browser_state.h"
#include "ios/chrome/browser/chrome_url_constants.h" #include "ios/chrome/browser/chrome_url_constants.h"
...@@ -91,7 +92,9 @@ class SyncSetupServiceMockThatSucceeds : public SyncSetupServiceMockThatFails { ...@@ -91,7 +92,9 @@ class SyncSetupServiceMockThatSucceeds : public SyncSetupServiceMockThatFails {
class SyncSettingsTableViewControllerTest class SyncSettingsTableViewControllerTest
: public ChromeTableViewControllerTest { : public ChromeTableViewControllerTest {
public: public:
SyncSettingsTableViewControllerTest() {} SyncSettingsTableViewControllerTest()
: unified_consent_disabled_(
unified_consent::UnifiedConsentFeatureState::kDisabled) {}
static std::unique_ptr<KeyedService> CreateSyncSetupService( static std::unique_ptr<KeyedService> CreateSyncSetupService(
web::BrowserState* context) { web::BrowserState* context) {
...@@ -201,6 +204,7 @@ class SyncSettingsTableViewControllerTest ...@@ -201,6 +204,7 @@ class SyncSettingsTableViewControllerTest
EXPECT_EQ(expectedShouldDisplayError, hasImage); EXPECT_EQ(expectedShouldDisplayError, hasImage);
} }
unified_consent::ScopedUnifiedConsent unified_consent_disabled_;
web::TestWebThreadBundle thread_bundle_; web::TestWebThreadBundle thread_bundle_;
std::unique_ptr<TestChromeBrowserState> chrome_browser_state_; std::unique_ptr<TestChromeBrowserState> chrome_browser_state_;
// Weak, owned by |profile_|. // Weak, owned by |profile_|.
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment