| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 "base/run_loop.h" | 5 #include "base/run_loop.h" |
| 6 #include "base/strings/utf_string_conversions.h" | 6 #include "base/strings/utf_string_conversions.h" |
| 7 #include "content/child/child_process.h" | 7 #include "content/child/child_process.h" |
| 8 #include "content/renderer/media/media_recorder_handler.h" | 8 #include "content/renderer/media/media_recorder_handler.h" |
| 9 #include "content/renderer/media/mock_media_stream_registry.h" | 9 #include "content/renderer/media/mock_media_stream_registry.h" |
| 10 #include "media/base/video_frame.h" | 10 #include "media/base/video_frame.h" |
| (...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 71 }; | 71 }; |
| 72 | 72 |
| 73 // Checks that canSupportMimeType() works as expected. | 73 // Checks that canSupportMimeType() works as expected. |
| 74 // TODO(mcasas): revisit this when canSupportMimeType() is fully implemented. | 74 // TODO(mcasas): revisit this when canSupportMimeType() is fully implemented. |
| 75 TEST_F(MediaRecorderHandlerTest, CanSupportMimeType) { | 75 TEST_F(MediaRecorderHandlerTest, CanSupportMimeType) { |
| 76 const WebString good_mime_type(base::UTF8ToUTF16("video/vp8")); | 76 const WebString good_mime_type(base::UTF8ToUTF16("video/vp8")); |
| 77 EXPECT_TRUE(media_recorder_handler_->canSupportMimeType(good_mime_type)); | 77 EXPECT_TRUE(media_recorder_handler_->canSupportMimeType(good_mime_type)); |
| 78 | 78 |
| 79 const WebString bad_mime_type(base::UTF8ToUTF16("video/unsupportedcodec")); | 79 const WebString bad_mime_type(base::UTF8ToUTF16("video/unsupportedcodec")); |
| 80 EXPECT_FALSE(media_recorder_handler_->canSupportMimeType(bad_mime_type)); | 80 EXPECT_FALSE(media_recorder_handler_->canSupportMimeType(bad_mime_type)); |
| 81 |
| 82 const WebString empty_mime_type(base::UTF8ToUTF16("")); |
| 83 EXPECT_TRUE(media_recorder_handler_->canSupportMimeType(empty_mime_type)); |
| 81 } | 84 } |
| 82 | 85 |
| 83 // Checks that the initialization-destruction sequence works fine. | 86 // Checks that the initialization-destruction sequence works fine. |
| 84 TEST_F(MediaRecorderHandlerTest, InitializeStartStop) { | 87 TEST_F(MediaRecorderHandlerTest, InitializeStartStop) { |
| 85 const WebString mime_type(base::UTF8ToUTF16("video/vp8")); | 88 const WebString mime_type(base::UTF8ToUTF16("")); |
| 86 EXPECT_TRUE(media_recorder_handler_->initialize(this, | 89 EXPECT_TRUE(media_recorder_handler_->initialize(this, |
| 87 registry_.test_stream(), | 90 registry_.test_stream(), |
| 88 mime_type)); | 91 mime_type)); |
| 89 EXPECT_FALSE(recording()); | 92 EXPECT_FALSE(recording()); |
| 90 EXPECT_FALSE(hasVideoRecorders()); | 93 EXPECT_FALSE(hasVideoRecorders()); |
| 91 | 94 |
| 92 EXPECT_TRUE(media_recorder_handler_->start()); | 95 EXPECT_TRUE(media_recorder_handler_->start()); |
| 93 EXPECT_TRUE(recording()); | 96 EXPECT_TRUE(recording()); |
| 94 EXPECT_TRUE(hasVideoRecorders()); | 97 EXPECT_TRUE(hasVideoRecorders()); |
| 95 | 98 |
| (...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 146 } | 149 } |
| 147 | 150 |
| 148 media_recorder_handler_->stop(); | 151 media_recorder_handler_->stop(); |
| 149 | 152 |
| 150 // Expect a last call on destruction, with size 0 and |lastInSlice| true. | 153 // Expect a last call on destruction, with size 0 and |lastInSlice| true. |
| 151 EXPECT_CALL(*this, writeData(nullptr, 0, true)).Times(1); | 154 EXPECT_CALL(*this, writeData(nullptr, 0, true)).Times(1); |
| 152 media_recorder_handler_.reset(); | 155 media_recorder_handler_.reset(); |
| 153 } | 156 } |
| 154 | 157 |
| 155 } // namespace content | 158 } // namespace content |
| OLD | NEW |