| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 "chrome/browser/media/webrtc/webrtc_browsertest_base.h" | 5 #include "chrome/browser/media/webrtc/webrtc_browsertest_base.h" |
| 6 | 6 |
| 7 #include <stddef.h> | 7 #include <stddef.h> |
| 8 | 8 |
| 9 #include <limits> | 9 #include <limits> |
| 10 | 10 |
| (...skipping 441 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 452 } | 452 } |
| 453 | 453 |
| 454 bool WebRtcTestBase::WaitForVideoToPlay( | 454 bool WebRtcTestBase::WaitForVideoToPlay( |
| 455 content::WebContents* tab_contents) const { | 455 content::WebContents* tab_contents) const { |
| 456 bool is_video_playing = test::PollingWaitUntil( | 456 bool is_video_playing = test::PollingWaitUntil( |
| 457 "isVideoPlaying()", "video-playing", tab_contents); | 457 "isVideoPlaying()", "video-playing", tab_contents); |
| 458 EXPECT_TRUE(is_video_playing); | 458 EXPECT_TRUE(is_video_playing); |
| 459 return is_video_playing; | 459 return is_video_playing; |
| 460 } | 460 } |
| 461 | 461 |
| 462 void WebRtcTestBase::CheckVideoFormat(content::WebContents* tab_contents, |
| 463 std::string const& format) const { |
| 464 std::string javascript = |
| 465 base::StringPrintf("checkVideoFormat('%s')", format.c_str()); |
| 466 EXPECT_EQ("ok-correct-format", ExecuteJavascript(javascript, tab_contents)); |
| 467 } |
| 468 |
| 462 std::string WebRtcTestBase::GetStreamSize( | 469 std::string WebRtcTestBase::GetStreamSize( |
| 463 content::WebContents* tab_contents, | 470 content::WebContents* tab_contents, |
| 464 const std::string& video_element) const { | 471 const std::string& video_element) const { |
| 465 std::string javascript = | 472 std::string javascript = |
| 466 base::StringPrintf("getStreamSize('%s')", video_element.c_str()); | 473 base::StringPrintf("getStreamSize('%s')", video_element.c_str()); |
| 467 std::string result = ExecuteJavascript(javascript, tab_contents); | 474 std::string result = ExecuteJavascript(javascript, tab_contents); |
| 468 EXPECT_TRUE(base::StartsWith(result, "ok-", base::CompareCase::SENSITIVE)); | 475 EXPECT_TRUE(base::StartsWith(result, "ok-", base::CompareCase::SENSITIVE)); |
| 469 return result.substr(3); | 476 return result.substr(3); |
| 470 } | 477 } |
| 471 | 478 |
| (...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 588 | 595 |
| 589 void WebRtcTestBase::VerifyRtpReceivers( | 596 void WebRtcTestBase::VerifyRtpReceivers( |
| 590 content::WebContents* tab, | 597 content::WebContents* tab, |
| 591 base::Optional<size_t> expected_num_tracks) const { | 598 base::Optional<size_t> expected_num_tracks) const { |
| 592 std::string javascript = | 599 std::string javascript = |
| 593 expected_num_tracks ? "verifyRtpReceivers(" + | 600 expected_num_tracks ? "verifyRtpReceivers(" + |
| 594 base::SizeTToString(*expected_num_tracks) + ")" | 601 base::SizeTToString(*expected_num_tracks) + ")" |
| 595 : "verifyRtpReceivers()"; | 602 : "verifyRtpReceivers()"; |
| 596 EXPECT_EQ("ok-receivers-verified", ExecuteJavascript(javascript, tab)); | 603 EXPECT_EQ("ok-receivers-verified", ExecuteJavascript(javascript, tab)); |
| 597 } | 604 } |
| OLD | NEW |