aboutsummaryrefslogtreecommitdiff
path: root/src/test/test_channel.c
diff options
context:
space:
mode:
authorAndrea Shepard <andrea@torproject.org>2014-01-21 02:50:33 -0800
committerAndrea Shepard <andrea@torproject.org>2014-09-30 23:09:15 -0700
commit46ff91b6ec90fc8ee9a84622f9dce91903686559 (patch)
treee594eb1aa418b5f84945d42fc4966427014f8941 /src/test/test_channel.c
parent2ee69bd5d74842681aa3c90aae93b93fb0657269 (diff)
downloadtor-46ff91b6ec90fc8ee9a84622f9dce91903686559.tar.gz
tor-46ff91b6ec90fc8ee9a84622f9dce91903686559.zip
Add scheduler_channel_has_waiting_cells_mock() and some mock counter queries
Diffstat (limited to 'src/test/test_channel.c')
-rw-r--r--src/test/test_channel.c40
1 files changed, 40 insertions, 0 deletions
diff --git a/src/test/test_channel.c b/src/test/test_channel.c
index 1ae9810d66..eff418957b 100644
--- a/src/test/test_channel.c
+++ b/src/test/test_channel.c
@@ -22,6 +22,7 @@ static int test_chan_accept_cells = 0;
static int test_cells_written = 0;
static int test_destroy_not_pending_calls = 0;
static int test_doesnt_want_writes_count = 0;
+static int test_has_waiting_cells_count = 0;
static double test_overhead_estimate = 1.0f;
static int test_releases_count = 0;
@@ -206,6 +207,31 @@ new_fake_channel(void)
return chan;
}
+/**
+ * Counter query for scheduler_channel_has_waiting_cells_mock()
+ */
+
+int
+get_mock_scheduler_has_waiting_cells_count(void)
+{
+ return test_has_waiting_cells_count;
+}
+
+/**
+ * Mock for scheduler_channel_has_waiting_cells()
+ */
+
+void
+scheduler_channel_has_waiting_cells_mock(channel_t *ch)
+{
+ (void)ch;
+
+ /* Increment counter */
+ ++test_has_waiting_cells_count;
+
+ return;
+}
+
static void
scheduler_channel_doesnt_want_writes_mock(channel_t *ch)
{
@@ -217,6 +243,20 @@ scheduler_channel_doesnt_want_writes_mock(channel_t *ch)
return;
}
+/**
+ * Counter query for scheduler_release_channel_mock()
+ */
+
+int
+get_mock_scheduler_release_channel_count(void)
+{
+ return test_releases_count;
+}
+
+/**
+ * Mock for scheduler_release_channel()
+ */
+
void
scheduler_release_channel_mock(channel_t *ch)
{