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

Unified Diff: components/invalidation/mock_ack_handler.h

Issue 1191393008: Introduce a layering in the invalidation component as public and impl (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Explicitly forbid content to prevent future additions Created 5 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 | « components/invalidation/invalidator_test_template.cc ('k') | components/invalidation/mock_ack_handler.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: components/invalidation/mock_ack_handler.h
diff --git a/components/invalidation/mock_ack_handler.h b/components/invalidation/mock_ack_handler.h
deleted file mode 100644
index 8afcb4fa8d01de4fa0a151aaa349023123eb0e7d..0000000000000000000000000000000000000000
--- a/components/invalidation/mock_ack_handler.h
+++ /dev/null
@@ -1,77 +0,0 @@
-// 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 COMPONENTS_INVALIDATION_MOCK_ACK_HANDLER_H_
-#define COMPONENTS_INVALIDATION_MOCK_ACK_HANDLER_H_
-
-#include <map>
-#include <vector>
-
-#include "base/compiler_specific.h"
-#include "base/memory/weak_ptr.h"
-#include "components/invalidation/ack_handler.h"
-#include "components/invalidation/invalidation_export.h"
-#include "components/invalidation/invalidation_util.h"
-
-namespace syncer {
-
-class Invalidation;
-
-// This AckHandler implementation colaborates with the FakeInvalidationService
-// to enable unit tests to assert that invalidations are being acked properly.
-class INVALIDATION_EXPORT MockAckHandler
- : public AckHandler,
- public base::SupportsWeakPtr<MockAckHandler> {
- public:
- MockAckHandler();
- ~MockAckHandler() override;
-
- // Sets up some internal state to track this invalidation, and modifies it so
- // that its Acknowledge() and Drop() methods will route back to us.
- void RegisterInvalidation(Invalidation* invalidation);
-
- // No one was listening for this invalidation, so no one will receive it or
- // ack it. We keep track of it anyway to let tests make assertions about it.
- void RegisterUnsentInvalidation(Invalidation* invalidation);
-
- // Returns true if the specified invalidaition has been delivered, but has not
- // been acknowledged yet.
- bool IsUnacked(const Invalidation& invalidation) const;
-
- // Returns true if the specified invalidation has been delivered and
- // acknowledged.
- bool IsAcknowledged(const Invalidation& invalidation) const;
-
- // Returns true if the specified invalidation has been delivered and
- // dropped.
- bool IsDropped(const Invalidation& invalidation) const;
-
- // Returns true if the specified invalidation was never delivered.
- bool IsUnsent(const Invalidation& invalidation) const;
-
- // Retruns true if all invalidations have been acked and all drops recovered.
- bool AllInvalidationsAccountedFor() const;
-
- // Implementation of AckHandler.
- void Acknowledge(const invalidation::ObjectId& id,
- const AckHandle& handle) override;
- void Drop(const invalidation::ObjectId& id, const AckHandle& handle) override;
-
- private:
- typedef std::vector<syncer::Invalidation> InvalidationVector;
- typedef std::map<invalidation::ObjectId,
- AckHandle,
- ObjectIdLessThan> IdHandleMap;
-
- InvalidationVector unsent_invalidations_;
- InvalidationVector unacked_invalidations_;
- InvalidationVector acked_invalidations_;
- InvalidationVector dropped_invalidations_;
-
- IdHandleMap unrecovered_drop_events_;
-};
-
-} // namespace syncer
-
-#endif // COMPONENTS_INVALIDATION_MOCK_ACK_HANDLER_H_
« no previous file with comments | « components/invalidation/invalidator_test_template.cc ('k') | components/invalidation/mock_ack_handler.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698