Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1629)

Unified Diff: mojo/tools/apptest_runner.py

Issue 971083002: Create an apptesting framework for dart. (Closed) Base URL: https://github.com/domokit/mojo.git@master
Patch Set: msw comments Created 5 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: mojo/tools/apptest_runner.py
diff --git a/mojo/tools/apptest_runner.py b/mojo/tools/apptest_runner.py
index f2b459b980476f71a9651fb52b9cc609b3614d20..296ec3d1c47328796a2ae16a8e3cfe91ee45c7df 100755
--- a/mojo/tools/apptest_runner.py
+++ b/mojo/tools/apptest_runner.py
@@ -13,7 +13,9 @@ import sys
_logging = logging.getLogger()
from mopy import android
+from mopy import dart_apptest
from mopy import gtest
+from mopy import test_util
from mopy.background_app_group import BackgroundAppGroup
from mopy.config import Config
from mopy.gn import ConfigForGNArgs, ParseGNConfig
@@ -62,33 +64,41 @@ def main():
print "Running " + apptest + "...",
sys.stdout.flush()
- # List the apptest fixtures so they can be run independently for isolation.
- # TODO(msw): Run some apptests without fixture isolation?
- fixtures = gtest.get_fixtures(config, shell_args, apptest)
-
- if not fixtures:
- print "Failed with no tests found."
- exit_code = 1
- continue
-
- if any(not mojo_paths.IsValidAppUrl(url) for url in launched_services):
- print "Failed with malformed launched-services: %r" % launched_services
- exit_code = 1
- continue
-
- apptest_result = "Succeeded"
- for fixture in fixtures:
- apptest_args = test_args + ["--gtest_filter=%s" % fixture]
- if launched_services:
- success = RunApptestInLauncher(config, mojo_paths, apptest,
- apptest_args, shell_args,
- launched_services)
- else:
- success = RunApptestInShell(config, apptest, apptest_args, shell_args)
-
+ if apptest_dict.get("type", "gtest") == "dart":
+ # TODO(erg): Support android and external and fixture isolation.
msw 2015/03/04 21:04:31 nit: s/external/launched services/
+ apptest_result = "Succeeded"
+ success = dart_apptest.run_test(config, shell_args, {apptest: test_args})
if not success:
apptest_result = "Failed test(s) in %r" % apptest_dict
exit_code = 1
+ else:
msw 2015/03/04 21:04:31 nit: maybe this could be extracted to a gtest.py f
Elliot Glaysher 2015/03/04 22:20:59 Done. Moves this (and code only called from this c
+ # List the apptest fixtures so they can be run independently for
+ # isolation. TODO(msw): Run some apptests without fixture isolation?
+ fixtures = gtest.get_fixtures(config, shell_args, apptest)
+
+ if not fixtures:
+ print "Failed with no tests found."
+ exit_code = 1
+ continue
+
+ if any(not mojo_paths.IsValidAppUrl(url) for url in launched_services):
+ print "Failed with malformed launched-services: %r" % launched_services
+ exit_code = 1
+ continue
+
+ apptest_result = "Succeeded"
+ for fixture in fixtures:
+ apptest_args = test_args + ["--gtest_filter=%s" % fixture]
+ if launched_services:
+ success = RunApptestInLauncher(config, mojo_paths, apptest,
+ apptest_args, shell_args,
+ launched_services)
+ else:
+ success = RunApptestInShell(config, apptest, apptest_args, shell_args)
+
+ if not success:
+ apptest_result = "Failed test(s) in %r" % apptest_dict
+ exit_code = 1
print apptest_result
@@ -103,7 +113,7 @@ def RunApptestInLauncher(config, mojo_paths, application, application_args,
shell_args, launched_services):
with BackgroundAppGroup(
mojo_paths, launched_services,
- gtest.build_shell_arguments(shell_args)) as apps:
+ test_util.build_shell_arguments(shell_args)) as apps:
launcher_args = [
'--shell-path=' + apps.socket_path,
'--app-url=' + application,

Powered by Google App Engine
This is Rietveld 408576698