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

Unified Diff: components/subresource_filter/content/browser/async_document_subresource_filter_test_utils.h

Issue 2731013002: ActivationStateComputingThrottle unit tests (Closed)
Patch Set: engedy review2 Created 3 years, 9 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
Index: components/subresource_filter/content/browser/async_document_subresource_filter_test_utils.h
diff --git a/components/subresource_filter/content/browser/async_document_subresource_filter_test_utils.h b/components/subresource_filter/content/browser/async_document_subresource_filter_test_utils.h
new file mode 100644
index 0000000000000000000000000000000000000000..de9595bde3ed71f2aa5eaaa82dc86a8953d3ab8d
--- /dev/null
+++ b/components/subresource_filter/content/browser/async_document_subresource_filter_test_utils.h
@@ -0,0 +1,38 @@
+// Copyright 2017 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_SUBRESOURCE_FILTER_CONTENT_BROWSER_ASYNC_DOCUMENT_SUBRESOURCE_FILTER_TEST_UTILS_H_
+#define COMPONENTS_SUBRESOURCE_FILTER_CONTENT_BROWSER_ASYNC_DOCUMENT_SUBRESOURCE_FILTER_TEST_UTILS_H_
+
+#include "base/bind.h"
+#include "base/callback_forward.h"
+#include "base/macros.h"
+#include "components/subresource_filter/core/common/activation_state.h"
+
+namespace subresource_filter {
+namespace testing {
+
+// This test class is intended to be used in conjunction with an
+// AsyncDocumentSubresourceFilter, and can be used to expect a certain
+// activation result occured.
+class TestActivationStateCallbackReceiver {
+ public:
+ TestActivationStateCallbackReceiver() = default;
+
+ base::Callback<void(ActivationState)> GetCallback();
+ void ExpectReceivedOnce(const ActivationState& expected_state) const;
+
+ private:
+ void Callback(ActivationState activation_state);
+
+ ActivationState last_activation_state_;
+ int callback_count_ = 0;
+
+ DISALLOW_COPY_AND_ASSIGN(TestActivationStateCallbackReceiver);
+};
+
+} // namespace testing
+} // namespace subresource_filter
+
+#endif // COMPONENTS_SUBRESOURCE_FILTER_CONTENT_BROWSER_ASYNC_DOCUMENT_SUBRESOURCE_FILTER_TEST_UTILS_H_

Powered by Google App Engine
This is Rietveld 408576698