| OLD | NEW |
| 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 18 matching lines...) Expand all Loading... |
| 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(blink::WebString::fromASCII("dummy_source_id"), | 37 blink_source_.initialize(blink::WebString::fromASCII("dummy_source_id"), |
| 38 blink::WebMediaStreamSource::TypeVideo, | 38 blink::WebMediaStreamSource::TypeVideo, |
| 39 blink::WebString::fromASCII("dummy_source_name")); | 39 blink::WebString::fromASCII("dummy_source_name"), |
| 40 false /* remote */); |
| 40 blink_source_.setExtraData(mock_source_); | 41 blink_source_.setExtraData(mock_source_); |
| 41 } | 42 } |
| 42 | 43 |
| 43 ~MediaStreamVideoTrackTest() override {} | 44 ~MediaStreamVideoTrackTest() override {} |
| 44 | 45 |
| 45 void TearDown() override { | 46 void TearDown() override { |
| 46 blink_source_.reset(); | 47 blink_source_.reset(); |
| 47 blink::WebHeap::collectAllGarbageForTesting(); | 48 blink::WebHeap::collectAllGarbageForTesting(); |
| 48 } | 49 } |
| 49 | 50 |
| (...skipping 29 matching lines...) Expand all Loading... |
| 79 source_started_ = true; | 80 source_started_ = true; |
| 80 } | 81 } |
| 81 return track; | 82 return track; |
| 82 } | 83 } |
| 83 | 84 |
| 84 void UpdateVideoSourceToRespondToRequestRefreshFrame() { | 85 void UpdateVideoSourceToRespondToRequestRefreshFrame() { |
| 85 blink_source_.reset(); | 86 blink_source_.reset(); |
| 86 mock_source_ = new MockMediaStreamVideoSource(false, true); | 87 mock_source_ = new MockMediaStreamVideoSource(false, true); |
| 87 blink_source_.initialize(blink::WebString::fromASCII("dummy_source_id"), | 88 blink_source_.initialize(blink::WebString::fromASCII("dummy_source_id"), |
| 88 blink::WebMediaStreamSource::TypeVideo, | 89 blink::WebMediaStreamSource::TypeVideo, |
| 89 blink::WebString::fromASCII("dummy_source_name")); | 90 blink::WebString::fromASCII("dummy_source_name"), |
| 91 false /* remote */); |
| 90 blink_source_.setExtraData(mock_source_); | 92 blink_source_.setExtraData(mock_source_); |
| 91 } | 93 } |
| 92 | 94 |
| 93 MockMediaStreamVideoSource* mock_source() { return mock_source_; } | 95 MockMediaStreamVideoSource* mock_source() { return mock_source_; } |
| 94 const blink::WebMediaStreamSource& blink_source() const { | 96 const blink::WebMediaStreamSource& blink_source() const { |
| 95 return blink_source_; | 97 return blink_source_; |
| 96 } | 98 } |
| 97 | 99 |
| 98 private: | 100 private: |
| 99 const base::MessageLoopForUI message_loop_; | 101 const base::MessageLoopForUI message_loop_; |
| (...skipping 160 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 260 blink::WebMediaStreamTrack::Settings settings; | 262 blink::WebMediaStreamTrack::Settings settings; |
| 261 native_track->getSettings(settings); | 263 native_track->getSettings(settings); |
| 262 // These values come straight from the mock video track implementation. | 264 // These values come straight from the mock video track implementation. |
| 263 EXPECT_EQ(640, settings.width); | 265 EXPECT_EQ(640, settings.width); |
| 264 EXPECT_EQ(480, settings.height); | 266 EXPECT_EQ(480, settings.height); |
| 265 EXPECT_EQ(30.0, settings.frameRate); | 267 EXPECT_EQ(30.0, settings.frameRate); |
| 266 EXPECT_EQ(blink::WebMediaStreamTrack::FacingMode::None, settings.facingMode); | 268 EXPECT_EQ(blink::WebMediaStreamTrack::FacingMode::None, settings.facingMode); |
| 267 } | 269 } |
| 268 | 270 |
| 269 } // namespace content | 271 } // namespace content |
| OLD | NEW |