public static bool CheckIgnoreFunction(Function function, DriverOptions options) { if (!function.IsGenerated) return true; if (function is Method) return CheckIgnoreMethod(function as Method, options); return false; }
private static IList<string> GetDependencies(string library) { var driverOptions = new DriverOptions(); driverOptions.addLibraryDirs(GeneratorTest.GetTestsDirectory("Native")); driverOptions.Libraries.Add(library); var driver = new Driver(driverOptions, new TextDiagnosticPrinter()); Assert.IsTrue(driver.ParseLibraries()); var dependencies = driver.Symbols.Libraries[0].Dependencies; return dependencies; }
public void TestParseELF() { var driverOptions = new DriverOptions(); driverOptions.addLibraryDirs(GeneratorTest.GetTestsDirectory("Native")); driverOptions.Libraries.Add("ls"); var driver = new Driver(driverOptions, new TextDiagnosticPrinter()); Assert.IsTrue(driver.ParseLibraries()); var dependencies = driver.Symbols.Libraries[0].Dependencies; Assert.AreEqual("libselinux.so.1", dependencies[0]); Assert.AreEqual("librt.so.1", dependencies[1]); Assert.AreEqual("libacl.so.1", dependencies[2]); Assert.AreEqual("libc.so.6", dependencies[3]); }
protected void ParseLibrary(string file) { Options = new DriverOptions(); var testsPath = LibraryTest.GetTestsDirectory("Native"); Options.IncludeDirs.Add(testsPath); Options.Headers.Add(file); Driver = new Driver(Options, new TextDiagnosticPrinter()); if (!Driver.ParseCode()) throw new Exception("Error parsing the code"); AstContext = Driver.ASTContext; }
protected void ParseLibrary(params string[] files) { Options = new DriverOptions(); var testsPath = GeneratorTest.GetTestsDirectory("Native"); Options.addIncludeDirs(testsPath); Options.Headers.AddRange(files); Driver = new Driver(Options, new TextDiagnosticPrinter()); Driver.BuildParseOptions(); if (!Driver.ParseCode()) throw new Exception("Error parsing the code"); AstContext = Driver.ASTContext; }
public BindingContext(IDiagnostics diagnostics, DriverOptions options, ParserOptions parserOptions = null) { Options = options; Diagnostics = diagnostics; ParserOptions = parserOptions; Symbols = new SymbolContext(); Delegates = new Dictionary<Function, DelegatesPass.DelegateDefinition>(); TypeMaps = new TypeMapDatabase(); TypeMaps.SetupTypeMaps(Options.GeneratorKind); TranslationUnitPasses = new PassBuilder<TranslationUnitPass>(this); GeneratorOutputPasses = new PassBuilder<GeneratorOutputPass>(this); }
private static IList<string> GetDependencies(string library) { var parserOptions = new ParserOptions(); parserOptions.AddLibraryDirs(GeneratorTest.GetTestsDirectory("Native")); var driverOptions = new DriverOptions(); driverOptions.Libraries.Add(library); var driver = new Driver(driverOptions, new TextDiagnosticPrinter()) { ParserOptions = parserOptions }; foreach (var module in driver.Options.Modules) module.LibraryName = "Test"; driver.Setup(); Assert.IsTrue(driver.ParseLibraries()); var dependencies = driver.Context.Symbols.Libraries[0].Dependencies; return dependencies; }
public static bool CheckIgnoreMethod(Method method, DriverOptions options) { if (!method.IsGenerated) return true; var isEmptyCtor = method.IsConstructor && method.Parameters.Count == 0; var @class = method.Namespace as Class; if (@class != null && @class.IsValueType && isEmptyCtor) return true; if (method.IsMoveConstructor) return true; if (method.IsDestructor) return true; if (method.OperatorKind == CXXOperatorKind.Equal) return true; if (method.Access == AccessSpecifier.Private && !method.IsOverride && !method.IsExplicitlyGenerated) return true; // Ignore copy constructor if a base class don't has or has a private copy constructor if (method.IsCopyConstructor) { if (!options.GenerateCopyConstructors) return true; var baseClass = @class; while (baseClass != null && baseClass.HasBaseClass) { baseClass = baseClass.BaseClass; if (!baseClass.IsInterface) { var copyConstructor = baseClass.Methods.FirstOrDefault(m => m.IsCopyConstructor); if (copyConstructor == null || copyConstructor.Access == AccessSpecifier.Private || !copyConstructor.IsDeclared) return true; } } } return false; }
protected void ParseLibrary(params string[] files) { Options = new DriverOptions(); ParserOptions = new ParserOptions(); var testsPath = GeneratorTest.GetTestsDirectory("Native"); ParserOptions.AddIncludeDirs(testsPath); Options.Headers.AddRange(files); Driver = new Driver(Options, new TextDiagnosticPrinter()) { ParserOptions = this.ParserOptions }; foreach (var module in Driver.Options.Modules) module.LibraryName = "Test"; Driver.Setup(); Driver.BuildParseOptions(); if (!Driver.ParseCode()) throw new Exception("Error parsing the code"); AstContext = Driver.Context.ASTContext; }
public virtual string Generate(DriverOptions options) { if (CheckGenerate != null && !CheckGenerate()) return ""; if (Blocks.Count == 0) return Text.ToString(); var builder = new StringBuilder(); uint totalIndent = 0; Block previousBlock = null; var blockIndex = 0; foreach (var childBlock in Blocks) { var childText = childBlock.Generate(options); var nextBlock = (++blockIndex < Blocks.Count) ? Blocks[blockIndex] : null; var skipBlock = false; if (nextBlock != null) { var nextText = nextBlock.Generate(options); if (string.IsNullOrEmpty(nextText) && childBlock.NewLineKind == NewLineKind.IfNotEmpty) skipBlock = true; } if (skipBlock) continue; if (string.IsNullOrEmpty(childText)) continue; var lines = childText.SplitAndKeep(Environment.NewLine).ToList(); if (previousBlock != null && previousBlock.NewLineKind == NewLineKind.BeforeNextBlock) builder.AppendLine(); if (childBlock.isSubBlock) totalIndent = 0; if (childBlock.Kind == BlockKind.BlockComment) { // Wrap the comment to the max line width. var maxSize = options.MaxIndent - totalIndent; maxSize -= options.CommentPrefix.Length + 2; lines = StringHelpers.WordWrapLines(childText, (int)maxSize); for (var i = 0; i < lines.Count; ++i) { var line = lines[i]; if (!line.StartsWith(options.CommentPrefix)) lines[i] = options.CommentPrefix + " " + line; } } foreach (var line in lines) { if (string.IsNullOrEmpty(line)) continue; if (!string.IsNullOrWhiteSpace(line)) builder.Append(new string(' ', (int)totalIndent)); builder.Append(line); if (!line.EndsWith(Environment.NewLine)) builder.AppendLine(); } if (childBlock.NewLineKind == NewLineKind.Always) builder.AppendLine(); totalIndent += childBlock.Text.Indent; previousBlock = childBlock; } if (Text.StringBuilder.Length != 0) builder.Append(Text.StringBuilder); return builder.ToString(); }
public virtual string Generate(DriverOptions options) { if (CheckGenerate != null && !CheckGenerate()) return ""; if (Blocks.Count == 0) return Text.ToString(); var builder = new StringBuilder(); uint totalIndent = 0; Block previousBlock = null; var blockIndex = 0; foreach (var childBlock in Blocks) { var childText = childBlock.Generate(options); var nextBlock = (++blockIndex < Blocks.Count) ? Blocks[blockIndex] : null; var skipBlock = false; if (nextBlock != null) { var nextText = nextBlock.Generate(options); if (string.IsNullOrEmpty(nextText) && childBlock.NewLineKind == NewLineKind.IfNotEmpty) skipBlock = true; } if (skipBlock) continue; if (string.IsNullOrEmpty(childText)) continue; var lines = childText.SplitAndKeep(Environment.NewLine).ToList(); if (previousBlock != null && previousBlock.NewLineKind == NewLineKind.BeforeNextBlock) builder.AppendLine(); if (childBlock.isSubBlock) totalIndent = 0; foreach (var line in lines) { if (string.IsNullOrEmpty(line)) continue; if (!string.IsNullOrWhiteSpace(line)) builder.Append(new string(' ', (int)totalIndent)); builder.Append(line); if (!line.EndsWith(Environment.NewLine, StringComparison.Ordinal)) builder.AppendLine(); } if (childBlock.NewLineKind == NewLineKind.Always) builder.AppendLine(); totalIndent += childBlock.Text.Indent; previousBlock = childBlock; } if (Text.StringBuilder.Length != 0) builder.Append(Text.StringBuilder); return builder.ToString(); }
/// <summary> /// Initializes a new instance of the <see cref="RemoteWebDriver"/> class. This constructor defaults proxy to http://127.0.0.1:4444/wd/hub /// </summary> /// <param name="options">An <see cref="DriverOptions"/> object containing the desired capabilities of the browser.</param> public RemoteWebDriver(DriverOptions options) : this(ConvertOptionsToCapabilities(options)) { }
public TestAcme(DriverOptions options) : this(options, false) { }
/// <summary> /// Initializes a new instance of the AndroidDriver class using the AppiumServiceBuilder instance and Appium options /// </summary> /// <param name="builder"> object containing settings of the Appium local service which is going to be started</param> /// <param name="driverOptions">An <see cref="ICapabilities"/> object containing the Appium options.</param> public AndroidDriver(AppiumServiceBuilder builder, DriverOptions driverOptions) : base(builder, SetPlatformToCapabilities(driverOptions, Platform)) { }
/// <summary> /// Initializes a new instance of the AndroidDriver class using the specified remote address and Appium options /// </summary> /// <param name="remoteAddress">URI containing the address of the WebDriver remote server (e.g. http://127.0.0.1:4723/wd/hub).</param> /// <param name="driverOptions">An <see cref="DriverOptions"/> object containing the Appium options.</param> public AndroidDriver(Uri remoteAddress, DriverOptions driverOptions) : base(remoteAddress, SetPlatformToCapabilities(driverOptions, Platform)) { }
public static void InitDriver <T>(IReporter reporter, DriverOptions options) where T : IWebDriver { Driver = (T)Activator.CreateInstance(typeof(T), options); Reporter = reporter; }
/// <summary> /// Initializes a new instance of the AndroidDriver class using Appium options /// </summary> /// <param name="driverOptions">An <see cref="DriverOptions"/> object containing the Appium options of the browser.</param> public AndroidDriver(DriverOptions driverOptions) : base(SetPlatformToCapabilities(driverOptions, Platform)) { }
public OperaDriver(DriverOptions options) : base(options) { }
public IWebDriver CreateDriverInstance(DriverOptions options) { return(driverFactory.CreateDriverWithOptions(driverType, options)); }
private IWebDriver GetDriver(DriverOptions driverOptions) { // return(new RemoteWebDriver(new Uri("https://hub.screener.io:443/wd/hub"), driverOptions.ToCapabilities(), TimeSpan.FromSeconds(60))); }
public TestAcme(DriverOptions options, StitchModes stitchMode) : base("Eyes Selenium SDK - ACME", options, stitchMode) { testedPageSize = new Size(1024, 768); }
public TestAcme(DriverOptions options, bool useVisualGrid) : base("Eyes Selenium SDK - ACME", options, useVisualGrid) { testedPageSize = new Size(1024, 768); }
public CustomAndroidDriver(Uri remoteAddress, DriverOptions driverOptions, TimeSpan commandTimeout) : base(remoteAddress, driverOptions, commandTimeout) { }
#pragma warning disable 618 public BrowserConfiguration(ExecutionType executionType, Lifecycle browserBehavior, BrowserType browserType, Size size, string classFullName, bool shouldCaptureHttpTraffic, bool shouldAutomaticallyScrollToVisible, DriverOptions driverOptions = null) #pragma warning restore 618 : this(browserBehavior, browserType, size, shouldCaptureHttpTraffic, shouldAutomaticallyScrollToVisible) { ExecutionType = executionType; ClassFullName = classFullName; DriverOptions = driverOptions; }
protected override RemoteWebDriver GetSpecificDriver(DriverService service, DriverOptions options) => new FirefoxDriver(service as FirefoxDriverService, options as FirefoxOptions);
public CleanUnitPass(DriverOptions options) { DriverOptions = options; }
/// <summary> /// Initializes a new instance of the AndroidDriver class using Appium options and command timeout /// </summary> /// <param name="driverOptions">An <see cref="ICapabilities"/> object containing the Appium options.</param> /// <param name="commandTimeout">The maximum amount of time to wait for each command.</param> public AndroidDriver(DriverOptions driverOptions, TimeSpan commandTimeout) : base(SetPlatformToCapabilities(driverOptions, Platform), commandTimeout) { }
public static bool CheckIgnoreMethod(Method method, DriverOptions options) { if (!method.IsGenerated) { return(true); } var isEmptyCtor = method.IsConstructor && method.Parameters.Count == 0; var @class = method.Namespace as Class; if (@class != null && @class.IsValueType && isEmptyCtor) { return(true); } if (method.IsMoveConstructor) { return(true); } if (method.IsDestructor) { return(true); } if (method.OperatorKind == CXXOperatorKind.Equal) { return(true); } if (method.Access == AccessSpecifier.Private && !method.IsOverride && !method.IsExplicitlyGenerated) { return(true); } //Ignore copy constructor if a base class don't has or has a private copy constructor if (method.IsCopyConstructor) { if (!options.GenerateCopyConstructors) { return(true); } var baseClass = @class; while (baseClass != null && baseClass.HasBaseClass) { baseClass = baseClass.BaseClass; if (!baseClass.IsInterface) { var copyConstructor = baseClass.Methods.FirstOrDefault(m => m.IsCopyConstructor); if (copyConstructor == null || copyConstructor.Access == AccessSpecifier.Private || !copyConstructor.IsDeclared) { return(true); } } } } return(false); }
/// <summary> /// Initializes a new instance of the AndroidDriver class using the AppiumServiceBuilder instance, Appium options and command timeout /// </summary> /// <param name="builder"> object containing settings of the Appium local service which is going to be started</param> /// <param name="driverOptions">An <see cref="ICapabilities"/> object containing the Appium options.</param> /// <param name="commandTimeout">The maximum amount of time to wait for each command.</param> public AndroidDriver(AppiumServiceBuilder builder, DriverOptions driverOptions, TimeSpan commandTimeout) : base(builder, SetPlatformToCapabilities(driverOptions, Platform), commandTimeout) { }
public RemoteWebDriverWithLogs(DriverOptions options) : base(options) { }
private void StartSdkSession(IRestResponse startSessionResponse, DriverOptions capabilities) { if (capabilities is AppiumOptions) { // Appium capabilities cannot be deserialized directly into an AppiumOptions instance, // so we need to do this ourselves Logger.Info($"Creating Appium options from capabilities returned by Agent..."); AppiumSessionResponse sessionResponse = CustomJsonSerializer.FromJson <AppiumSessionResponse>(startSessionResponse.Content, this.serializerSettings); AppiumOptions appiumOptions = this.CreateAppiumOptions(sessionResponse.Capabilities); this.CreateAgentSession(sessionResponse, appiumOptions); this.OpenSocketConnectionUsing(sessionResponse); } else { // Capabilities for web browsers and the generic driver can be serialized directly. // Since there's a separate Options class for each supported browser, we'll have to // differentiate between them as well. if (capabilities is ChromeOptions) { ChromeSessionResponse sessionResponse = CustomJsonSerializer.FromJson <ChromeSessionResponse>(startSessionResponse.Content, this.serializerSettings); this.CreateAgentSession(sessionResponse, sessionResponse.Capabilities); this.OpenSocketConnectionUsing(sessionResponse); } else if (capabilities is FirefoxOptions) { FirefoxSessionResponse sessionResponse = CustomJsonSerializer.FromJson <FirefoxSessionResponse>(startSessionResponse.Content, this.serializerSettings); this.CreateAgentSession(sessionResponse, sessionResponse.Capabilities); this.OpenSocketConnectionUsing(sessionResponse); } else if (capabilities is EdgeOptions) { EdgeSessionResponse sessionResponse = CustomJsonSerializer.FromJson <EdgeSessionResponse>(startSessionResponse.Content, this.serializerSettings); this.CreateAgentSession(sessionResponse, sessionResponse.Capabilities); this.OpenSocketConnectionUsing(sessionResponse); } else if (capabilities is SafariOptions) { SafariSessionResponse sessionResponse = CustomJsonSerializer.FromJson <SafariSessionResponse>(startSessionResponse.Content, this.serializerSettings); this.CreateAgentSession(sessionResponse, sessionResponse.Capabilities); this.OpenSocketConnectionUsing(sessionResponse); } else if (capabilities is InternetExplorerOptions) { IESessionResponse sessionResponse = CustomJsonSerializer.FromJson <IESessionResponse>(startSessionResponse.Content, this.serializerSettings); this.CreateAgentSession(sessionResponse, sessionResponse.Capabilities); this.OpenSocketConnectionUsing(sessionResponse); } else if (capabilities is GenericOptions) { GenericSessionResponse sessionResponse = CustomJsonSerializer.FromJson <GenericSessionResponse>(startSessionResponse.Content, this.serializerSettings); this.CreateAgentSession(sessionResponse, sessionResponse.Capabilities); this.OpenSocketConnectionUsing(sessionResponse); } else { throw new SdkException($"The options type '{capabilities.GetType().Name}' is not supported by the OpenSDK."); } } }
public CLITypeReferenceCollector(ITypeMapDatabase typeMapDatabase, DriverOptions driverOptions) { TypeMapDatabase = typeMapDatabase; DriverOptions = driverOptions; typeReferences = new Dictionary<Declaration,CLITypeReference>(); }
/// <summary> /// Initializes a new instance of the <see cref="RemoteWebDriver"/> class. This constructor defaults proxy to http://127.0.0.1:4444/wd/hub /// </summary> /// <param name="remoteAddress">URI containing the address of the WebDriver remote server (e.g. http://127.0.0.1:4444/wd/hub).</param> /// <param name="options">An <see cref="DriverOptions"/> object containing the desired capabilities of the browser.</param> public RemoteWebDriver(Uri remoteAddress, DriverOptions options) : this(remoteAddress, ConvertOptionsToCapabilities(options)) { }
public static string CreateMessage(this DriverOptions driverOptions) { if (driverOptions is { })
internal static ICapabilities SetPlatformToCapabilities(DriverOptions dc, string desiredPlatform) { dc.AddAdditionalCapability(MobileCapabilityType.PlatformName, desiredPlatform); return(dc.ToCapabilities()); }
public CLITypeReferenceCollector(ITypeMapDatabase typeMapDatabase, DriverOptions driverOptions) { TypeMapDatabase = typeMapDatabase; DriverOptions = driverOptions; typeReferences = new Dictionary <Declaration, CLITypeReference>(); }
public CheckAbiParameters(DriverOptions options) { this.options = options; }
public RemoteWebDriverWithLogs(Uri remoteAddress, DriverOptions options) : base(remoteAddress, options) { }
public StringBuilder GenerateUnformatted(DriverOptions options) { if (CheckGenerate != null && !CheckGenerate()) return new StringBuilder(0); if (Blocks.Count == 0) return Text.StringBuilder; var builder = new StringBuilder(); Block previousBlock = null; var blockIndex = 0; foreach (var childBlock in Blocks) { var childText = childBlock.GenerateUnformatted(options); var nextBlock = (++blockIndex < Blocks.Count) ? Blocks[blockIndex] : null; if (nextBlock != null) { var nextText = nextBlock.GenerateUnformatted(options); if (nextText.Length == 0 && childBlock.NewLineKind == NewLineKind.IfNotEmpty) continue; } if (childText.Length == 0) continue; if (previousBlock != null && previousBlock.NewLineKind == NewLineKind.BeforeNextBlock) builder.AppendLine(); builder.Append(childText); if (childBlock.NewLineKind == NewLineKind.Always) builder.AppendLine(); previousBlock = childBlock; } if (Text.StringBuilder.Length != 0) builder.Append(Text.StringBuilder); return builder; }
/// <summary> /// Initializes a new instance of the AndroidDriver class using the specified Appium local service, Appium options, and command timeout. /// </summary> /// <param name="service">the specified Appium local service</param> /// <param name="driverOptions">An <see cref="ICapabilities"/> object containing the Appium options.</param> /// <param name="commandTimeout">The maximum amount of time to wait for each command.</param> public AndroidDriver(AppiumLocalService service, DriverOptions driverOptions, TimeSpan commandTimeout) : base(service, SetPlatformToCapabilities(driverOptions, Platform), commandTimeout) { }
public void Setup(DriverOptions options) { options.OutputInteropIncludes = false; options.LibraryName = "Engine"; options.OutputNamespace = "Flood"; options.OutputDir = @"../../../../src/EngineManaged/Bindings"; options.IncludeDirs.Add(@"../../../../inc"); options.GeneratorKind = LanguageGeneratorKind.CPlusPlusCLI; SetupHeaders(options.Headers); }
/// <summary> /// Initializes a new instance of the AndroidDriver class /// </summary> /// <param name="commandExecutor">An <see cref="ICommandExecutor"/> object which executes commands for the driver.</param> /// <param name="driverOptions">An <see cref="ICapabilities"/> object containing the Appium options.</param> public AndroidDriver(ICommandExecutor commandExecutor, DriverOptions driverOptions) : base(commandExecutor, SetPlatformToCapabilities(driverOptions, Platform)) { }
/// <summary> /// Initializes a new instance of the AndroidDriver class using the specified Appium local service and Appium options /// </summary> /// <param name="service">the specified Appium local service</param> /// <param name="driverOptions">An <see cref="ICapabilities"/> object containing the Appium options of the browser.</param> public AndroidDriver(AppiumLocalService service, DriverOptions driverOptions) : base(service, SetPlatformToCapabilities(driverOptions, Platform)) { }
protected abstract void Load(DriverOptions options);
/// <summary> /// Initializes a new instance of the AndroidDriver class using the specified remote address, Appium options, and command timeout. /// </summary> /// <param name="remoteAddress">URI containing the address of the WebDriver remote server (e.g. http://127.0.0.1:4723/wd/hub).</param> /// <param name="driverOptions">An <see cref="DriverOptions"/> object containing the Appium options.</param> /// <param name="commandTimeout">The maximum amount of time to wait for each command.</param> public AndroidDriver(Uri remoteAddress, DriverOptions driverOptions, TimeSpan commandTimeout) : base(remoteAddress, SetPlatformToCapabilities(driverOptions, Platform), commandTimeout) { }