#ifdef UNSAFE_BUFFERS_BUILD
#pragma allow_unsafe_buffers
#endif
#include "chrome/test/chromedriver/capabilities.h"
#include <map>
#include <string_view>
#include <utility>
#include "base/containers/contains.h"
#include "base/containers/fixed_flat_set.h"
#include "base/functional/bind.h"
#include "base/functional/callback.h"
#include "base/json/string_escape.h"
#include "base/logging.h"
#include "base/strings/string_number_conversions.h"
#include "base/strings/string_split.h"
#include "base/strings/string_tokenizer.h"
#include "base/strings/string_util.h"
#include "base/strings/stringprintf.h"
#include "base/strings/utf_string_conversions.h"
#include "base/values.h"
#include "build/build_config.h"
#include "chrome/test/chromedriver/chrome/client_hints.h"
#include "chrome/test/chromedriver/chrome/mobile_device.h"
#include "chrome/test/chromedriver/chrome/page_load_strategy.h"
#include "chrome/test/chromedriver/chrome/status.h"
#include "chrome/test/chromedriver/constants/version.h"
#include "chrome/test/chromedriver/logging.h"
#include "chrome/test/chromedriver/prompt_behavior.h"
#include "chrome/test/chromedriver/session.h"
#include "chrome/test/chromedriver/util.h"
namespace {
Parser;
Status ParseBoolean(
bool* to_set,
const base::Value& option,
Capabilities* capabilities) { … }
Status ParseString(std::string* to_set,
const base::Value& option,
Capabilities* capabilities) { … }
Status ParseInterval(int* to_set,
const base::Value& option,
Capabilities* capabilities) { … }
Status ParseTimeDelta(base::TimeDelta* to_set,
const base::Value& option,
Capabilities* capabilities) { … }
Status ParseFilePath(base::FilePath* to_set,
const base::Value& option,
Capabilities* capabilities) { … }
Status ParseDict(std::unique_ptr<base::Value::Dict>* to_set,
const base::Value& option,
Capabilities* capabilities) { … }
Status IgnoreDeprecatedOption(
const char* option_name,
const base::Value& option,
Capabilities* capabilities) { … }
Status IgnoreCapability(const base::Value& option, Capabilities* capabilities) { … }
Status ParseLogPath(const base::Value& option, Capabilities* capabilities) { … }
Status ParseDeviceName(const std::string& device_name,
Capabilities* capabilities) { … }
Status ParseMobileEmulation(const base::Value& option,
Capabilities* capabilities) { … }
Status ParsePageLoadStrategy(const base::Value& option,
Capabilities* capabilities) { … }
Status ParseUnhandledPromptBehavior(bool w3c_compliant,
const base::Value& option,
Capabilities* capabilities) { … }
Status ParseTimeouts(const base::Value& option, Capabilities* capabilities) { … }
Status ParseSwitches(const base::Value& option,
Capabilities* capabilities) { … }
Status ParseExtensions(const base::Value& option, Capabilities* capabilities) { … }
Status ParseProxy(bool w3c_compliant,
const base::Value& option,
Capabilities* capabilities) { … }
Status ParseExcludeSwitches(const base::Value& option,
Capabilities* capabilities) { … }
Status ParsePortNumber(int* to_set,
const base::Value& option,
Capabilities* capabilities) { … }
Status ParseNetAddress(NetAddress* to_set,
const base::Value& option,
Capabilities* capabilities) { … }
Status ParseLoggingPrefs(const base::Value& option,
Capabilities* capabilities) { … }
Status ParseInspectorDomainStatus(
PerfLoggingPrefs::InspectorDomainStatus* to_set,
const base::Value& option,
Capabilities* capabilities) { … }
Status ParsePerfLoggingPrefs(const base::Value& option,
Capabilities* capabilities) { … }
Status ParseDevToolsEventsLoggingPrefs(const base::Value& option,
Capabilities* capabilities) { … }
Status ParseWindowTypes(const base::Value& option, Capabilities* capabilities) { … }
Status ParseChromeOptions(
const base::Value& capability,
Capabilities* capabilities) { … }
Status ParseSeleniumOptions(
const base::Value& capability,
Capabilities* capabilities) { … }
}
bool GetChromeOptionsDictionary(const base::Value::Dict& params,
const base::Value::Dict** out) { … }
Switches::Switches() = default;
Switches::Switches(const Switches& other) = default;
Switches::~Switches() = default;
void Switches::SetSwitch(const std::string& name) { … }
void Switches::SetSwitch(const std::string& name, const std::string& value) { … }
void Switches::SetSwitch(const std::string& name, const base::FilePath& value) { … }
void Switches::SetMultivaluedSwitch(const std::string& name,
const std::string& value) { … }
void Switches::SetFromSwitches(const Switches& switches) { … }
namespace {
constexpr auto kMultivaluedSwitches = …;
}
void Switches::SetUnparsedSwitch(const std::string& unparsed_switch) { … }
void Switches::RemoveSwitch(const std::string& name) { … }
bool Switches::HasSwitch(const std::string& name) const { … }
std::string Switches::GetSwitchValue(const std::string& name) const { … }
Switches::NativeString Switches::GetSwitchValueNative(
const std::string& name) const { … }
size_t Switches::GetSize() const { … }
void Switches::AppendToCommandLine(base::CommandLine* command) const { … }
std::string Switches::ToString() const { … }
PerfLoggingPrefs::PerfLoggingPrefs()
: … { … }
PerfLoggingPrefs::~PerfLoggingPrefs() = default;
Capabilities::Capabilities()
: … { … }
Capabilities::~Capabilities() = default;
bool Capabilities::IsAndroid() const { … }
bool Capabilities::IsRemoteBrowser() const { … }
Status Capabilities::Parse(const base::Value::Dict& desired_caps,
bool w3c_compliant) { … }