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

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

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.cc
diff --git a/components/subresource_filter/content/browser/async_document_subresource_filter_test_utils.cc b/components/subresource_filter/content/browser/async_document_subresource_filter_test_utils.cc
new file mode 100644
index 0000000000000000000000000000000000000000..88dfb05d0f4ab32b67b4e6092498d03a5d576e6c
--- /dev/null
+++ b/components/subresource_filter/content/browser/async_document_subresource_filter_test_utils.cc
@@ -0,0 +1,33 @@
+// 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.
+
+#include "components/subresource_filter/content/browser/async_document_subresource_filter_test_utils.h"
+
+#include "base/bind.h"
+#include "base/bind_helpers.h"
+#include "testing/gtest/include/gtest/gtest.h"
+
+namespace subresource_filter {
+namespace testing {
+
+base::Callback<void(ActivationState)>
+TestActivationStateCallbackReceiver::GetCallback() {
+ return base::Bind(&TestActivationStateCallbackReceiver::Callback,
+ base::Unretained(this));
+}
+
+void TestActivationStateCallbackReceiver::ExpectReceivedOnce(
+ const ActivationState& expected_state) const {
+ ASSERT_EQ(1, callback_count_);
+ EXPECT_EQ(expected_state, last_activation_state_);
+}
+
+void TestActivationStateCallbackReceiver::Callback(
+ ActivationState activation_state) {
+ ++callback_count_;
+ last_activation_state_ = activation_state;
+}
+
+} // namespace testing
+} // namespace subresource_filter

Powered by Google App Engine
This is Rietveld 408576698