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 "content/renderer/media/webrtc/media_stream_track_metrics.h" | 5 #include "content/renderer/media/webrtc/media_stream_track_metrics.h" |
6 #include "content/renderer/media/webrtc/mock_peer_connection_dependency_factory.
h" | 6 #include "content/renderer/media/webrtc/mock_peer_connection_dependency_factory.
h" |
7 #include "testing/gmock/include/gmock/gmock.h" | 7 #include "testing/gmock/include/gmock/gmock.h" |
8 #include "testing/gtest/include/gtest/gtest.h" | 8 #include "testing/gtest/include/gtest/gtest.h" |
9 #include "third_party/libjingle/source/talk/app/webrtc/mediastreaminterface.h" | 9 #include "third_party/libjingle/source/talk/app/webrtc/mediastreaminterface.h" |
10 | 10 |
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
73 MOCK_METHOD4(SendLifetimeMessage, | 73 MOCK_METHOD4(SendLifetimeMessage, |
74 void(const std::string&, TrackType, LifetimeEvent, StreamType)); | 74 void(const std::string&, TrackType, LifetimeEvent, StreamType)); |
75 | 75 |
76 using MediaStreamTrackMetrics::MakeUniqueIdImpl; | 76 using MediaStreamTrackMetrics::MakeUniqueIdImpl; |
77 }; | 77 }; |
78 | 78 |
79 class MediaStreamTrackMetricsTest : public testing::Test { | 79 class MediaStreamTrackMetricsTest : public testing::Test { |
80 public: | 80 public: |
81 virtual void SetUp() OVERRIDE { | 81 virtual void SetUp() OVERRIDE { |
82 metrics_.reset(new MockMediaStreamTrackMetrics()); | 82 metrics_.reset(new MockMediaStreamTrackMetrics()); |
83 stream_ = new talk_base::RefCountedObject<MockMediaStream>("stream"); | 83 stream_ = new rtc::RefCountedObject<MockMediaStream>("stream"); |
84 } | 84 } |
85 | 85 |
86 virtual void TearDown() OVERRIDE { | 86 virtual void TearDown() OVERRIDE { |
87 metrics_.reset(); | 87 metrics_.reset(); |
88 stream_ = NULL; | 88 stream_ = NULL; |
89 } | 89 } |
90 | 90 |
91 scoped_refptr<MockAudioTrackInterface> MakeAudioTrack(std::string id) { | 91 scoped_refptr<MockAudioTrackInterface> MakeAudioTrack(std::string id) { |
92 return new talk_base::RefCountedObject<MockAudioTrackInterface>(id); | 92 return new rtc::RefCountedObject<MockAudioTrackInterface>(id); |
93 } | 93 } |
94 | 94 |
95 scoped_refptr<MockVideoTrackInterface> MakeVideoTrack(std::string id) { | 95 scoped_refptr<MockVideoTrackInterface> MakeVideoTrack(std::string id) { |
96 return new talk_base::RefCountedObject<MockVideoTrackInterface>(id); | 96 return new rtc::RefCountedObject<MockVideoTrackInterface>(id); |
97 } | 97 } |
98 | 98 |
99 scoped_ptr<MockMediaStreamTrackMetrics> metrics_; | 99 scoped_ptr<MockMediaStreamTrackMetrics> metrics_; |
100 scoped_refptr<MediaStreamInterface> stream_; | 100 scoped_refptr<MediaStreamInterface> stream_; |
101 }; | 101 }; |
102 | 102 |
103 TEST_F(MediaStreamTrackMetricsTest, MakeUniqueId) { | 103 TEST_F(MediaStreamTrackMetricsTest, MakeUniqueId) { |
104 // The important testable properties of the unique ID are that it | 104 // The important testable properties of the unique ID are that it |
105 // should differ when any of the three constituents differ | 105 // should differ when any of the three constituents differ |
106 // (PeerConnection pointer, track ID, remote or not. Also, testing | 106 // (PeerConnection pointer, track ID, remote or not. Also, testing |
(...skipping 427 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
534 MediaStreamTrackMetrics::SENT_STREAM)); | 534 MediaStreamTrackMetrics::SENT_STREAM)); |
535 EXPECT_CALL(*metrics_, | 535 EXPECT_CALL(*metrics_, |
536 SendLifetimeMessage("video3", | 536 SendLifetimeMessage("video3", |
537 MediaStreamTrackMetrics::VIDEO_TRACK, | 537 MediaStreamTrackMetrics::VIDEO_TRACK, |
538 MediaStreamTrackMetrics::DISCONNECTED, | 538 MediaStreamTrackMetrics::DISCONNECTED, |
539 MediaStreamTrackMetrics::SENT_STREAM)); | 539 MediaStreamTrackMetrics::SENT_STREAM)); |
540 metrics_->RemoveStream(MediaStreamTrackMetrics::SENT_STREAM, stream_); | 540 metrics_->RemoveStream(MediaStreamTrackMetrics::SENT_STREAM, stream_); |
541 } | 541 } |
542 | 542 |
543 } // namespace content | 543 } // namespace content |
OLD | NEW |