Commit 4d72eeae authored by Alex Chau's avatar Alex Chau Committed by Commit Bot

Remove GetDisableReasons check in SharingService::IsSyncDisabled

- The check caused Android to return true for IsSyncDisabled when
  "sync the feature" is turned off but transport-mode is active
- The check was a workaround for ClickToCallBrowserTest and is now
  replaced with proper test setup

Bug: 1010968
Change-Id: I6031401d5a781a1f2436a5bfb738059d1ff51961
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1845717Reviewed-by: default avatarRichard Knoll <knollr@chromium.org>
Commit-Queue: Alex Chau <alexchau@chromium.org>
Cr-Commit-Position: refs/heads/master@{#704566}
parent 3e42bce6
......@@ -113,7 +113,9 @@ IN_PROC_BROWSER_TEST_F(ClickToCallBrowserTest,
kClickToCallContextMenuForSelectedText},
{});
SetUpDevices(/*count=*/1);
GetSyncService(0)->GetUserSettings()->SetSyncRequested(false);
// Disable syncing preferences which is necessary for Sharing.
GetSyncService(0)->GetUserSettings()->SetSelectedTypes(false, {});
AwaitQuiescence();
std::unique_ptr<TestRenderViewContextMenu> menu =
InitRightClickMenu(GURL(kTelUrl), base::ASCIIToUTF16("Google"),
......
......@@ -447,16 +447,12 @@ SharingSyncPreference* SharingService::GetSyncPreferences() const {
}
bool SharingService::IsSyncDisabled() const {
// TODO(alexchau): Better way to make
// ClickToCallBrowserTest.ContextMenu_DevicesAvailable_SyncTurnedOff pass
// without unnecessarily checking SyncService::GetDisableReasons.
return sync_service_ && (sync_service_->GetTransportState() ==
syncer::SyncService::TransportState::DISABLED ||
(sync_service_->GetTransportState() ==
syncer::SyncService::TransportState::ACTIVE &&
!sync_service_->GetActiveDataTypes().HasAll(
GetRequiredSyncDataTypes())) ||
sync_service_->GetDisableReasons());
GetRequiredSyncDataTypes())));
}
syncer::ModelTypeSet SharingService::GetRequiredSyncDataTypes() const {
......
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