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

Side by Side Diff: content/renderer/media/media_stream_video_source_unittest.cc

Issue 549153002: MediaStream tests need to call WebHeap::collectGarbage (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 3 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 unified diff | Download patch
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include <string> 5 #include <string>
6 #include <vector> 6 #include <vector>
7 7
8 #include "base/bind.h" 8 #include "base/bind.h"
9 #include "base/message_loop/message_loop.h" 9 #include "base/message_loop/message_loop.h"
10 #include "base/run_loop.h" 10 #include "base/run_loop.h"
11 #include "base/strings/string_number_conversions.h" 11 #include "base/strings/string_number_conversions.h"
12 #include "base/strings/utf_string_conversions.h" 12 #include "base/strings/utf_string_conversions.h"
13 #include "content/child/child_process.h" 13 #include "content/child/child_process.h"
14 #include "content/renderer/media/media_stream_video_source.h" 14 #include "content/renderer/media/media_stream_video_source.h"
15 #include "content/renderer/media/media_stream_video_track.h" 15 #include "content/renderer/media/media_stream_video_track.h"
16 #include "content/renderer/media/mock_media_constraint_factory.h" 16 #include "content/renderer/media/mock_media_constraint_factory.h"
17 #include "content/renderer/media/mock_media_stream_video_sink.h" 17 #include "content/renderer/media/mock_media_stream_video_sink.h"
18 #include "content/renderer/media/mock_media_stream_video_source.h" 18 #include "content/renderer/media/mock_media_stream_video_source.h"
19 #include "media/base/video_frame.h" 19 #include "media/base/video_frame.h"
20 #include "testing/gtest/include/gtest/gtest.h" 20 #include "testing/gtest/include/gtest/gtest.h"
21 #include "third_party/WebKit/public/web/WebHeap.h"
21 22
22 using ::testing::_; 23 using ::testing::_;
23 using ::testing::DoAll; 24 using ::testing::DoAll;
24 using ::testing::SaveArg; 25 using ::testing::SaveArg;
25 26
26 namespace content { 27 namespace content {
27 28
28 ACTION_P(RunClosure, closure) { 29 ACTION_P(RunClosure, closure) {
29 closure.Run(); 30 closure.Run();
30 } 31 }
(...skipping 17 matching lines...) Expand all
48 gfx::Size(352, 288), 30, media::PIXEL_FORMAT_I420)); 49 gfx::Size(352, 288), 30, media::PIXEL_FORMAT_I420));
49 formats.push_back(media::VideoCaptureFormat( 50 formats.push_back(media::VideoCaptureFormat(
50 gfx::Size(320, 240), 30, media::PIXEL_FORMAT_I420)); 51 gfx::Size(320, 240), 30, media::PIXEL_FORMAT_I420));
51 mock_source_->SetSupportedFormats(formats); 52 mock_source_->SetSupportedFormats(formats);
52 webkit_source_.initialize(base::UTF8ToUTF16("dummy_source_id"), 53 webkit_source_.initialize(base::UTF8ToUTF16("dummy_source_id"),
53 blink::WebMediaStreamSource::TypeVideo, 54 blink::WebMediaStreamSource::TypeVideo,
54 base::UTF8ToUTF16("dummy_source_name")); 55 base::UTF8ToUTF16("dummy_source_name"));
55 webkit_source_.setExtraData(mock_source_); 56 webkit_source_.setExtraData(mock_source_);
56 } 57 }
57 58
59 virtual void TearDown() {
60 webkit_source_.reset();
61 blink::WebHeap::collectAllGarbageForTesting();
62 }
63
58 protected: 64 protected:
59 // Create a track that's associated with |webkit_source_|. 65 // Create a track that's associated with |webkit_source_|.
60 blink::WebMediaStreamTrack CreateTrack( 66 blink::WebMediaStreamTrack CreateTrack(
61 const std::string& id, 67 const std::string& id,
62 const blink::WebMediaConstraints& constraints) { 68 const blink::WebMediaConstraints& constraints) {
63 bool enabled = true; 69 bool enabled = true;
64 return MediaStreamVideoTrack::CreateVideoTrack( 70 return MediaStreamVideoTrack::CreateVideoTrack(
65 mock_source_, constraints, 71 mock_source_, constraints,
66 base::Bind( 72 base::Bind(
67 &MediaStreamVideoSourceTest::OnConstraintsApplied, 73 &MediaStreamVideoSourceTest::OnConstraintsApplied,
(...skipping 713 matching lines...) Expand 10 before | Expand all | Expand 10 after
781 run_loop2.Run(); 787 run_loop2.Run();
782 788
783 EXPECT_EQ(muted_state, false); 789 EXPECT_EQ(muted_state, false);
784 EXPECT_EQ(track.source().readyState(), 790 EXPECT_EQ(track.source().readyState(),
785 blink::WebMediaStreamSource::ReadyStateLive); 791 blink::WebMediaStreamSource::ReadyStateLive);
786 792
787 MediaStreamVideoSink::RemoveFromVideoTrack(&sink, track); 793 MediaStreamVideoSink::RemoveFromVideoTrack(&sink, track);
788 } 794 }
789 795
790 } // namespace content 796 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698