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

Side by Side Diff: chrome/browser/media/webrtc_browsertest_base.cc

Issue 1962673002: WebRtcBrowserTest prep-CL for IndexedDB cloning of RTCCertificate. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Addressed nits Created 4 years, 7 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
« no previous file with comments | « chrome/browser/media/webrtc_browsertest_base.h ('k') | chrome/test/data/webrtc/indexeddb.js » ('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 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 288 matching lines...) Expand 10 before | Expand all | Expand 10 after
299 const std::string& javascript, 299 const std::string& javascript,
300 content::WebContents* tab_contents) const { 300 content::WebContents* tab_contents) const {
301 std::string result; 301 std::string result;
302 EXPECT_TRUE(content::ExecuteScriptAndExtractString( 302 EXPECT_TRUE(content::ExecuteScriptAndExtractString(
303 tab_contents, javascript, &result)); 303 tab_contents, javascript, &result));
304 return result; 304 return result;
305 } 305 }
306 306
307 void WebRtcTestBase::SetupPeerconnectionWithLocalStream( 307 void WebRtcTestBase::SetupPeerconnectionWithLocalStream(
308 content::WebContents* tab, 308 content::WebContents* tab,
309 std::string certificate_keygen_algorithm) const { 309 const std::string& certificate_keygen_algorithm) const {
310 SetupPeerconnectionWithoutLocalStream(tab, certificate_keygen_algorithm); 310 SetupPeerconnectionWithoutLocalStream(tab, certificate_keygen_algorithm);
311 EXPECT_EQ("ok-added", ExecuteJavascript("addLocalStream()", tab)); 311 EXPECT_EQ("ok-added", ExecuteJavascript("addLocalStream()", tab));
312 } 312 }
313 313
314 void WebRtcTestBase::SetupPeerconnectionWithoutLocalStream( 314 void WebRtcTestBase::SetupPeerconnectionWithoutLocalStream(
315 content::WebContents* tab, 315 content::WebContents* tab,
316 std::string certificate_keygen_algorithm) const { 316 const std::string& certificate_keygen_algorithm) const {
317 std::string javascript = base::StringPrintf( 317 std::string javascript = base::StringPrintf(
318 "preparePeerConnection(%s)", certificate_keygen_algorithm.c_str()); 318 "preparePeerConnection(%s)", certificate_keygen_algorithm.c_str());
319 EXPECT_EQ("ok-peerconnection-created", 319 EXPECT_EQ("ok-peerconnection-created", ExecuteJavascript(javascript, tab));
320 ExecuteJavascript(javascript, tab)); 320 }
321
322 void WebRtcTestBase::SetupPeerconnectionWithCertificateAndLocalStream(
323 content::WebContents* tab,
324 const std::string& certificate) const {
325 SetupPeerconnectionWithCertificateWithoutLocalStream(tab, certificate);
326 EXPECT_EQ("ok-added", ExecuteJavascript("addLocalStream()", tab));
327 }
328
329 void WebRtcTestBase::SetupPeerconnectionWithCertificateWithoutLocalStream(
330 content::WebContents* tab,
331 const std::string& certificate) const {
332 std::string javascript = base::StringPrintf(
333 "preparePeerConnectionWithCertificate(%s)", certificate.c_str());
334 EXPECT_EQ("ok-peerconnection-created", ExecuteJavascript(javascript, tab));
321 } 335 }
322 336
323 std::string WebRtcTestBase::CreateLocalOffer( 337 std::string WebRtcTestBase::CreateLocalOffer(
324 content::WebContents* from_tab, 338 content::WebContents* from_tab,
325 std::string default_video_codec) const { 339 std::string default_video_codec) const {
326 if (default_video_codec.empty()) 340 if (default_video_codec.empty())
327 default_video_codec = "null"; 341 default_video_codec = "null";
328 else 342 else
329 default_video_codec = "'" + default_video_codec + "'"; 343 default_video_codec = "'" + default_video_codec + "'";
330 std::string javascript = base::StringPrintf( 344 std::string javascript = base::StringPrintf(
(...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after
444 #endif 458 #endif
445 } 459 }
446 460
447 bool WebRtcTestBase::OnWin8() const { 461 bool WebRtcTestBase::OnWin8() const {
448 #if defined(OS_WIN) 462 #if defined(OS_WIN)
449 return base::win::GetVersion() > base::win::VERSION_WIN7; 463 return base::win::GetVersion() > base::win::VERSION_WIN7;
450 #else 464 #else
451 return false; 465 return false;
452 #endif 466 #endif
453 } 467 }
468
469 void WebRtcTestBase::OpenDatabase(content::WebContents* tab) const {
470 std::string response = ExecuteJavascript("openDatabase()", tab);
471 EXPECT_EQ("ok-database-opened", response) << "Failed to open database: "
472 << response;
473 }
474
475 void WebRtcTestBase::CloseDatabase(content::WebContents* tab) const {
476 std::string response = ExecuteJavascript("closeDatabase()", tab);
477 EXPECT_EQ("ok-database-closed", response) << "Failed to close database: "
478 << response;
479 }
480
481 void WebRtcTestBase::DeleteDatabase(content::WebContents* tab) const {
482 std::string response = ExecuteJavascript("deleteDatabase()", tab);
483 EXPECT_EQ("ok-database-deleted", response) << "Failed to delete database: "
484 << response;
485 }
486
487 void WebRtcTestBase::GenerateAndCloneCertificate(
488 content::WebContents* tab, const std::string& keygen_algorithm) const {
489 std::string javascript = base::StringPrintf(
490 "generateAndCloneCertificate(%s)", keygen_algorithm.c_str());
491 std::string response = ExecuteJavascript(javascript, tab);
492 EXPECT_EQ("ok-generated-and-cloned", response) << "Failed to generate and "
493 "clone certificate: " << response;
494 }
OLDNEW
« no previous file with comments | « chrome/browser/media/webrtc_browsertest_base.h ('k') | chrome/test/data/webrtc/indexeddb.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698