| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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/browser/media/media_internals.h" | 5 #include "content/browser/media/media_internals.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/json/json_reader.h" | 9 #include "base/json/json_reader.h" |
| 10 #include "base/run_loop.h" | 10 #include "base/run_loop.h" |
| (...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 145 TEST_F(MediaInternalsVideoCaptureDeviceTest, | 145 TEST_F(MediaInternalsVideoCaptureDeviceTest, |
| 146 VideoCaptureFormatStringIsInExpectedFormat) { | 146 VideoCaptureFormatStringIsInExpectedFormat) { |
| 147 // Since media internals will send video capture capabilities to JavaScript in | 147 // Since media internals will send video capture capabilities to JavaScript in |
| 148 // an expected format and there are no public methods for accessing the | 148 // an expected format and there are no public methods for accessing the |
| 149 // resolutions, frame rates or pixel formats, this test checks that the format | 149 // resolutions, frame rates or pixel formats, this test checks that the format |
| 150 // has not changed. If the test fails because of the changed format, it should | 150 // has not changed. If the test fails because of the changed format, it should |
| 151 // be updated at the same time as the media internals JS files. | 151 // be updated at the same time as the media internals JS files. |
| 152 const float kFrameRate = 30.0f; | 152 const float kFrameRate = 30.0f; |
| 153 const gfx::Size kFrameSize(1280, 720); | 153 const gfx::Size kFrameSize(1280, 720); |
| 154 const media::VideoPixelFormat kPixelFormat = media::PIXEL_FORMAT_I420; | 154 const media::VideoPixelFormat kPixelFormat = media::PIXEL_FORMAT_I420; |
| 155 const media::VideoPixelStorage kPixelStorage = media::PIXEL_STORAGE_CPU; |
| 155 const media::VideoCaptureFormat capture_format( | 156 const media::VideoCaptureFormat capture_format( |
| 156 kFrameSize, kFrameRate, kPixelFormat); | 157 kFrameSize, kFrameRate, kPixelFormat, kPixelStorage); |
| 157 const std::string expected_string = | 158 const std::string expected_string = base::StringPrintf( |
| 158 base::StringPrintf("resolution: %s, fps: %.3f, pixel format: %s", | 159 "(%s)@%.3ffps, pixel format: %s storage: %s.", |
| 159 kFrameSize.ToString().c_str(), | 160 kFrameSize.ToString().c_str(), kFrameRate, |
| 160 kFrameRate, | 161 media::VideoCaptureFormat::PixelFormatToString(kPixelFormat).c_str(), |
| 161 media::VideoCaptureFormat::PixelFormatToString( | 162 media::VideoCaptureFormat::PixelStorageToString(kPixelStorage).c_str()); |
| 162 kPixelFormat).c_str()); | |
| 163 EXPECT_EQ(expected_string, capture_format.ToString()); | 163 EXPECT_EQ(expected_string, capture_format.ToString()); |
| 164 } | 164 } |
| 165 | 165 |
| 166 TEST_F(MediaInternalsVideoCaptureDeviceTest, | 166 TEST_F(MediaInternalsVideoCaptureDeviceTest, |
| 167 NotifyVideoCaptureDeviceCapabilitiesEnumerated) { | 167 NotifyVideoCaptureDeviceCapabilitiesEnumerated) { |
| 168 const int kWidth = 1280; | 168 const int kWidth = 1280; |
| 169 const int kHeight = 720; | 169 const int kHeight = 720; |
| 170 const float kFrameRate = 30.0f; | 170 const float kFrameRate = 30.0f; |
| 171 const media::VideoPixelFormat kPixelFormat = media::PIXEL_FORMAT_I420; | 171 const media::VideoPixelFormat kPixelFormat = media::PIXEL_FORMAT_I420; |
| 172 const media::VideoCaptureFormat format_hd({kWidth, kHeight}, | 172 const media::VideoCaptureFormat format_hd({kWidth, kHeight}, |
| (...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 299 ExpectStatus("closed"); | 299 ExpectStatus("closed"); |
| 300 } | 300 } |
| 301 | 301 |
| 302 INSTANTIATE_TEST_CASE_P( | 302 INSTANTIATE_TEST_CASE_P( |
| 303 MediaInternalsAudioLogTest, MediaInternalsAudioLogTest, testing::Values( | 303 MediaInternalsAudioLogTest, MediaInternalsAudioLogTest, testing::Values( |
| 304 media::AudioLogFactory::AUDIO_INPUT_CONTROLLER, | 304 media::AudioLogFactory::AUDIO_INPUT_CONTROLLER, |
| 305 media::AudioLogFactory::AUDIO_OUTPUT_CONTROLLER, | 305 media::AudioLogFactory::AUDIO_OUTPUT_CONTROLLER, |
| 306 media::AudioLogFactory::AUDIO_OUTPUT_STREAM)); | 306 media::AudioLogFactory::AUDIO_OUTPUT_STREAM)); |
| 307 | 307 |
| 308 } // namespace content | 308 } // namespace content |
| OLD | NEW |