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