#include "chrome/browser/media/webrtc/webrtc_browsertest_base.h"
#include <stddef.h>
#include <limits>
#include <tuple>
#include "base/json/json_reader.h"
#include "base/lazy_instance.h"
#include "base/logging.h"
#include "base/path_service.h"
#include "base/strings/string_number_conversions.h"
#include "base/strings/string_split.h"
#include "base/strings/string_util.h"
#include "base/strings/stringprintf.h"
#include "base/values.h"
#include "build/build_config.h"
#include "chrome/browser/extensions/chrome_test_extension_loader.h"
#include "chrome/browser/media/webrtc/webrtc_browsertest_common.h"
#include "chrome/browser/profiles/profile.h"
#include "chrome/browser/ui/browser.h"
#include "chrome/browser/ui/browser_tabstrip.h"
#include "chrome/browser/ui/tabs/tab_strip_model.h"
#include "chrome/common/chrome_paths.h"
#include "chrome/test/base/ui_test_utils.h"
#include "components/permissions/permission_request_manager.h"
#include "components/permissions/test/permission_request_observer.h"
#include "content/public/test/browser_test_utils.h"
#include "extensions/browser/extension_registry.h"
#include "net/test/embedded_test_server/embedded_test_server.h"
const char WebRtcTestBase::kAudioVideoCallConstraints[] = …;
const char WebRtcTestBase::kVideoCallConstraintsQVGA[] = …;
const char WebRtcTestBase::kVideoCallConstraints360p[] = …;
const char WebRtcTestBase::kVideoCallConstraintsVGA[] = …;
const char WebRtcTestBase::kVideoCallConstraints720p[] = …;
const char WebRtcTestBase::kVideoCallConstraints1080p[] = …;
const char WebRtcTestBase::kAudioOnlyCallConstraints[] = …;
const char WebRtcTestBase::kVideoOnlyCallConstraints[] = …;
const char WebRtcTestBase::kOkGotStream[] = …;
const char WebRtcTestBase::kFailedWithNotAllowedError[] = …;
const char WebRtcTestBase::kAudioVideoCallConstraints360p[] = …;
const char WebRtcTestBase::kAudioVideoCallConstraints720p[] = …;
const char WebRtcTestBase::kUseDefaultCertKeygen[] = …;
const char WebRtcTestBase::kUseDefaultAudioCodec[] = …;
const char WebRtcTestBase::kUseDefaultVideoCodec[] = …;
const char WebRtcTestBase::kVP9Profile0Specifier[] = …;
const char WebRtcTestBase::kVP9Profile2Specifier[] = …;
const char WebRtcTestBase::kUndefined[] = …;
namespace {
base::LazyInstance<bool>::DestructorAtExit hit_javascript_errors_ = …;
bool JavascriptErrorDetectingLogHandler(int severity,
const char* file,
int line,
size_t message_start,
const std::string& str) { … }
}
WebRtcTestBase::WebRtcTestBase(): … { … }
WebRtcTestBase::~WebRtcTestBase() { … }
bool WebRtcTestBase::GetUserMediaAndAccept(
content::WebContents* tab_contents) const { … }
bool WebRtcTestBase::GetUserMediaWithSpecificConstraintsAndAccept(
content::WebContents* tab_contents,
const std::string& constraints) const { … }
bool WebRtcTestBase::GetUserMediaWithSpecificConstraintsAndAcceptIfPrompted(
content::WebContents* tab_contents,
const std::string& constraints) const { … }
void WebRtcTestBase::GetUserMediaAndDeny(content::WebContents* tab_contents) { … }
void WebRtcTestBase::GetUserMediaWithSpecificConstraintsAndDeny(
content::WebContents* tab_contents,
const std::string& constraints) const { … }
void WebRtcTestBase::GetUserMediaAndDismiss(
content::WebContents* tab_contents) const { … }
void WebRtcTestBase::GetUserMediaAndExpectAutoAcceptWithoutPrompt(
content::WebContents* tab_contents) const { … }
void WebRtcTestBase::GetUserMediaAndExpectAutoDenyWithoutPrompt(
content::WebContents* tab_contents) const { … }
void WebRtcTestBase::GetUserMedia(content::WebContents* tab_contents,
const std::string& constraints) const { … }
void WebRtcTestBase::GetUserMediaReturnsFalseIfWaitIsTooLong(
content::WebContents* tab_contents,
const std::string& constraints) const { … }
content::WebContents* WebRtcTestBase::OpenPageAndGetUserMediaInNewTab(
const GURL& url) const { … }
content::WebContents*
WebRtcTestBase::OpenPageAndGetUserMediaInNewTabWithConstraints(
const GURL& url,
const std::string& constraints) const { … }
content::WebContents* WebRtcTestBase::OpenTestPageAndGetUserMediaInNewTab(
const std::string& test_page) const { … }
content::WebContents* WebRtcTestBase::OpenTestPageInNewTab(
const std::string& test_page) const { … }
void WebRtcTestBase::CloseLastLocalStream(
content::WebContents* tab_contents) const { … }
std::string WebRtcTestBase::ExecuteJavascript(
const std::string& javascript,
content::WebContents* tab_contents) const { … }
void WebRtcTestBase::SetupPeerconnectionWithLocalStream(
content::WebContents* tab,
const std::string& certificate_keygen_algorithm) const { … }
void WebRtcTestBase::SetupPeerconnectionWithoutLocalStream(
content::WebContents* tab,
const std::string& certificate_keygen_algorithm) const { … }
void WebRtcTestBase::SetupPeerconnectionWithCertificateAndLocalStream(
content::WebContents* tab,
const std::string& certificate) const { … }
void WebRtcTestBase::SetupPeerconnectionWithCertificateWithoutLocalStream(
content::WebContents* tab,
const std::string& certificate) const { … }
void WebRtcTestBase::SetupPeerconnectionWithConstraintsAndLocalStream(
content::WebContents* tab,
const std::string& constraints,
const std::string& certificate_keygen_algorithm) const { … }
std::string WebRtcTestBase::CreateLocalOffer(
content::WebContents* from_tab) const { … }
std::string WebRtcTestBase::CreateAnswer(std::string local_offer,
content::WebContents* to_tab) const { … }
void WebRtcTestBase::ReceiveAnswer(const std::string& answer,
content::WebContents* from_tab) const { … }
void WebRtcTestBase::GatherAndSendIceCandidates(
content::WebContents* from_tab,
content::WebContents* to_tab) const { … }
void WebRtcTestBase::CreateDataChannel(content::WebContents* tab,
const std::string& label) { … }
void WebRtcTestBase::NegotiateCall(content::WebContents* from_tab,
content::WebContents* to_tab) const { … }
void WebRtcTestBase::VerifyLocalDescriptionContainsCertificate(
content::WebContents* tab,
const std::string& certificate) const { … }
void WebRtcTestBase::HangUp(content::WebContents* from_tab) const { … }
void WebRtcTestBase::DetectErrorsInJavaScript() { … }
void WebRtcTestBase::StartDetectingVideo(
content::WebContents* tab_contents,
const std::string& video_element) const { … }
bool WebRtcTestBase::WaitForVideoToPlay(
content::WebContents* tab_contents) const { … }
bool WebRtcTestBase::WaitForVideoToStop(
content::WebContents* tab_contents) const { … }
void WebRtcTestBase::EnableVideoFrameCallbacks(
content::WebContents* tab_contents,
const std::string& video_element) const { … }
int WebRtcTestBase::GetNumVideoFrameCallbacks(
content::WebContents* tab_contents) const { … }
std::string WebRtcTestBase::GetStreamSize(
content::WebContents* tab_contents,
const std::string& video_element) const { … }
void WebRtcTestBase::OpenDatabase(content::WebContents* tab) const { … }
void WebRtcTestBase::CloseDatabase(content::WebContents* tab) const { … }
void WebRtcTestBase::DeleteDatabase(content::WebContents* tab) const { … }
void WebRtcTestBase::GenerateAndCloneCertificate(
content::WebContents* tab, const std::string& keygen_algorithm) const { … }
scoped_refptr<content::TestStatsReportDictionary>
WebRtcTestBase::GetStatsReportDictionary(content::WebContents* tab) const { … }
double WebRtcTestBase::MeasureGetStatsPerformance(
content::WebContents* tab) const { … }
void WebRtcTestBase::SetDefaultAudioCodec(
content::WebContents* tab,
const std::string& audio_codec) const { … }
void WebRtcTestBase::SetDefaultVideoCodec(content::WebContents* tab,
const std::string& video_codec,
bool prefer_hw_codec,
const std::string& profile) const { … }
void WebRtcTestBase::EnableOpusDtx(content::WebContents* tab) const { … }
std::string WebRtcTestBase::GetDesktopMediaStream(content::WebContents* tab) { … }
std::optional<std::string> WebRtcTestBase::LoadDesktopCaptureExtension() { … }