Chromium Code Reviews| 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 285 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 296 std::string WebRtcTestBase::ExecuteJavascript( | 296 std::string WebRtcTestBase::ExecuteJavascript( |
| 297 const std::string& javascript, | 297 const std::string& javascript, |
| 298 content::WebContents* tab_contents) const { | 298 content::WebContents* tab_contents) const { |
| 299 std::string result; | 299 std::string result; |
| 300 EXPECT_TRUE(content::ExecuteScriptAndExtractString( | 300 EXPECT_TRUE(content::ExecuteScriptAndExtractString( |
| 301 tab_contents, javascript, &result)); | 301 tab_contents, javascript, &result)); |
| 302 return result; | 302 return result; |
| 303 } | 303 } |
| 304 | 304 |
| 305 void WebRtcTestBase::SetupPeerconnectionWithLocalStream( | 305 void WebRtcTestBase::SetupPeerconnectionWithLocalStream( |
| 306 content::WebContents* tab) const { | 306 content::WebContents* tab, |
| 307 SetupPeerconnectionWithoutLocalStream(tab); | 307 std::string certificate_keygen_algorithm) const { |
| 308 SetupPeerconnectionWithoutLocalStream(tab, certificate_keygen_algorithm); | |
| 308 EXPECT_EQ("ok-added", ExecuteJavascript("addLocalStream()", tab)); | 309 EXPECT_EQ("ok-added", ExecuteJavascript("addLocalStream()", tab)); |
| 309 } | 310 } |
| 310 | 311 |
| 311 void WebRtcTestBase::SetupPeerconnectionWithoutLocalStream( | 312 void WebRtcTestBase::SetupPeerconnectionWithoutLocalStream( |
| 312 content::WebContents* tab) const { | 313 content::WebContents* tab, |
| 314 std::string certificate_keygen_algorithm) const { | |
| 315 if (certificate_keygen_algorithm.empty()) | |
| 316 certificate_keygen_algorithm = "null"; | |
|
phoglund_chromium
2016/04/26 11:54:20
I would prefer if you made "null" the default inst
hbos_chromium
2016/04/27 11:19:03
Done.
| |
| 317 std::string javascript = base::StringPrintf( | |
| 318 "preparePeerConnection(%s)", certificate_keygen_algorithm.c_str()); | |
| 313 EXPECT_EQ("ok-peerconnection-created", | 319 EXPECT_EQ("ok-peerconnection-created", |
| 314 ExecuteJavascript("preparePeerConnection()", tab)); | 320 ExecuteJavascript(javascript, tab)); |
| 315 } | 321 } |
| 316 | 322 |
| 317 std::string WebRtcTestBase::CreateLocalOffer( | 323 std::string WebRtcTestBase::CreateLocalOffer( |
| 318 content::WebContents* from_tab, | 324 content::WebContents* from_tab, |
| 319 std::string default_video_codec) const { | 325 std::string default_video_codec) const { |
| 320 if (default_video_codec.empty()) | 326 if (default_video_codec.empty()) |
| 321 default_video_codec = "null"; | 327 default_video_codec = "null"; |
| 322 else | 328 else |
| 323 default_video_codec = "'" + default_video_codec + "'"; | 329 default_video_codec = "'" + default_video_codec + "'"; |
| 324 std::string javascript = base::StringPrintf( | 330 std::string javascript = base::StringPrintf( |
| (...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 438 #endif | 444 #endif |
| 439 } | 445 } |
| 440 | 446 |
| 441 bool WebRtcTestBase::OnWin8() const { | 447 bool WebRtcTestBase::OnWin8() const { |
| 442 #if defined(OS_WIN) | 448 #if defined(OS_WIN) |
| 443 return base::win::GetVersion() > base::win::VERSION_WIN7; | 449 return base::win::GetVersion() > base::win::VERSION_WIN7; |
| 444 #else | 450 #else |
| 445 return false; | 451 return false; |
| 446 #endif | 452 #endif |
| 447 } | 453 } |
| OLD | NEW |