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

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

Issue 1959333002: RTCCertificate serialization - persistent storage in IndexedDB. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: return nullptr; 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 | « no previous file | third_party/WebKit/Source/bindings/core/v8/SerializationTag.h » ('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 "base/command_line.h" 5 #include "base/command_line.h"
6 #include "base/strings/stringprintf.h" 6 #include "base/strings/stringprintf.h"
7 #include "build/build_config.h" 7 #include "build/build_config.h"
8 #include "chrome/browser/media/webrtc_browsertest_base.h" 8 #include "chrome/browser/media/webrtc_browsertest_base.h"
9 #include "chrome/browser/media/webrtc_browsertest_common.h" 9 #include "chrome/browser/media/webrtc_browsertest_common.h"
10 #include "chrome/browser/ui/browser.h" 10 #include "chrome/browser/ui/browser.h"
(...skipping 16 matching lines...) Expand all
27 "{ name: \"RSASSA-PKCS1-v1_5\", modulusLength: 2048, publicExponent: " 27 "{ name: \"RSASSA-PKCS1-v1_5\", modulusLength: 2048, publicExponent: "
28 "new Uint8Array([1, 0, 1]), hash: \"SHA-256\" }"; 28 "new Uint8Array([1, 0, 1]), hash: \"SHA-256\" }";
29 static const char kKeygenAlgorithmEcdsa[] = 29 static const char kKeygenAlgorithmEcdsa[] =
30 "{ name: \"ECDSA\", namedCurve: \"P-256\" }"; 30 "{ name: \"ECDSA\", namedCurve: \"P-256\" }";
31 31
32 // Top-level integration test for WebRTC. It always uses fake devices; see 32 // Top-level integration test for WebRTC. It always uses fake devices; see
33 // WebRtcWebcamBrowserTest for a test that acquires any real webcam on the 33 // WebRtcWebcamBrowserTest for a test that acquires any real webcam on the
34 // system. 34 // system.
35 class WebRtcBrowserTest : public WebRtcTestBase { 35 class WebRtcBrowserTest : public WebRtcTestBase {
36 public: 36 public:
37 WebRtcBrowserTest() : left_tab_(nullptr), right_tab_(nullptr) {}
38
37 void SetUpInProcessBrowserTestFixture() override { 39 void SetUpInProcessBrowserTestFixture() override {
38 DetectErrorsInJavaScript(); // Look for errors in our rather complex js. 40 DetectErrorsInJavaScript(); // Look for errors in our rather complex js.
39 } 41 }
40 42
41 void SetUpCommandLine(base::CommandLine* command_line) override { 43 void SetUpCommandLine(base::CommandLine* command_line) override {
42 // Ensure the infobar is enabled, since we expect that in this test. 44 // Ensure the infobar is enabled, since we expect that in this test.
43 EXPECT_FALSE(command_line->HasSwitch(switches::kUseFakeUIForMediaStream)); 45 EXPECT_FALSE(command_line->HasSwitch(switches::kUseFakeUIForMediaStream));
44 46
45 // Always use fake devices. 47 // Always use fake devices.
46 command_line->AppendSwitch(switches::kUseFakeDeviceForMediaStream); 48 command_line->AppendSwitch(switches::kUseFakeDeviceForMediaStream);
47 49
48 // Flag used by TestWebAudioMediaStream to force garbage collection. 50 // Flag used by TestWebAudioMediaStream to force garbage collection.
49 command_line->AppendSwitchASCII(switches::kJavaScriptFlags, "--expose-gc"); 51 command_line->AppendSwitchASCII(switches::kJavaScriptFlags, "--expose-gc");
50 } 52 }
51 53
52 void RunsAudioVideoWebRTCCallInTwoTabs( 54 void RunsAudioVideoWebRTCCallInTwoTabs(
53 const std::string& video_codec = WebRtcTestBase::kUseDefaultVideoCodec, 55 const std::string& video_codec = WebRtcTestBase::kUseDefaultVideoCodec,
54 const std::string& offer_cert_keygen_alg = 56 const std::string& offer_cert_keygen_alg =
55 WebRtcTestBase::kUseDefaultCertKeygen, 57 WebRtcTestBase::kUseDefaultCertKeygen,
56 const std::string& answer_cert_keygen_alg = 58 const std::string& answer_cert_keygen_alg =
57 WebRtcTestBase::kUseDefaultCertKeygen) { 59 WebRtcTestBase::kUseDefaultCertKeygen) {
58 if (OnWinXp()) return; 60 if (OnWinXp()) return;
61 StartServerAndOpenTabs();
59 62
63 SetupPeerconnectionWithLocalStream(left_tab_, offer_cert_keygen_alg);
64 SetupPeerconnectionWithLocalStream(right_tab_, answer_cert_keygen_alg);
65
66 NegotiateCall(left_tab_, right_tab_, video_codec);
67
68 DetectVideoAndHangUp();
69 }
70
71 void RunsAudioVideoWebRTCCallInTwoTabsWithClonedCertificate(
72 const std::string& cert_keygen_alg =
73 WebRtcTestBase::kUseDefaultCertKeygen) {
74 if (OnWinXp()) return;
75 StartServerAndOpenTabs();
76
77 // Generate and clone a certificate, resulting in JavaScript variable
78 // |gCertificateClone| being set to the resulting clone.
79 DeleteDatabase(left_tab_);
80 OpenDatabase(left_tab_);
81 GenerateAndCloneCertificate(left_tab_, cert_keygen_alg);
82 CloseDatabase(left_tab_);
83 DeleteDatabase(left_tab_);
84
85 SetupPeerconnectionWithCertificateAndLocalStream(
86 left_tab_, "gCertificateClone");
87 SetupPeerconnectionWithLocalStream(right_tab_, cert_keygen_alg);
88
89 NegotiateCall(left_tab_, right_tab_, WebRtcTestBase::kUseDefaultVideoCodec);
90
91 DetectVideoAndHangUp();
92 }
93
94 private:
95 void StartServerAndOpenTabs() {
60 ASSERT_TRUE(embedded_test_server()->Start()); 96 ASSERT_TRUE(embedded_test_server()->Start());
97 left_tab_ = OpenTestPageAndGetUserMediaInNewTab(kMainWebrtcTestHtmlPage);
98 right_tab_ = OpenTestPageAndGetUserMediaInNewTab(kMainWebrtcTestHtmlPage);
99 }
61 100
62 content::WebContents* left_tab = 101 void DetectVideoAndHangUp() {
63 OpenTestPageAndGetUserMediaInNewTab(kMainWebrtcTestHtmlPage); 102 StartDetectingVideo(left_tab_, "remote-view");
64 content::WebContents* right_tab = 103 StartDetectingVideo(right_tab_, "remote-view");
65 OpenTestPageAndGetUserMediaInNewTab(kMainWebrtcTestHtmlPage);
66
67 SetupPeerconnectionWithLocalStream(left_tab, offer_cert_keygen_alg);
68 SetupPeerconnectionWithLocalStream(right_tab, answer_cert_keygen_alg);
69
70 NegotiateCall(left_tab, right_tab, video_codec);
71
72 StartDetectingVideo(left_tab, "remote-view");
73 StartDetectingVideo(right_tab, "remote-view");
74
75 #if !defined(OS_MACOSX) 104 #if !defined(OS_MACOSX)
76 // Video is choppy on Mac OS X. http://crbug.com/443542. 105 // Video is choppy on Mac OS X. http://crbug.com/443542.
77 WaitForVideoToPlay(left_tab); 106 WaitForVideoToPlay(left_tab_);
78 WaitForVideoToPlay(right_tab); 107 WaitForVideoToPlay(right_tab_);
79 #endif 108 #endif
109 HangUp(left_tab_);
110 HangUp(right_tab_);
111 }
80 112
81 HangUp(left_tab); 113 content::WebContents* left_tab_;
82 HangUp(right_tab); 114 content::WebContents* right_tab_;
83 }
84 }; 115 };
85 116
86 IN_PROC_BROWSER_TEST_F(WebRtcBrowserTest, 117 IN_PROC_BROWSER_TEST_F(WebRtcBrowserTest,
87 RunsAudioVideoWebRTCCallInTwoTabsVP8) { 118 RunsAudioVideoWebRTCCallInTwoTabsVP8) {
88 RunsAudioVideoWebRTCCallInTwoTabs("VP8"); 119 RunsAudioVideoWebRTCCallInTwoTabs("VP8");
89 } 120 }
90 121
91 IN_PROC_BROWSER_TEST_F(WebRtcBrowserTest, 122 IN_PROC_BROWSER_TEST_F(WebRtcBrowserTest,
92 RunsAudioVideoWebRTCCallInTwoTabsVP9) { 123 RunsAudioVideoWebRTCCallInTwoTabsVP9) {
93 RunsAudioVideoWebRTCCallInTwoTabs("VP9"); 124 RunsAudioVideoWebRTCCallInTwoTabs("VP9");
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
133 kKeygenAlgorithmRsa); 164 kKeygenAlgorithmRsa);
134 } 165 }
135 166
136 IN_PROC_BROWSER_TEST_F(WebRtcBrowserTest, 167 IN_PROC_BROWSER_TEST_F(WebRtcBrowserTest,
137 RunsAudioVideoWebRTCCallInTwoTabsOfferEcdsaAnswerEcdsa) { 168 RunsAudioVideoWebRTCCallInTwoTabsOfferEcdsaAnswerEcdsa) {
138 RunsAudioVideoWebRTCCallInTwoTabs(WebRtcTestBase::kUseDefaultVideoCodec, 169 RunsAudioVideoWebRTCCallInTwoTabs(WebRtcTestBase::kUseDefaultVideoCodec,
139 kKeygenAlgorithmEcdsa, 170 kKeygenAlgorithmEcdsa,
140 kKeygenAlgorithmEcdsa); 171 kKeygenAlgorithmEcdsa);
141 } 172 }
142 173
174 IN_PROC_BROWSER_TEST_F(
175 WebRtcBrowserTest,
176 RunsAudioVideoWebRTCCallInTwoTabsWithClonedCertificateRsa) {
177 RunsAudioVideoWebRTCCallInTwoTabsWithClonedCertificate(kKeygenAlgorithmRsa);
178 }
179
180 IN_PROC_BROWSER_TEST_F(
181 WebRtcBrowserTest,
182 RunsAudioVideoWebRTCCallInTwoTabsWithClonedCertificateEcdsa) {
183 RunsAudioVideoWebRTCCallInTwoTabsWithClonedCertificate(kKeygenAlgorithmEcdsa);
184 }
185
143 IN_PROC_BROWSER_TEST_F(WebRtcBrowserTest, 186 IN_PROC_BROWSER_TEST_F(WebRtcBrowserTest,
144 RunsAudioVideoWebRTCCallInTwoTabsOfferRsaAnswerEcdsa) { 187 RunsAudioVideoWebRTCCallInTwoTabsOfferRsaAnswerEcdsa) {
145 RunsAudioVideoWebRTCCallInTwoTabs(WebRtcTestBase::kUseDefaultVideoCodec, 188 RunsAudioVideoWebRTCCallInTwoTabs(WebRtcTestBase::kUseDefaultVideoCodec,
146 kKeygenAlgorithmRsa, 189 kKeygenAlgorithmRsa,
147 kKeygenAlgorithmEcdsa); 190 kKeygenAlgorithmEcdsa);
148 } 191 }
149 192
150 IN_PROC_BROWSER_TEST_F(WebRtcBrowserTest, 193 IN_PROC_BROWSER_TEST_F(WebRtcBrowserTest,
151 RunsAudioVideoWebRTCCallInTwoTabsOfferEcdsaAnswerRsa) { 194 RunsAudioVideoWebRTCCallInTwoTabsOfferEcdsaAnswerRsa) {
152 RunsAudioVideoWebRTCCallInTwoTabs(WebRtcTestBase::kUseDefaultVideoCodec, 195 RunsAudioVideoWebRTCCallInTwoTabs(WebRtcTestBase::kUseDefaultVideoCodec,
153 kKeygenAlgorithmEcdsa, 196 kKeygenAlgorithmEcdsa,
154 kKeygenAlgorithmRsa); 197 kKeygenAlgorithmRsa);
155 } 198 }
OLDNEW
« no previous file with comments | « no previous file | third_party/WebKit/Source/bindings/core/v8/SerializationTag.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698