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

Unified Diff: content/renderer/media/pepper_to_video_track_adapter_unittest.cc

Issue 2749543003: Reset TaskScheduler during PepperToVideoTrackAdapterTest tear down. (Closed)
Patch Set: 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/renderer/media/pepper_to_video_track_adapter_unittest.cc
diff --git a/content/renderer/media/pepper_to_video_track_adapter_unittest.cc b/content/renderer/media/pepper_to_video_track_adapter_unittest.cc
index da0d50cb975978cd2d78defb998acfc08d166e76..073f1aebe882deb38b100754a1dd12e2a04e3fb6 100644
--- a/content/renderer/media/pepper_to_video_track_adapter_unittest.cc
+++ b/content/renderer/media/pepper_to_video_track_adapter_unittest.cc
@@ -2,9 +2,12 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
+#include <memory>
#include <string>
+#include "base/memory/ptr_util.h"
#include "base/run_loop.h"
+#include "base/task_scheduler/task_scheduler.h"
#include "content/child/child_process.h"
#include "content/public/test/mock_render_thread.h"
#include "content/renderer/media/media_stream.h"
@@ -42,14 +45,22 @@ class PepperToVideoTrackAdapterTest : public PpapiUnittest {
registry_.reset();
blink::WebHeap::collectAllGarbageForTesting();
PpapiUnittest::TearDown();
+
+ child_process_.reset();
+
+ // Clear the TaskScheduler registered by the ChildProcess. ChildProcess does
+ // not clear the TaskScheduler itself because CONTINUE_ON_SHUTDOWN tasks are
+ // allowed to outlive it.
+ base::TaskScheduler::GetInstance()->JoinForTesting();
+ base::TaskScheduler::SetInstance(nullptr);
}
protected:
- // A ChildProcess and a MessageLoop are both needed to fool the Tracks and
- // Sources inside |registry_| into believing they are on the right threads.
- const ChildProcess child_process_;
- const MockRenderThread render_thread_;
std::unique_ptr<MockMediaStreamRegistry> registry_;
+
+ // A ChildProcess is needed by content::PepperToVideoTrackAdapter::Open.
+ std::unique_ptr<ChildProcess> child_process_ =
+ base::MakeUnique<ChildProcess>();
};
TEST_F(PepperToVideoTrackAdapterTest, Open) {
@@ -64,6 +75,7 @@ TEST_F(PepperToVideoTrackAdapterTest, Open) {
}
TEST_F(PepperToVideoTrackAdapterTest, PutFrame) {
+ MockRenderThread render_thread;
FrameWriterInterface* frame_writer = NULL;
EXPECT_TRUE(PepperToVideoTrackAdapter::Open(registry_.get(),
kTestStreamUrl, &frame_writer));
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698