1 // Copyright (c) 2013 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
5 #include "content/browser/media/capture/audio_mirroring_manager.h"
10 #include "base/bind.h"
11 #include "base/bind_helpers.h"
12 #include "base/message_loop/message_loop.h"
13 #include "base/synchronization/waitable_event.h"
14 #include "content/browser/browser_thread_impl.h"
15 #include "media/audio/audio_parameters.h"
16 #include "testing/gmock/include/gmock/gmock.h"
17 #include "testing/gtest/include/gtest/gtest.h"
19 using media::AudioOutputStream
;
20 using media::AudioParameters
;
22 using testing::Invoke
;
23 using testing::NotNull
;
25 using testing::Return
;
26 using testing::ReturnRef
;
32 class MockDiverter
: public AudioMirroringManager::Diverter
{
34 MOCK_METHOD0(GetAudioParameters
, const AudioParameters
&());
35 MOCK_METHOD1(StartDiverting
, void(AudioOutputStream
*));
36 MOCK_METHOD0(StopDiverting
, void());
39 class MockMirroringDestination
40 : public AudioMirroringManager::MirroringDestination
{
42 typedef AudioMirroringManager::SourceFrameRef SourceFrameRef
;
44 MockMirroringDestination(int render_process_id
, int render_frame_id
)
45 : render_process_id_(render_process_id
),
46 render_frame_id_(render_frame_id
),
49 MOCK_METHOD2(QueryForMatches
,
50 void(const std::set
<SourceFrameRef
>& candidates
,
51 const MatchesCallback
& results_callback
));
52 MOCK_METHOD1(AddInput
,
53 media::AudioOutputStream
*(const media::AudioParameters
& params
));
55 void SimulateQuery(const std::set
<SourceFrameRef
>& candidates
,
56 const MatchesCallback
& results_callback
) {
59 std::set
<SourceFrameRef
> result
;
60 if (candidates
.find(SourceFrameRef(render_process_id_
, render_frame_id_
)) !=
62 result
.insert(SourceFrameRef(render_process_id_
, render_frame_id_
));
64 results_callback
.Run(result
);
67 media::AudioOutputStream
* SimulateAddInput(
68 const media::AudioParameters
& params
) {
69 static AudioOutputStream
* const kNonNullPointer
=
70 reinterpret_cast<AudioOutputStream
*>(0x11111110);
71 return kNonNullPointer
;
74 int query_count() const {
79 const int render_process_id_
;
80 const int render_frame_id_
;
86 class AudioMirroringManagerTest
: public testing::Test
{
88 typedef AudioMirroringManager::Diverter Diverter
;
89 typedef AudioMirroringManager::MirroringDestination MirroringDestination
;
90 typedef AudioMirroringManager::StreamRoutes StreamRoutes
;
92 AudioMirroringManagerTest()
93 : io_thread_(BrowserThread::IO
, &message_loop_
),
94 params_(AudioParameters::AUDIO_FAKE
, media::CHANNEL_LAYOUT_STEREO
,
95 AudioParameters::kAudioCDSampleRate
, 16,
96 AudioParameters::kAudioCDSampleRate
/ 10) {}
98 MockDiverter
* CreateStream(
99 int render_process_id
, int render_frame_id
, int expected_times_diverted
) {
100 MockDiverter
* const diverter
= new MockDiverter();
101 if (expected_times_diverted
> 0) {
102 EXPECT_CALL(*diverter
, GetAudioParameters())
103 .Times(expected_times_diverted
)
104 .WillRepeatedly(ReturnRef(params_
));
105 EXPECT_CALL(*diverter
, StartDiverting(NotNull()))
106 .Times(expected_times_diverted
);
107 EXPECT_CALL(*diverter
, StopDiverting())
108 .Times(expected_times_diverted
);
111 mirroring_manager_
.AddDiverter(
112 render_process_id
, render_frame_id
, diverter
);
117 void KillStream(MockDiverter
* diverter
) {
118 mirroring_manager_
.RemoveDiverter(diverter
);
122 void StartMirroringTo(const scoped_ptr
<MockMirroringDestination
>& dest
,
123 int expected_inputs_added
) {
124 EXPECT_CALL(*dest
, QueryForMatches(_
, _
))
125 .WillRepeatedly(Invoke(dest
.get(),
126 &MockMirroringDestination::SimulateQuery
));
127 if (expected_inputs_added
> 0) {
128 EXPECT_CALL(*dest
, AddInput(Ref(params_
)))
129 .Times(expected_inputs_added
)
130 .WillRepeatedly(Invoke(dest
.get(),
131 &MockMirroringDestination::SimulateAddInput
))
132 .RetiresOnSaturation();
135 mirroring_manager_
.StartMirroring(dest
.get());
138 void StopMirroringTo(const scoped_ptr
<MockMirroringDestination
>& dest
) {
139 mirroring_manager_
.StopMirroring(dest
.get());
142 int CountStreamsDivertedTo(
143 const scoped_ptr
<MockMirroringDestination
>& dest
) const {
145 for (StreamRoutes::const_iterator it
= mirroring_manager_
.routes_
.begin();
146 it
!= mirroring_manager_
.routes_
.end(); ++it
) {
147 if (it
->destination
== dest
.get())
153 void ExpectNoLongerManagingAnything() const {
154 EXPECT_TRUE(mirroring_manager_
.routes_
.empty());
155 EXPECT_TRUE(mirroring_manager_
.sessions_
.empty());
159 base::MessageLoopForIO message_loop_
;
160 BrowserThreadImpl io_thread_
;
161 AudioParameters params_
;
162 AudioMirroringManager mirroring_manager_
;
164 DISALLOW_COPY_AND_ASSIGN(AudioMirroringManagerTest
);
168 const int kRenderProcessId
= 123;
169 const int kRenderFrameId
= 456;
170 const int kAnotherRenderProcessId
= 789;
171 const int kAnotherRenderFrameId
= 1234;
172 const int kYetAnotherRenderProcessId
= 4560;
173 const int kYetAnotherRenderFrameId
= 7890;
176 TEST_F(AudioMirroringManagerTest
, MirroringSessionOfNothing
) {
177 const scoped_ptr
<MockMirroringDestination
> destination(
178 new MockMirroringDestination(kRenderProcessId
, kRenderFrameId
));
179 StartMirroringTo(destination
, 0);
180 EXPECT_EQ(0, CountStreamsDivertedTo(destination
));
182 StopMirroringTo(destination
);
183 EXPECT_EQ(0, destination
->query_count());
185 ExpectNoLongerManagingAnything();
188 TEST_F(AudioMirroringManagerTest
, TwoMirroringSessionsOfNothing
) {
189 const scoped_ptr
<MockMirroringDestination
> destination(
190 new MockMirroringDestination(kRenderProcessId
, kRenderFrameId
));
191 StartMirroringTo(destination
, 0);
192 EXPECT_EQ(0, CountStreamsDivertedTo(destination
));
194 StopMirroringTo(destination
);
195 EXPECT_EQ(0, destination
->query_count());
197 const scoped_ptr
<MockMirroringDestination
> another_destination(
198 new MockMirroringDestination(kAnotherRenderProcessId
,
199 kAnotherRenderFrameId
));
200 StartMirroringTo(another_destination
, 0);
201 EXPECT_EQ(0, CountStreamsDivertedTo(another_destination
));
203 StopMirroringTo(another_destination
);
204 EXPECT_EQ(0, another_destination
->query_count());
206 ExpectNoLongerManagingAnything();
209 // Tests that a mirroring session starts after, and ends before, a stream that
210 // will be diverted to it.
211 TEST_F(AudioMirroringManagerTest
, StreamLifetimeAroundMirroringSession
) {
212 MockDiverter
* const stream
=
213 CreateStream(kRenderProcessId
, kRenderFrameId
, 1);
214 const scoped_ptr
<MockMirroringDestination
> destination(
215 new MockMirroringDestination(kRenderProcessId
, kRenderFrameId
));
216 StartMirroringTo(destination
, 1);
217 EXPECT_EQ(1, destination
->query_count());
218 EXPECT_EQ(1, CountStreamsDivertedTo(destination
));
220 StopMirroringTo(destination
);
221 EXPECT_EQ(1, destination
->query_count());
222 EXPECT_EQ(0, CountStreamsDivertedTo(destination
));
225 EXPECT_EQ(1, destination
->query_count());
226 EXPECT_EQ(0, CountStreamsDivertedTo(destination
));
228 ExpectNoLongerManagingAnything();
231 // Tests that a mirroring session starts before, and ends after, a stream that
232 // will be diverted to it.
233 TEST_F(AudioMirroringManagerTest
, StreamLifetimeWithinMirroringSession
) {
234 const scoped_ptr
<MockMirroringDestination
> destination(
235 new MockMirroringDestination(kRenderProcessId
, kRenderFrameId
));
236 StartMirroringTo(destination
, 1);
237 EXPECT_EQ(0, destination
->query_count());
238 EXPECT_EQ(0, CountStreamsDivertedTo(destination
));
240 MockDiverter
* const stream
=
241 CreateStream(kRenderProcessId
, kRenderFrameId
, 1);
242 EXPECT_EQ(1, destination
->query_count());
243 EXPECT_EQ(1, CountStreamsDivertedTo(destination
));
246 EXPECT_EQ(1, destination
->query_count());
247 EXPECT_EQ(0, CountStreamsDivertedTo(destination
));
249 StopMirroringTo(destination
);
250 EXPECT_EQ(1, destination
->query_count());
251 EXPECT_EQ(0, CountStreamsDivertedTo(destination
));
253 ExpectNoLongerManagingAnything();
256 // Tests that a stream is diverted correctly as two mirroring sessions come and
258 TEST_F(AudioMirroringManagerTest
, StreamLifetimeAcrossTwoMirroringSessions
) {
259 MockDiverter
* const stream
=
260 CreateStream(kRenderProcessId
, kRenderFrameId
, 2);
262 const scoped_ptr
<MockMirroringDestination
> destination(
263 new MockMirroringDestination(kRenderProcessId
, kRenderFrameId
));
264 StartMirroringTo(destination
, 1);
265 EXPECT_EQ(1, destination
->query_count());
266 EXPECT_EQ(1, CountStreamsDivertedTo(destination
));
268 StopMirroringTo(destination
);
269 EXPECT_EQ(1, destination
->query_count());
270 EXPECT_EQ(0, CountStreamsDivertedTo(destination
));
272 const scoped_ptr
<MockMirroringDestination
> second_destination(
273 new MockMirroringDestination(kRenderProcessId
, kRenderFrameId
));
274 StartMirroringTo(second_destination
, 1);
275 EXPECT_EQ(1, destination
->query_count());
276 EXPECT_EQ(0, CountStreamsDivertedTo(destination
));
277 EXPECT_EQ(1, second_destination
->query_count());
278 EXPECT_EQ(1, CountStreamsDivertedTo(second_destination
));
280 StopMirroringTo(second_destination
);
281 EXPECT_EQ(1, destination
->query_count());
282 EXPECT_EQ(0, CountStreamsDivertedTo(destination
));
283 EXPECT_EQ(1, second_destination
->query_count());
284 EXPECT_EQ(0, CountStreamsDivertedTo(second_destination
));
287 EXPECT_EQ(1, destination
->query_count());
288 EXPECT_EQ(0, CountStreamsDivertedTo(destination
));
289 EXPECT_EQ(1, second_destination
->query_count());
290 EXPECT_EQ(0, CountStreamsDivertedTo(second_destination
));
292 ExpectNoLongerManagingAnything();
295 // Tests that a stream does not flip-flop between two destinations that are a
297 TEST_F(AudioMirroringManagerTest
, StreamDivertingStickyToOneDestination_1
) {
298 MockDiverter
* const stream
=
299 CreateStream(kRenderProcessId
, kRenderFrameId
, 2);
301 const scoped_ptr
<MockMirroringDestination
> destination(
302 new MockMirroringDestination(kRenderProcessId
, kRenderFrameId
));
303 StartMirroringTo(destination
, 1);
304 EXPECT_EQ(1, destination
->query_count());
305 EXPECT_EQ(1, CountStreamsDivertedTo(destination
));
307 const scoped_ptr
<MockMirroringDestination
> replacement_destination(
308 new MockMirroringDestination(kRenderProcessId
, kRenderFrameId
));
309 StartMirroringTo(replacement_destination
, 1);
310 EXPECT_EQ(1, destination
->query_count());
311 EXPECT_EQ(1, CountStreamsDivertedTo(destination
));
312 EXPECT_EQ(0, replacement_destination
->query_count());
313 EXPECT_EQ(0, CountStreamsDivertedTo(replacement_destination
));
315 StopMirroringTo(destination
);
316 EXPECT_EQ(1, destination
->query_count());
317 EXPECT_EQ(0, CountStreamsDivertedTo(destination
));
318 EXPECT_EQ(1, replacement_destination
->query_count());
319 EXPECT_EQ(1, CountStreamsDivertedTo(replacement_destination
));
321 StopMirroringTo(replacement_destination
);
322 EXPECT_EQ(1, destination
->query_count());
323 EXPECT_EQ(0, CountStreamsDivertedTo(destination
));
324 EXPECT_EQ(1, replacement_destination
->query_count());
325 EXPECT_EQ(0, CountStreamsDivertedTo(replacement_destination
));
328 EXPECT_EQ(1, destination
->query_count());
329 EXPECT_EQ(0, CountStreamsDivertedTo(destination
));
330 EXPECT_EQ(1, replacement_destination
->query_count());
331 EXPECT_EQ(0, CountStreamsDivertedTo(replacement_destination
));
333 ExpectNoLongerManagingAnything();
336 // Same as StreamDivertingStickyToOneDestination_1, with a different order of
337 // operations that should have the same effects.
338 TEST_F(AudioMirroringManagerTest
, StreamDivertingStickyToOneDestination_2
) {
339 MockDiverter
* const stream
=
340 CreateStream(kRenderProcessId
, kRenderFrameId
, 2);
342 const scoped_ptr
<MockMirroringDestination
> destination(
343 new MockMirroringDestination(kRenderProcessId
, kRenderFrameId
));
344 StartMirroringTo(destination
, 1);
345 EXPECT_EQ(1, destination
->query_count());
346 EXPECT_EQ(1, CountStreamsDivertedTo(destination
));
348 const scoped_ptr
<MockMirroringDestination
> replacement_destination(
349 new MockMirroringDestination(kRenderProcessId
, kRenderFrameId
));
350 StartMirroringTo(replacement_destination
, 1);
351 EXPECT_EQ(1, destination
->query_count());
352 EXPECT_EQ(1, CountStreamsDivertedTo(destination
));
353 EXPECT_EQ(0, replacement_destination
->query_count());
354 EXPECT_EQ(0, CountStreamsDivertedTo(replacement_destination
));
356 StopMirroringTo(destination
);
357 EXPECT_EQ(1, destination
->query_count());
358 EXPECT_EQ(0, CountStreamsDivertedTo(destination
));
359 EXPECT_EQ(1, replacement_destination
->query_count());
360 EXPECT_EQ(1, CountStreamsDivertedTo(replacement_destination
));
363 EXPECT_EQ(1, destination
->query_count());
364 EXPECT_EQ(0, CountStreamsDivertedTo(destination
));
365 EXPECT_EQ(1, replacement_destination
->query_count());
366 EXPECT_EQ(0, CountStreamsDivertedTo(replacement_destination
));
368 StopMirroringTo(replacement_destination
);
369 EXPECT_EQ(1, destination
->query_count());
370 EXPECT_EQ(0, CountStreamsDivertedTo(destination
));
371 EXPECT_EQ(1, replacement_destination
->query_count());
372 EXPECT_EQ(0, CountStreamsDivertedTo(replacement_destination
));
374 ExpectNoLongerManagingAnything();
377 // Same as StreamDivertingStickyToOneDestination_1, except that the stream is
378 // killed before the first destination is stopped. Therefore, the second
379 // destination should never see the stream.
380 TEST_F(AudioMirroringManagerTest
, StreamDivertingStickyToOneDestination_3
) {
381 MockDiverter
* const stream
=
382 CreateStream(kRenderProcessId
, kRenderFrameId
, 1);
384 const scoped_ptr
<MockMirroringDestination
> destination(
385 new MockMirroringDestination(kRenderProcessId
, kRenderFrameId
));
386 StartMirroringTo(destination
, 1);
387 EXPECT_EQ(1, destination
->query_count());
388 EXPECT_EQ(1, CountStreamsDivertedTo(destination
));
390 const scoped_ptr
<MockMirroringDestination
> replacement_destination(
391 new MockMirroringDestination(kRenderProcessId
, kRenderFrameId
));
392 StartMirroringTo(replacement_destination
, 0);
393 EXPECT_EQ(1, destination
->query_count());
394 EXPECT_EQ(1, CountStreamsDivertedTo(destination
));
395 EXPECT_EQ(0, replacement_destination
->query_count());
396 EXPECT_EQ(0, CountStreamsDivertedTo(replacement_destination
));
399 EXPECT_EQ(1, destination
->query_count());
400 EXPECT_EQ(0, CountStreamsDivertedTo(destination
));
401 EXPECT_EQ(0, replacement_destination
->query_count());
402 EXPECT_EQ(0, CountStreamsDivertedTo(replacement_destination
));
404 StopMirroringTo(destination
);
405 EXPECT_EQ(1, destination
->query_count());
406 EXPECT_EQ(0, CountStreamsDivertedTo(destination
));
407 EXPECT_EQ(0, replacement_destination
->query_count());
408 EXPECT_EQ(0, CountStreamsDivertedTo(replacement_destination
));
410 StopMirroringTo(replacement_destination
);
411 EXPECT_EQ(1, destination
->query_count());
412 EXPECT_EQ(0, CountStreamsDivertedTo(destination
));
413 EXPECT_EQ(0, replacement_destination
->query_count());
414 EXPECT_EQ(0, CountStreamsDivertedTo(replacement_destination
));
416 ExpectNoLongerManagingAnything();
419 // Tests that multiple streams are diverted/mixed to one destination.
420 TEST_F(AudioMirroringManagerTest
, MultipleStreamsInOneMirroringSession
) {
421 MockDiverter
* const stream1
=
422 CreateStream(kRenderProcessId
, kRenderFrameId
, 1);
424 const scoped_ptr
<MockMirroringDestination
> destination(
425 new MockMirroringDestination(kRenderProcessId
, kRenderFrameId
));
426 StartMirroringTo(destination
, 3);
427 EXPECT_EQ(1, destination
->query_count());
428 EXPECT_EQ(1, CountStreamsDivertedTo(destination
));
430 MockDiverter
* const stream2
=
431 CreateStream(kRenderProcessId
, kRenderFrameId
, 1);
432 EXPECT_EQ(2, destination
->query_count());
433 EXPECT_EQ(2, CountStreamsDivertedTo(destination
));
435 MockDiverter
* const stream3
=
436 CreateStream(kRenderProcessId
, kRenderFrameId
, 1);
437 EXPECT_EQ(3, destination
->query_count());
438 EXPECT_EQ(3, CountStreamsDivertedTo(destination
));
441 EXPECT_EQ(3, destination
->query_count());
442 EXPECT_EQ(2, CountStreamsDivertedTo(destination
));
444 StopMirroringTo(destination
);
445 EXPECT_EQ(3, destination
->query_count());
446 EXPECT_EQ(0, CountStreamsDivertedTo(destination
));
449 EXPECT_EQ(3, destination
->query_count());
450 EXPECT_EQ(0, CountStreamsDivertedTo(destination
));
453 EXPECT_EQ(3, destination
->query_count());
454 EXPECT_EQ(0, CountStreamsDivertedTo(destination
));
456 ExpectNoLongerManagingAnything();
459 // A random interleaving of operations for three separate targets, each of which
460 // has one stream mirrored to one destination.
461 TEST_F(AudioMirroringManagerTest
, ThreeSeparateMirroringSessions
) {
462 MockDiverter
* const stream
=
463 CreateStream(kRenderProcessId
, kRenderFrameId
, 1);
465 const scoped_ptr
<MockMirroringDestination
> destination(
466 new MockMirroringDestination(kRenderProcessId
, kRenderFrameId
));
467 StartMirroringTo(destination
, 1);
468 EXPECT_EQ(1, destination
->query_count());
469 EXPECT_EQ(1, CountStreamsDivertedTo(destination
));
471 const scoped_ptr
<MockMirroringDestination
> another_destination(
472 new MockMirroringDestination(kAnotherRenderProcessId
,
473 kAnotherRenderFrameId
));
474 StartMirroringTo(another_destination
, 1);
475 EXPECT_EQ(1, destination
->query_count());
476 EXPECT_EQ(1, CountStreamsDivertedTo(destination
));
477 EXPECT_EQ(0, another_destination
->query_count());
478 EXPECT_EQ(0, CountStreamsDivertedTo(another_destination
));
480 MockDiverter
* const another_stream
=
481 CreateStream(kAnotherRenderProcessId
, kAnotherRenderFrameId
, 1);
482 EXPECT_EQ(2, destination
->query_count());
483 EXPECT_EQ(1, CountStreamsDivertedTo(destination
));
484 EXPECT_EQ(1, another_destination
->query_count());
485 EXPECT_EQ(1, CountStreamsDivertedTo(another_destination
));
488 EXPECT_EQ(2, destination
->query_count());
489 EXPECT_EQ(0, CountStreamsDivertedTo(destination
));
490 EXPECT_EQ(1, another_destination
->query_count());
491 EXPECT_EQ(1, CountStreamsDivertedTo(another_destination
));
493 MockDiverter
* const yet_another_stream
=
494 CreateStream(kYetAnotherRenderProcessId
, kYetAnotherRenderFrameId
, 1);
495 EXPECT_EQ(3, destination
->query_count());
496 EXPECT_EQ(0, CountStreamsDivertedTo(destination
));
497 EXPECT_EQ(2, another_destination
->query_count());
498 EXPECT_EQ(1, CountStreamsDivertedTo(another_destination
));
500 const scoped_ptr
<MockMirroringDestination
> yet_another_destination(
501 new MockMirroringDestination(kYetAnotherRenderProcessId
,
502 kYetAnotherRenderFrameId
));
503 StartMirroringTo(yet_another_destination
, 1);
504 EXPECT_EQ(3, destination
->query_count());
505 EXPECT_EQ(0, CountStreamsDivertedTo(destination
));
506 EXPECT_EQ(2, another_destination
->query_count());
507 EXPECT_EQ(1, CountStreamsDivertedTo(another_destination
));
508 EXPECT_EQ(1, yet_another_destination
->query_count());
509 EXPECT_EQ(1, CountStreamsDivertedTo(yet_another_destination
));
511 StopMirroringTo(another_destination
);
512 EXPECT_EQ(4, destination
->query_count());
513 EXPECT_EQ(0, CountStreamsDivertedTo(destination
));
514 EXPECT_EQ(2, another_destination
->query_count());
515 EXPECT_EQ(0, CountStreamsDivertedTo(another_destination
));
516 EXPECT_EQ(2, yet_another_destination
->query_count());
517 EXPECT_EQ(1, CountStreamsDivertedTo(yet_another_destination
));
519 StopMirroringTo(yet_another_destination
);
520 EXPECT_EQ(5, destination
->query_count());
521 EXPECT_EQ(0, CountStreamsDivertedTo(destination
));
522 EXPECT_EQ(2, another_destination
->query_count());
523 EXPECT_EQ(0, CountStreamsDivertedTo(another_destination
));
524 EXPECT_EQ(2, yet_another_destination
->query_count());
525 EXPECT_EQ(0, CountStreamsDivertedTo(yet_another_destination
));
527 StopMirroringTo(destination
);
528 EXPECT_EQ(5, destination
->query_count());
529 EXPECT_EQ(0, CountStreamsDivertedTo(destination
));
530 EXPECT_EQ(2, another_destination
->query_count());
531 EXPECT_EQ(0, CountStreamsDivertedTo(another_destination
));
532 EXPECT_EQ(2, yet_another_destination
->query_count());
533 EXPECT_EQ(0, CountStreamsDivertedTo(yet_another_destination
));
535 KillStream(another_stream
);
536 EXPECT_EQ(5, destination
->query_count());
537 EXPECT_EQ(0, CountStreamsDivertedTo(destination
));
538 EXPECT_EQ(2, another_destination
->query_count());
539 EXPECT_EQ(0, CountStreamsDivertedTo(another_destination
));
540 EXPECT_EQ(2, yet_another_destination
->query_count());
541 EXPECT_EQ(0, CountStreamsDivertedTo(yet_another_destination
));
543 KillStream(yet_another_stream
);
544 EXPECT_EQ(5, destination
->query_count());
545 EXPECT_EQ(0, CountStreamsDivertedTo(destination
));
546 EXPECT_EQ(2, another_destination
->query_count());
547 EXPECT_EQ(0, CountStreamsDivertedTo(another_destination
));
548 EXPECT_EQ(2, yet_another_destination
->query_count());
549 EXPECT_EQ(0, CountStreamsDivertedTo(yet_another_destination
));
551 ExpectNoLongerManagingAnything();
554 } // namespace content