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

Unified Diff: sync/test/engine/injectable_sync_core_proxy.h

Issue 318193002: sync: Refactor NonBlockingTypeProcessor tests (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Disallow copy and assign Created 6 years, 6 months 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 | « sync/sync_tests.gypi ('k') | sync/test/engine/injectable_sync_core_proxy.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: sync/test/engine/injectable_sync_core_proxy.h
diff --git a/sync/test/engine/injectable_sync_core_proxy.h b/sync/test/engine/injectable_sync_core_proxy.h
new file mode 100644
index 0000000000000000000000000000000000000000..2dc273d99d12dfddf8a934d31f24c085a9658348
--- /dev/null
+++ b/sync/test/engine/injectable_sync_core_proxy.h
@@ -0,0 +1,47 @@
+// Copyright 2014 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef SYNC_TEST_ENGINE_INJECTABLE_SYNC_CORE_PROXY_H_
+#define SYNC_TEST_ENGINE_INJECTABLE_SYNC_CORE_PROXY_H_
+
+#include "sync/internal_api/public/base/model_type.h"
+#include "sync/internal_api/public/sync_core_proxy.h"
+
+namespace syncer {
+
+struct DataTypeState;
+class NonBlockingTypeProcessor;
+class NonBlockingTypeProcessorCoreInterface;
+
+// A SyncCoreProxy implementation that, when a connection request is made,
+// initalizes a connection to a previously injected NonBlockingTypeProcessor.
+class InjectableSyncCoreProxy : public syncer::SyncCoreProxy {
+ public:
+ explicit InjectableSyncCoreProxy(NonBlockingTypeProcessorCoreInterface* core);
+ virtual ~InjectableSyncCoreProxy();
+
+ virtual void ConnectTypeToCore(
+ syncer::ModelType type,
+ const DataTypeState& data_type_state,
+ base::WeakPtr<syncer::NonBlockingTypeProcessor> type_processor) OVERRIDE;
+ virtual void Disconnect(syncer::ModelType type) OVERRIDE;
+ virtual scoped_ptr<SyncCoreProxy> Clone() const OVERRIDE;
+
+ NonBlockingTypeProcessorCoreInterface* GetProcessorCore();
+
+ private:
+ // A flag to ensure ConnectTypeToCore is called at most once.
+ bool is_core_connected_;
+
+ // The NonBlockingTypeProcessor's contract expects that it gets to own this
+ // object, so we can retain only a non-owned pointer to it.
+ //
+ // This is very unsafe, but we can get away with it since these tests are not
+ // exercising the processor <-> processor_core connection code.
+ NonBlockingTypeProcessorCoreInterface* processor_core_;
+};
+
+} // namespace syncer
+
+#endif // SYNC_TEST_ENGINE_INJECTABLE_SYNC_CORE_PROXY_H_
« no previous file with comments | « sync/sync_tests.gypi ('k') | sync/test/engine/injectable_sync_core_proxy.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698