Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(453)

Unified Diff: components/browser_sync/profile_sync_service_unittest.cc

Issue 2504433002: [Sync] Return nullptr for OpenTabsUIDelegate when PROXY_TABS is disabled. (Closed)
Patch Set: Gave test case an appropriate name. Created 4 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « components/browser_sync/profile_sync_service.cc ('k') | components/sync/driver/sync_service.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: components/browser_sync/profile_sync_service_unittest.cc
diff --git a/components/browser_sync/profile_sync_service_unittest.cc b/components/browser_sync/profile_sync_service_unittest.cc
index d6ac925948a0c07608b80e26c5ab1236e83de588..6832d2cc173abf0c8f35fa5019eefb95f128ded5 100644
--- a/components/browser_sync/profile_sync_service_unittest.cc
+++ b/components/browser_sync/profile_sync_service_unittest.cc
@@ -39,7 +39,9 @@
#include "testing/gtest/include/gtest/gtest.h"
#include "ui/base/l10n/l10n_util.h"
+using syncer::DataTypeController;
using syncer::SyncBackendHostMock;
+using syncer::SyncMergeResult;
using testing::Return;
namespace browser_sync {
@@ -199,6 +201,10 @@ ACTION_P(ReturnNewMockHostCaptureClearServerData, captured_callback) {
&OnClearServerDataCalled, base::Unretained(captured_callback)));
}
+void DoNothing(DataTypeController::ConfigureResult ignored1,
+ const SyncMergeResult& ignored2,
+ const SyncMergeResult& ignored3) {}
+
// A test harness that uses a real ProfileSyncService and in most cases a
// MockSyncBackendHost.
//
@@ -952,5 +958,21 @@ TEST_F(ProfileSyncServiceTest, ValidPointersInDTCMap) {
service()->OnSyncCycleCompleted();
}
+// The OpenTabsUIDelegate should only be accessable when PROXY_TABS is enabled.
+TEST_F(ProfileSyncServiceTest, GetOpenTabsUIDelegate) {
+ CreateService(ProfileSyncService::AUTO_START);
+ InitializeForNthSync();
+ EXPECT_EQ(nullptr, service()->GetOpenTabsUIDelegate());
+
+ auto controller =
+ base::MakeUnique<syncer::FakeDataTypeController>(syncer::PROXY_TABS);
+ // Progress the controller to RUNNING first, which is how the service
+ // determines whether a type is enabled.
+ controller->StartAssociating(base::Bind(&DoNothing));
+ controller->FinishStart(DataTypeController::OK_FIRST_RUN);
+ service()->RegisterDataTypeController(std::move(controller));
+ EXPECT_NE(nullptr, service()->GetOpenTabsUIDelegate());
+}
+
} // namespace
} // namespace browser_sync
« no previous file with comments | « components/browser_sync/profile_sync_service.cc ('k') | components/sync/driver/sync_service.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698