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

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

Issue 2644853002: Use explicit WebString conversion methods in content/renderer/media (unittests) (Closed)
Patch Set: Created 3 years, 11 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 <stdint.h> 5 #include <stdint.h>
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/bind_helpers.h" 8 #include "base/bind_helpers.h"
9 #include "base/callback.h" 9 #include "base/callback.h"
10 #include "base/message_loop/message_loop.h" 10 #include "base/message_loop/message_loop.h"
(...skipping 16 matching lines...) Expand all
27 ACTION_P(RunClosure, closure) { 27 ACTION_P(RunClosure, closure) {
28 closure.Run(); 28 closure.Run();
29 } 29 }
30 30
31 class MediaStreamVideoTrackTest : public ::testing::Test { 31 class MediaStreamVideoTrackTest : public ::testing::Test {
32 public: 32 public:
33 MediaStreamVideoTrackTest() 33 MediaStreamVideoTrackTest()
34 : child_process_(new ChildProcess()), 34 : child_process_(new ChildProcess()),
35 mock_source_(new MockMediaStreamVideoSource(false)), 35 mock_source_(new MockMediaStreamVideoSource(false)),
36 source_started_(false) { 36 source_started_(false) {
37 blink_source_.initialize(base::UTF8ToUTF16("dummy_source_id"), 37 blink_source_.initialize(blink::WebString::fromASCII("dummy_source_id"),
38 blink::WebMediaStreamSource::TypeVideo, 38 blink::WebMediaStreamSource::TypeVideo,
39 base::UTF8ToUTF16("dummy_source_name"), 39 blink::WebString::fromASCII("dummy_source_name"),
40 false /* remote */); 40 false /* remote */);
41 blink_source_.setExtraData(mock_source_); 41 blink_source_.setExtraData(mock_source_);
42 } 42 }
43 43
44 ~MediaStreamVideoTrackTest() override {} 44 ~MediaStreamVideoTrackTest() override {}
45 45
46 void TearDown() override { 46 void TearDown() override {
47 blink_source_.reset(); 47 blink_source_.reset();
48 blink::WebHeap::collectAllGarbageForTesting(); 48 blink::WebHeap::collectAllGarbageForTesting();
49 } 49 }
(...skipping 28 matching lines...) Expand all
78 if (!source_started_) { 78 if (!source_started_) {
79 mock_source_->StartMockedSource(); 79 mock_source_->StartMockedSource();
80 source_started_ = true; 80 source_started_ = true;
81 } 81 }
82 return track; 82 return track;
83 } 83 }
84 84
85 void UpdateVideoSourceToRespondToRequestRefreshFrame() { 85 void UpdateVideoSourceToRespondToRequestRefreshFrame() {
86 blink_source_.reset(); 86 blink_source_.reset();
87 mock_source_ = new MockMediaStreamVideoSource(false, true); 87 mock_source_ = new MockMediaStreamVideoSource(false, true);
88 blink_source_.initialize(base::UTF8ToUTF16("dummy_source_id"), 88 blink_source_.initialize(blink::WebString::fromASCII("dummy_source_id"),
89 blink::WebMediaStreamSource::TypeVideo, 89 blink::WebMediaStreamSource::TypeVideo,
90 base::UTF8ToUTF16("dummy_source_name"), 90 blink::WebString::fromASCII("dummy_source_name"),
91 false /* remote */); 91 false /* remote */);
92 blink_source_.setExtraData(mock_source_); 92 blink_source_.setExtraData(mock_source_);
93 } 93 }
94 94
95 MockMediaStreamVideoSource* mock_source() { return mock_source_; } 95 MockMediaStreamVideoSource* mock_source() { return mock_source_; }
96 const blink::WebMediaStreamSource& blink_source() const { 96 const blink::WebMediaStreamSource& blink_source() const {
97 return blink_source_; 97 return blink_source_;
98 } 98 }
99 99
100 private: 100 private:
(...skipping 148 matching lines...) Expand 10 before | Expand all | Expand 10 after
249 base::Closure quit_closure = run_loop.QuitClosure(); 249 base::Closure quit_closure = run_loop.QuitClosure();
250 EXPECT_CALL(sink, OnVideoFrame()).WillOnce(RunClosure(quit_closure)); 250 EXPECT_CALL(sink, OnVideoFrame()).WillOnce(RunClosure(quit_closure));
251 sink.ConnectToTrack(track); 251 sink.ConnectToTrack(track);
252 run_loop.Run(); 252 run_loop.Run();
253 EXPECT_EQ(1, sink.number_of_frames()); 253 EXPECT_EQ(1, sink.number_of_frames());
254 254
255 sink.DisconnectFromTrack(); 255 sink.DisconnectFromTrack();
256 } 256 }
257 257
258 } // namespace content 258 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698