Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(417)

Side by Side Diff: content/browser/media/webrtc_getusermedia_browsertest.cc

Issue 197213004: Fix DCHECK error when invalid video constraints are set on gUM. If a video constraint can not be me… (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebased Created 6 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | content/renderer/media/media_stream_video_capturer_source.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 "base/command_line.h" 5 #include "base/command_line.h"
6 #include "base/debug/trace_event_impl.h" 6 #include "base/debug/trace_event_impl.h"
7 #include "base/json/json_reader.h" 7 #include "base/json/json_reader.h"
8 #include "base/strings/stringprintf.h" 8 #include "base/strings/stringprintf.h"
9 #include "base/test/trace_event_analyzer.h" 9 #include "base/test/trace_event_analyzer.h"
10 #include "base/values.h" 10 #include "base/values.h"
(...skipping 277 matching lines...) Expand 10 before | Expand all | Expand 10 after
288 ASSERT_TRUE(embedded_test_server()->InitializeAndWaitUntilReady()); 288 ASSERT_TRUE(embedded_test_server()->InitializeAndWaitUntilReady());
289 289
290 std::vector<std::string> audio_ids; 290 std::vector<std::string> audio_ids;
291 std::vector<std::string> video_ids; 291 std::vector<std::string> video_ids;
292 GetSources(&audio_ids, &video_ids); 292 GetSources(&audio_ids, &video_ids);
293 293
294 GURL url(embedded_test_server()->GetURL("/media/getusermedia.html")); 294 GURL url(embedded_test_server()->GetURL("/media/getusermedia.html"));
295 295
296 // Test with invalid mandatory audio sourceID. 296 // Test with invalid mandatory audio sourceID.
297 NavigateToURL(shell(), url); 297 NavigateToURL(shell(), url);
298 ExecuteJavascriptAndWaitForOk( 298 EXPECT_EQ("DeviceCaptureError", ExecuteJavascriptAndReturnResult(
299 GenerateGetUserMediaWithMandatorySourceID( 299 GenerateGetUserMediaWithMandatorySourceID(
300 kGetUserMediaAndExpectFailure, 300 kGetUserMediaAndExpectFailure,
301 "something invalid", 301 "something invalid",
302 video_ids[0])); 302 video_ids[0])));
303 303
304 // Test with invalid mandatory video sourceID. 304 // Test with invalid mandatory video sourceID.
305 ExecuteJavascriptAndWaitForOk( 305 EXPECT_EQ("DeviceCaptureError", ExecuteJavascriptAndReturnResult(
306 GenerateGetUserMediaWithMandatorySourceID( 306 GenerateGetUserMediaWithMandatorySourceID(
307 kGetUserMediaAndExpectFailure, 307 kGetUserMediaAndExpectFailure,
308 audio_ids[0], 308 audio_ids[0],
309 "something invalid")); 309 "something invalid")));
310 310
311 // Test with empty mandatory audio sourceID. 311 // Test with empty mandatory audio sourceID.
312 ExecuteJavascriptAndWaitForOk( 312 EXPECT_EQ("DeviceCaptureError", ExecuteJavascriptAndReturnResult(
313 GenerateGetUserMediaWithMandatorySourceID( 313 GenerateGetUserMediaWithMandatorySourceID(
314 kGetUserMediaAndExpectFailure, 314 kGetUserMediaAndExpectFailure,
315 "", 315 "",
316 video_ids[0])); 316 video_ids[0])));
317 } 317 }
318 318
319 IN_PROC_BROWSER_TEST_P(WebRtcGetUserMediaBrowserTest, 319 IN_PROC_BROWSER_TEST_P(WebRtcGetUserMediaBrowserTest,
320 GetUserMediaWithInvalidOptionalSourceID) { 320 GetUserMediaWithInvalidOptionalSourceID) {
321 ASSERT_TRUE(embedded_test_server()->InitializeAndWaitUntilReady()); 321 ASSERT_TRUE(embedded_test_server()->InitializeAndWaitUntilReady());
322 322
323 std::vector<std::string> audio_ids; 323 std::vector<std::string> audio_ids;
324 std::vector<std::string> video_ids; 324 std::vector<std::string> video_ids;
325 GetSources(&audio_ids, &video_ids); 325 GetSources(&audio_ids, &video_ids);
326 326
(...skipping 25 matching lines...) Expand all
352 IN_PROC_BROWSER_TEST_P(WebRtcGetUserMediaBrowserTest, TwoGetUserMediaAndStop) { 352 IN_PROC_BROWSER_TEST_P(WebRtcGetUserMediaBrowserTest, TwoGetUserMediaAndStop) {
353 ASSERT_TRUE(embedded_test_server()->InitializeAndWaitUntilReady()); 353 ASSERT_TRUE(embedded_test_server()->InitializeAndWaitUntilReady());
354 354
355 GURL url(embedded_test_server()->GetURL("/media/getusermedia.html")); 355 GURL url(embedded_test_server()->GetURL("/media/getusermedia.html"));
356 NavigateToURL(shell(), url); 356 NavigateToURL(shell(), url);
357 357
358 ExecuteJavascriptAndWaitForOk( 358 ExecuteJavascriptAndWaitForOk(
359 "twoGetUserMediaAndStop({video: true, audio: true});"); 359 "twoGetUserMediaAndStop({video: true, audio: true});");
360 } 360 }
361 361
362 IN_PROC_BROWSER_TEST_P(WebRtcGetUserMediaBrowserTest,
363 GetUserMediaWithTooHighVideoConstraintsValues) {
364 ASSERT_TRUE(embedded_test_server()->InitializeAndWaitUntilReady());
365
366 GURL url(embedded_test_server()->GetURL("/media/getusermedia.html"));
367
368 int large_value = 99999;
369 std::string call = GenerateGetUserMediaCall(kGetUserMediaAndExpectFailure,
370 large_value,
371 large_value,
372 large_value,
373 large_value,
374 large_value,
375 large_value);
376 NavigateToURL(shell(), url);
377
378 // TODO(perkj): A proper error code should be returned by gUM.
379 EXPECT_EQ("TrackStartError", ExecuteJavascriptAndReturnResult(call));
380 }
381
362 // This test will make a simple getUserMedia page, verify that video is playing 382 // This test will make a simple getUserMedia page, verify that video is playing
363 // in a simple local <video>, and for a couple of seconds, collect some 383 // in a simple local <video>, and for a couple of seconds, collect some
364 // performance traces from VideoCaptureController colorspace conversion and 384 // performance traces from VideoCaptureController colorspace conversion and
365 // potential resizing. 385 // potential resizing.
366 IN_PROC_BROWSER_TEST_P( 386 IN_PROC_BROWSER_TEST_P(
367 WebRtcGetUserMediaBrowserTest, 387 WebRtcGetUserMediaBrowserTest,
368 TraceVideoCaptureControllerPerformanceDuringGetUserMedia) { 388 TraceVideoCaptureControllerPerformanceDuringGetUserMedia) {
369 RunGetUserMediaAndCollectMeasures( 389 RunGetUserMediaAndCollectMeasures(
370 10, 390 10,
371 "VideoCaptureController::OnIncomingCapturedData", 391 "VideoCaptureController::OnIncomingCapturedData",
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after
456 {640, 640, 480, 480, 30, 30}, 476 {640, 640, 480, 480, 30, 30},
457 {960, 960, 720, 720, 30, 30}, 477 {960, 960, 720, 720, 30, 30},
458 {1280, 1280, 720, 720, 30, 30}, 478 {1280, 1280, 720, 720, 30, 30},
459 {1920, 1920, 1080, 1080, 30, 30}}; 479 {1920, 1920, 1080, 1080, 30, 30}};
460 480
461 INSTANTIATE_TEST_CASE_P(UserMedia, 481 INSTANTIATE_TEST_CASE_P(UserMedia,
462 WebRtcConstraintsBrowserTest, 482 WebRtcConstraintsBrowserTest,
463 testing::ValuesIn(kAllUserMediaSizes)); 483 testing::ValuesIn(kAllUserMediaSizes));
464 484
465 } // namespace content 485 } // namespace content
OLDNEW
« no previous file with comments | « no previous file | content/renderer/media/media_stream_video_capturer_source.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698