def pick_test(env, flavor, mach_cmd): if flavor == "desktop-browser": return Layers(env, mach_cmd, (Profile, BrowsertimeRunner)) if flavor == "mobile-browser": return Layers(env, mach_cmd, (Profile, BrowsertimeRunner, AndroidLog)) raise NotImplementedError(flavor)
def pick_system(env, flavor, mach_cmd): if flavor in ("desktop-browser", "xpcshell"): return Layers(env, mach_cmd, ( MacosDevice, Profile, ProxyRunner, )) if flavor == "mobile-browser": return Layers(env, mach_cmd, (Profile, ProxyRunner, AndroidDevice)) raise NotImplementedError(flavor)
def test_layers(): mach = MagicMock() factories = [_TestLayer, _TestLayer2, _TestLayer3] env = MachEnvironment( mach, no_test3=True, test_arg1="ok", test2=True, test2_arg2="2" ) with Layers(env, mach, factories) as layers: # layer3 was deactivated with test3=False assert len(layers.layers) == 2 layers.info("info") layers.debug("debug") layers.warning("warning") assert layers.get_arg("--test2") assert layers.get_arg("test-arg1") == "ok" layers.set_arg("test-arg1", "two") assert layers.get_arg("test-arg1") == "two" layers.set_arg("--test-arg1", 1) assert layers.get_arg("test-arg1") == 1 assert layers.get_layer("test2").name == "test2" assert layers.get_layer("test3") is None assert layers.name == "test + test2" with pytest.raises(KeyError): layers.set_arg("another", 1) for layer in layers: assert layer.called == 2
def pick_metrics(env, flavor, mach_cmd): if flavor in ("desktop-browser", "mobile-browser"): layers = get_layers() else: # we don't need VisualMetrics for xpcshell layers = Perfherder, ConsoleOutput, Notebook, Influx return Layers(env, mach_cmd, layers)
def pick_metrics(env, flavor, mach_cmd): if flavor in ("mobile-browser", "desktop-browser"): return Layers(env, mach_cmd, get_layers()) raise NotImplementedError(flavor)
def pick_browser(env, flavor, mach_cmd): if flavor == "script": return Layers(env, mach_cmd, get_layers()) raise NotImplementedError(flavor)
def pick_metrics(env, flavor, mach_cmd): return Layers(env, mach_cmd, get_layers())