| 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_browsertest_base.h" | 5 #include "chrome/browser/media/webrtc_browsertest_base.h" |
| 6 | 6 |
| 7 #include <stddef.h> | 7 #include <stddef.h> |
| 8 | 8 |
| 9 #include "base/lazy_instance.h" | 9 #include "base/lazy_instance.h" |
| 10 #include "base/macros.h" | 10 #include "base/macros.h" |
| (...skipping 410 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 421 std::string WebRtcTestBase::GetStreamSize( | 421 std::string WebRtcTestBase::GetStreamSize( |
| 422 content::WebContents* tab_contents, | 422 content::WebContents* tab_contents, |
| 423 const std::string& video_element) const { | 423 const std::string& video_element) const { |
| 424 std::string javascript = | 424 std::string javascript = |
| 425 base::StringPrintf("getStreamSize('%s')", video_element.c_str()); | 425 base::StringPrintf("getStreamSize('%s')", video_element.c_str()); |
| 426 std::string result = ExecuteJavascript(javascript, tab_contents); | 426 std::string result = ExecuteJavascript(javascript, tab_contents); |
| 427 EXPECT_TRUE(base::StartsWith(result, "ok-", base::CompareCase::SENSITIVE)); | 427 EXPECT_TRUE(base::StartsWith(result, "ok-", base::CompareCase::SENSITIVE)); |
| 428 return result.substr(3); | 428 return result.substr(3); |
| 429 } | 429 } |
| 430 | 430 |
| 431 bool WebRtcTestBase::HasWebcamAvailableOnSystem( | |
| 432 content::WebContents* tab_contents) const { | |
| 433 std::string result = | |
| 434 ExecuteJavascript("hasVideoInputDeviceOnSystem();", tab_contents); | |
| 435 return result == "has-video-input-device"; | |
| 436 } | |
| 437 | |
| 438 bool WebRtcTestBase::OnWin8() const { | 431 bool WebRtcTestBase::OnWin8() const { |
| 439 #if defined(OS_WIN) | 432 #if defined(OS_WIN) |
| 440 return base::win::GetVersion() > base::win::VERSION_WIN7; | 433 return base::win::GetVersion() > base::win::VERSION_WIN7; |
| 441 #else | 434 #else |
| 442 return false; | 435 return false; |
| 443 #endif | 436 #endif |
| 444 } | 437 } |
| 445 | 438 |
| 446 void WebRtcTestBase::OpenDatabase(content::WebContents* tab) const { | 439 void WebRtcTestBase::OpenDatabase(content::WebContents* tab) const { |
| 447 EXPECT_EQ("ok-database-opened", ExecuteJavascript("openDatabase()", tab)); | 440 EXPECT_EQ("ok-database-opened", ExecuteJavascript("openDatabase()", tab)); |
| (...skipping 21 matching lines...) Expand all Loading... |
| 469 void WebRtcTestBase::SetDefaultVideoCodec( | 462 void WebRtcTestBase::SetDefaultVideoCodec( |
| 470 content::WebContents* tab, | 463 content::WebContents* tab, |
| 471 const std::string& video_codec) const { | 464 const std::string& video_codec) const { |
| 472 EXPECT_EQ("ok-forced", | 465 EXPECT_EQ("ok-forced", |
| 473 ExecuteJavascript("forceVideoCodec('" + video_codec + "')", tab)); | 466 ExecuteJavascript("forceVideoCodec('" + video_codec + "')", tab)); |
| 474 } | 467 } |
| 475 | 468 |
| 476 void WebRtcTestBase::EnableOpusDtx(content::WebContents* tab) const { | 469 void WebRtcTestBase::EnableOpusDtx(content::WebContents* tab) const { |
| 477 EXPECT_EQ("ok-forced", ExecuteJavascript("forceOpusDtx()", tab)); | 470 EXPECT_EQ("ok-forced", ExecuteJavascript("forceOpusDtx()", tab)); |
| 478 } | 471 } |
| OLD | NEW |