Пример #1
0
 def get_test_config(
     self,
     data_dir: Optional[Path] = None,
     num_browsers: int = NUM_BROWSERS,
     display_mode: Literal["headless", "xvfb"] = "headless",
 ) -> Tuple[ManagerParams, List[BrowserParams]]:
     """Load and return the default test parameters."""
     if not data_dir:
         data_dir = self.tmpdir
     assert data_dir is not None  # Mypy doesn't understand this without help
     manager_params = ManagerParams(num_browsers=num_browsers)
     browser_params = [BrowserParams() for _ in range(num_browsers)]
     manager_params.log_path = data_dir / "openwpm.log"
     manager_params.num_browsers = num_browsers
     manager_params.testing = True
     for i in range(num_browsers):
         browser_params[i].display_mode = display_mode
     return manager_params, browser_params
Пример #2
0
def default_params(
    tmp_path: Path,
    num_browsers: int = NUM_BROWSERS
) -> Tuple[ManagerParams, List[BrowserParams]]:
    """Just a simple wrapper around task_manager.load_default_params"""

    manager_params = ManagerParams(
        num_browsers=NUM_BROWSERS
    )  # num_browsers is necessary to let TaskManager know how many browsers to spawn

    browser_params = [
        BrowserParams(display_mode="headless") for _ in range(NUM_BROWSERS)
    ]
    manager_params.data_directory = tmp_path
    manager_params.log_path = tmp_path / "openwpm.log"
    manager_params.testing = True
    for i in range(num_browsers):
        browser_params[i].display_mode = "headless"
    return manager_params, browser_params