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

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

Issue 137753004: Renaming remaining WebRTC browser tests. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 11 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 | « chrome/browser/media/chrome_webrtc_video_quality_browsertest.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. 1 // Copyright (c) 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 "base/command_line.h" 5 #include "base/command_line.h"
6 #include "base/json/json_reader.h" 6 #include "base/json/json_reader.h"
7 #include "base/strings/utf_string_conversions.h" 7 #include "base/strings/utf_string_conversions.h"
8 #include "base/time/time.h" 8 #include "base/time/time.h"
9 #include "base/values.h" 9 #include "base/values.h"
10 #include "content/public/common/content_switches.h" 10 #include "content/public/common/content_switches.h"
(...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after
133 int rid; 133 int rid;
134 std::string origin; 134 std::string origin;
135 std::string audio_constraints; 135 std::string audio_constraints;
136 std::string video_constraints; 136 std::string video_constraints;
137 }; 137 };
138 138
139 static const int64 FAKE_TIME_STAMP = 3600000; 139 static const int64 FAKE_TIME_STAMP = 3600000;
140 140
141 #if defined(OS_WIN) 141 #if defined(OS_WIN)
142 // All tests are flaky on Windows: crbug.com/277322. 142 // All tests are flaky on Windows: crbug.com/277322.
143 #define MAYBE_WebRTCInternalsBrowserTest DISABLED_WebRTCInternalsBrowserTest 143 #define MAYBE_WebRtcInternalsBrowserTest DISABLED_WebRtcInternalsBrowserTest
144 #else 144 #else
145 #define MAYBE_WebRTCInternalsBrowserTest WebRTCInternalsBrowserTest 145 #define MAYBE_WebRtcInternalsBrowserTest WebRtcInternalsBrowserTest
146 #endif 146 #endif
147 147
148 class MAYBE_WebRTCInternalsBrowserTest: public ContentBrowserTest { 148 class MAYBE_WebRtcInternalsBrowserTest: public ContentBrowserTest {
149 public: 149 public:
150 MAYBE_WebRTCInternalsBrowserTest() {} 150 MAYBE_WebRtcInternalsBrowserTest() {}
151 virtual ~MAYBE_WebRTCInternalsBrowserTest() {} 151 virtual ~MAYBE_WebRtcInternalsBrowserTest() {}
152 152
153 virtual void SetUpOnMainThread() OVERRIDE { 153 virtual void SetUpOnMainThread() OVERRIDE {
154 // We need fake devices in this test since we want to run on naked VMs. We 154 // We need fake devices in this test since we want to run on naked VMs. We
155 // assume these switches are set by default in content_browsertests. 155 // assume these switches are set by default in content_browsertests.
156 ASSERT_TRUE(CommandLine::ForCurrentProcess()->HasSwitch( 156 ASSERT_TRUE(CommandLine::ForCurrentProcess()->HasSwitch(
157 switches::kUseFakeDeviceForMediaStream)); 157 switches::kUseFakeDeviceForMediaStream));
158 ASSERT_TRUE(CommandLine::ForCurrentProcess()->HasSwitch( 158 ASSERT_TRUE(CommandLine::ForCurrentProcess()->HasSwitch(
159 switches::kUseFakeUIForMediaStream)); 159 switches::kUseFakeUIForMediaStream));
160 } 160 }
161 161
(...skipping 307 matching lines...) Expand 10 before | Expand all | Expand 10 after
469 value = NULL; 469 value = NULL;
470 pc_dump->Get("stats", &value); 470 pc_dump->Get("stats", &value);
471 EXPECT_EQ(base::Value::TYPE_DICTIONARY, value->GetType()); 471 EXPECT_EQ(base::Value::TYPE_DICTIONARY, value->GetType());
472 472
473 base::DictionaryValue* dataSeries = 473 base::DictionaryValue* dataSeries =
474 static_cast<base::DictionaryValue*>(value); 474 static_cast<base::DictionaryValue*>(value);
475 EXPECT_EQ(stats.values.size(), dataSeries->size()); 475 EXPECT_EQ(stats.values.size(), dataSeries->size());
476 } 476 }
477 }; 477 };
478 478
479 IN_PROC_BROWSER_TEST_F(MAYBE_WebRTCInternalsBrowserTest, 479 IN_PROC_BROWSER_TEST_F(MAYBE_WebRtcInternalsBrowserTest,
480 AddAndRemovePeerConnection) { 480 AddAndRemovePeerConnection) {
481 GURL url("chrome://webrtc-internals"); 481 GURL url("chrome://webrtc-internals");
482 NavigateToURL(shell(), url); 482 NavigateToURL(shell(), url);
483 483
484 // Add two PeerConnections and then remove them. 484 // Add two PeerConnections and then remove them.
485 PeerConnectionEntry pc_1(1, 0); 485 PeerConnectionEntry pc_1(1, 0);
486 ExecuteAddPeerConnectionJs(pc_1); 486 ExecuteAddPeerConnectionJs(pc_1);
487 VerifyPeerConnectionEntry(pc_1); 487 VerifyPeerConnectionEntry(pc_1);
488 488
489 PeerConnectionEntry pc_2(2, 1); 489 PeerConnectionEntry pc_2(2, 1);
490 ExecuteAddPeerConnectionJs(pc_2); 490 ExecuteAddPeerConnectionJs(pc_2);
491 VerifyPeerConnectionEntry(pc_2); 491 VerifyPeerConnectionEntry(pc_2);
492 492
493 ExecuteRemovePeerConnectionJs(pc_1); 493 ExecuteRemovePeerConnectionJs(pc_1);
494 VerifyNoElementWithId(pc_1.getIdString()); 494 VerifyNoElementWithId(pc_1.getIdString());
495 VerifyPeerConnectionEntry(pc_2); 495 VerifyPeerConnectionEntry(pc_2);
496 496
497 ExecuteRemovePeerConnectionJs(pc_2); 497 ExecuteRemovePeerConnectionJs(pc_2);
498 VerifyNoElementWithId(pc_2.getIdString()); 498 VerifyNoElementWithId(pc_2.getIdString());
499 } 499 }
500 500
501 IN_PROC_BROWSER_TEST_F(MAYBE_WebRTCInternalsBrowserTest, 501 IN_PROC_BROWSER_TEST_F(MAYBE_WebRtcInternalsBrowserTest,
502 UpdateAllPeerConnections) { 502 UpdateAllPeerConnections) {
503 GURL url("chrome://webrtc-internals"); 503 GURL url("chrome://webrtc-internals");
504 NavigateToURL(shell(), url); 504 NavigateToURL(shell(), url);
505 505
506 PeerConnectionEntry pc_0(1, 0); 506 PeerConnectionEntry pc_0(1, 0);
507 pc_0.AddEvent("e1", "v1"); 507 pc_0.AddEvent("e1", "v1");
508 pc_0.AddEvent("e2", "v2"); 508 pc_0.AddEvent("e2", "v2");
509 PeerConnectionEntry pc_1(1, 1); 509 PeerConnectionEntry pc_1(1, 1);
510 pc_1.AddEvent("e3", "v3"); 510 pc_1.AddEvent("e3", "v3");
511 pc_1.AddEvent("e4", "v4"); 511 pc_1.AddEvent("e4", "v4");
512 string pc_array = "[" + pc_0.getAllUpdateString() + ", " + 512 string pc_array = "[" + pc_0.getAllUpdateString() + ", " +
513 pc_1.getAllUpdateString() + "]"; 513 pc_1.getAllUpdateString() + "]";
514 EXPECT_TRUE(ExecuteJavascript("updateAllPeerConnections(" + pc_array + ");")); 514 EXPECT_TRUE(ExecuteJavascript("updateAllPeerConnections(" + pc_array + ");"));
515 VerifyPeerConnectionEntry(pc_0); 515 VerifyPeerConnectionEntry(pc_0);
516 VerifyPeerConnectionEntry(pc_1); 516 VerifyPeerConnectionEntry(pc_1);
517 } 517 }
518 518
519 IN_PROC_BROWSER_TEST_F(MAYBE_WebRTCInternalsBrowserTest, UpdatePeerConnection) { 519 IN_PROC_BROWSER_TEST_F(MAYBE_WebRtcInternalsBrowserTest, UpdatePeerConnection) {
520 GURL url("chrome://webrtc-internals"); 520 GURL url("chrome://webrtc-internals");
521 NavigateToURL(shell(), url); 521 NavigateToURL(shell(), url);
522 522
523 // Add one PeerConnection and send one update. 523 // Add one PeerConnection and send one update.
524 PeerConnectionEntry pc_1(1, 0); 524 PeerConnectionEntry pc_1(1, 0);
525 ExecuteAddPeerConnectionJs(pc_1); 525 ExecuteAddPeerConnectionJs(pc_1);
526 526
527 ExecuteAndVerifyUpdatePeerConnection(pc_1, "e1", "v1"); 527 ExecuteAndVerifyUpdatePeerConnection(pc_1, "e1", "v1");
528 528
529 // Add another PeerConnection and send two updates. 529 // Add another PeerConnection and send two updates.
(...skipping 16 matching lines...) Expand all
546 EXPECT_EQ(ssrc1.GetAsJSON(), GetSsrcInfo(ssrc1.id)); 546 EXPECT_EQ(ssrc1.GetAsJSON(), GetSsrcInfo(ssrc1.id));
547 EXPECT_EQ(ssrc2.GetAsJSON(), GetSsrcInfo(ssrc2.id)); 547 EXPECT_EQ(ssrc2.GetAsJSON(), GetSsrcInfo(ssrc2.id));
548 548
549 StatsUnit stats = {FAKE_TIME_STAMP}; 549 StatsUnit stats = {FAKE_TIME_STAMP};
550 stats.values["ssrc"] = ssrc1.id; 550 stats.values["ssrc"] = ssrc1.id;
551 ExecuteAndVerifyAddStats(pc_2, "ssrc", "dummyId", stats); 551 ExecuteAndVerifyAddStats(pc_2, "ssrc", "dummyId", stats);
552 EXPECT_GT(GetSsrcInfoBlockCount(shell()), 0); 552 EXPECT_GT(GetSsrcInfoBlockCount(shell()), 0);
553 } 553 }
554 554
555 // Tests that adding random named stats updates the dataSeries and graphs. 555 // Tests that adding random named stats updates the dataSeries and graphs.
556 IN_PROC_BROWSER_TEST_F(MAYBE_WebRTCInternalsBrowserTest, AddStats) { 556 IN_PROC_BROWSER_TEST_F(MAYBE_WebRtcInternalsBrowserTest, AddStats) {
557 GURL url("chrome://webrtc-internals"); 557 GURL url("chrome://webrtc-internals");
558 NavigateToURL(shell(), url); 558 NavigateToURL(shell(), url);
559 559
560 PeerConnectionEntry pc(1, 0); 560 PeerConnectionEntry pc(1, 0);
561 ExecuteAddPeerConnectionJs(pc); 561 ExecuteAddPeerConnectionJs(pc);
562 562
563 const string type = "ssrc"; 563 const string type = "ssrc";
564 const string id = "ssrc-1234"; 564 const string id = "ssrc-1234";
565 StatsUnit stats = {FAKE_TIME_STAMP}; 565 StatsUnit stats = {FAKE_TIME_STAMP};
566 stats.values["trackId"] = "abcd"; 566 stats.values["trackId"] = "abcd";
567 stats.values["bitrate"] = "2000"; 567 stats.values["bitrate"] = "2000";
568 stats.values["framerate"] = "30"; 568 stats.values["framerate"] = "30";
569 569
570 // Add new stats and verify the stats table and graphs. 570 // Add new stats and verify the stats table and graphs.
571 ExecuteAndVerifyAddStats(pc, type, id, stats); 571 ExecuteAndVerifyAddStats(pc, type, id, stats);
572 VerifyStatsGraph(pc); 572 VerifyStatsGraph(pc);
573 573
574 // Update existing stats and verify the stats table and graphs. 574 // Update existing stats and verify the stats table and graphs.
575 stats.values["bitrate"] = "2001"; 575 stats.values["bitrate"] = "2001";
576 stats.values["framerate"] = "31"; 576 stats.values["framerate"] = "31";
577 ExecuteAndVerifyAddStats(pc, type, id, stats); 577 ExecuteAndVerifyAddStats(pc, type, id, stats);
578 VerifyStatsGraph(pc); 578 VerifyStatsGraph(pc);
579 } 579 }
580 580
581 // Tests that the bandwidth estimation values are drawn on a single graph. 581 // Tests that the bandwidth estimation values are drawn on a single graph.
582 IN_PROC_BROWSER_TEST_F(MAYBE_WebRTCInternalsBrowserTest, BweCompoundGraph) { 582 IN_PROC_BROWSER_TEST_F(MAYBE_WebRtcInternalsBrowserTest, BweCompoundGraph) {
583 GURL url("chrome://webrtc-internals"); 583 GURL url("chrome://webrtc-internals");
584 NavigateToURL(shell(), url); 584 NavigateToURL(shell(), url);
585 585
586 PeerConnectionEntry pc(1, 0); 586 PeerConnectionEntry pc(1, 0);
587 ExecuteAddPeerConnectionJs(pc); 587 ExecuteAddPeerConnectionJs(pc);
588 588
589 StatsUnit stats = {FAKE_TIME_STAMP}; 589 StatsUnit stats = {FAKE_TIME_STAMP};
590 stats.values["googAvailableSendBandwidth"] = "1000000"; 590 stats.values["googAvailableSendBandwidth"] = "1000000";
591 stats.values["googTargetEncBitrate"] = "1000"; 591 stats.values["googTargetEncBitrate"] = "1000";
592 stats.values["googActualEncBitrate"] = "1000000"; 592 stats.values["googActualEncBitrate"] = "1000000";
(...skipping 19 matching lines...) Expand all
612 ASSERT_TRUE(ExecuteScriptAndExtractInt( 612 ASSERT_TRUE(ExecuteScriptAndExtractInt(
613 shell()->web_contents(), 613 shell()->web_contents(),
614 "window.domAutomationController.send(" 614 "window.domAutomationController.send("
615 " graphViews['" + graph_id + "'].getDataSeriesCount())", 615 " graphViews['" + graph_id + "'].getDataSeriesCount())",
616 &count)); 616 &count));
617 EXPECT_EQ((int)stats.values.size(), count); 617 EXPECT_EQ((int)stats.values.size(), count);
618 } 618 }
619 619
620 // Tests that the total packet/byte count is converted to count per second, 620 // Tests that the total packet/byte count is converted to count per second,
621 // and the converted data is drawn. 621 // and the converted data is drawn.
622 IN_PROC_BROWSER_TEST_F(MAYBE_WebRTCInternalsBrowserTest, ConvertedGraphs) { 622 IN_PROC_BROWSER_TEST_F(MAYBE_WebRtcInternalsBrowserTest, ConvertedGraphs) {
623 GURL url("chrome://webrtc-internals"); 623 GURL url("chrome://webrtc-internals");
624 NavigateToURL(shell(), url); 624 NavigateToURL(shell(), url);
625 625
626 PeerConnectionEntry pc(1, 0); 626 PeerConnectionEntry pc(1, 0);
627 ExecuteAddPeerConnectionJs(pc); 627 ExecuteAddPeerConnectionJs(pc);
628 628
629 const string stats_type = "s"; 629 const string stats_type = "s";
630 const string stats_id = "1"; 630 const string stats_id = "1";
631 const int num_converted_stats = 4; 631 const int num_converted_stats = 4;
632 const string stats_names[] = 632 const string stats_names[] =
(...skipping 21 matching lines...) Expand all
654 // Verifies the graph data matches converted_values. 654 // Verifies the graph data matches converted_values.
655 for (int i = 0; i < num_converted_stats; ++i) { 655 for (int i = 0; i < num_converted_stats; ++i) {
656 VerifyGraphDataPoint(pc.getIdString(), stats_id + "-" + converted_names[i], 656 VerifyGraphDataPoint(pc.getIdString(), stats_id + "-" + converted_names[i],
657 1, converted_values[i]); 657 1, converted_values[i]);
658 } 658 }
659 } 659 }
660 660
661 // Timing out on ARM linux bot: http://crbug.com/238490 661 // Timing out on ARM linux bot: http://crbug.com/238490
662 // Disabling due to failure on Linux, Mac, Win: http://crbug.com/272413 662 // Disabling due to failure on Linux, Mac, Win: http://crbug.com/272413
663 // Sanity check of the page content under a real PeerConnection call. 663 // Sanity check of the page content under a real PeerConnection call.
664 IN_PROC_BROWSER_TEST_F(MAYBE_WebRTCInternalsBrowserTest, 664 IN_PROC_BROWSER_TEST_F(MAYBE_WebRtcInternalsBrowserTest,
665 DISABLED_WithRealPeerConnectionCall) { 665 DISABLED_WithRealPeerConnectionCall) {
666 // Start a peerconnection call in the first window. 666 // Start a peerconnection call in the first window.
667 ASSERT_TRUE(embedded_test_server()->InitializeAndWaitUntilReady()); 667 ASSERT_TRUE(embedded_test_server()->InitializeAndWaitUntilReady());
668 GURL url(embedded_test_server()->GetURL("/media/peerconnection-call.html")); 668 GURL url(embedded_test_server()->GetURL("/media/peerconnection-call.html"));
669 NavigateToURL(shell(), url); 669 NavigateToURL(shell(), url);
670 ASSERT_TRUE(ExecuteJavascript("call({video:true});")); 670 ASSERT_TRUE(ExecuteJavascript("call({video:true});"));
671 ExpectTitle("OK"); 671 ExpectTitle("OK");
672 672
673 // Open webrtc-internals in the second window. 673 // Open webrtc-internals in the second window.
674 GURL url2("chrome://webrtc-internals"); 674 GURL url2("chrome://webrtc-internals");
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after
737 "}" 737 "}"
738 "window.domAutomationController.send(result);", 738 "window.domAutomationController.send(result);",
739 &result)); 739 &result));
740 740
741 EXPECT_TRUE(result); 741 EXPECT_TRUE(result);
742 742
743 count = GetSsrcInfoBlockCount(shell2); 743 count = GetSsrcInfoBlockCount(shell2);
744 EXPECT_GT(count, 0); 744 EXPECT_GT(count, 0);
745 } 745 }
746 746
747 IN_PROC_BROWSER_TEST_F(MAYBE_WebRTCInternalsBrowserTest, CreatePageDump) { 747 IN_PROC_BROWSER_TEST_F(MAYBE_WebRtcInternalsBrowserTest, CreatePageDump) {
748 GURL url("chrome://webrtc-internals"); 748 GURL url("chrome://webrtc-internals");
749 NavigateToURL(shell(), url); 749 NavigateToURL(shell(), url);
750 750
751 PeerConnectionEntry pc_0(1, 0); 751 PeerConnectionEntry pc_0(1, 0);
752 pc_0.AddEvent("e1", "v1"); 752 pc_0.AddEvent("e1", "v1");
753 pc_0.AddEvent("e2", "v2"); 753 pc_0.AddEvent("e2", "v2");
754 PeerConnectionEntry pc_1(1, 1); 754 PeerConnectionEntry pc_1(1, 1);
755 pc_1.AddEvent("e3", "v3"); 755 pc_1.AddEvent("e3", "v3");
756 pc_1.AddEvent("e4", "v4"); 756 pc_1.AddEvent("e4", "v4");
757 string pc_array = 757 string pc_array =
(...skipping 24 matching lines...) Expand all
782 782
783 ASSERT_TRUE(ExecuteScriptAndExtractString( 783 ASSERT_TRUE(ExecuteScriptAndExtractString(
784 shell()->web_contents(), 784 shell()->web_contents(),
785 "window.domAutomationController.send(" 785 "window.domAutomationController.send("
786 "JSON.stringify(peerConnectionDataStore));", 786 "JSON.stringify(peerConnectionDataStore));",
787 &dump_json)); 787 &dump_json));
788 dump.reset(base::JSONReader::Read(dump_json)); 788 dump.reset(base::JSONReader::Read(dump_json));
789 VerifyStatsDump(dump.get(), pc_0, type, id, stats); 789 VerifyStatsDump(dump.get(), pc_0, type, id, stats);
790 } 790 }
791 791
792 IN_PROC_BROWSER_TEST_F(MAYBE_WebRTCInternalsBrowserTest, UpdateGetUserMedia) { 792 IN_PROC_BROWSER_TEST_F(MAYBE_WebRtcInternalsBrowserTest, UpdateGetUserMedia) {
793 GURL url("chrome://webrtc-internals"); 793 GURL url("chrome://webrtc-internals");
794 NavigateToURL(shell(), url); 794 NavigateToURL(shell(), url);
795 795
796 UserMediaRequestEntry request1(1, 1, "origin", "ac", "vc"); 796 UserMediaRequestEntry request1(1, 1, "origin", "ac", "vc");
797 UserMediaRequestEntry request2(2, 2, "origin2", "ac2", "vc2"); 797 UserMediaRequestEntry request2(2, 2, "origin2", "ac2", "vc2");
798 ExecuteAddGetUserMediaJs(request1); 798 ExecuteAddGetUserMediaJs(request1);
799 ExecuteAddGetUserMediaJs(request2); 799 ExecuteAddGetUserMediaJs(request2);
800 800
801 std::vector<UserMediaRequestEntry> list; 801 std::vector<UserMediaRequestEntry> list;
802 list.push_back(request1); 802 list.push_back(request1);
803 list.push_back(request2); 803 list.push_back(request2);
804 VerifyUserMediaRequest(list); 804 VerifyUserMediaRequest(list);
805 805
806 ExecuteRemoveGetUserMediaForRendererJs(1); 806 ExecuteRemoveGetUserMediaForRendererJs(1);
807 list.erase(list.begin()); 807 list.erase(list.begin());
808 VerifyUserMediaRequest(list); 808 VerifyUserMediaRequest(list);
809 809
810 ExecuteRemoveGetUserMediaForRendererJs(2); 810 ExecuteRemoveGetUserMediaForRendererJs(2);
811 list.erase(list.begin()); 811 list.erase(list.begin());
812 VerifyUserMediaRequest(list); 812 VerifyUserMediaRequest(list);
813 } 813 }
814 } // namespace content 814 } // namespace content
OLDNEW
« no previous file with comments | « chrome/browser/media/chrome_webrtc_video_quality_browsertest.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698