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

Unified Diff: sky/shell/linux/main.cc

Issue 1218633003: Make it possible to run a test in sky_shell (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: address reviewer comments Created 5 years, 6 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
« no previous file with comments | « sky/shell/BUILD.gn ('k') | sky/shell/linux/platform_service_provider_linux.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: sky/shell/linux/main.cc
diff --git a/sky/shell/linux/main.cc b/sky/shell/linux/main.cc
index f6beeabe2d708995ed79105828bc36b44d8583a5..d04d290d0b3149c88f11875faa12f70f378d4500 100644
--- a/sky/shell/linux/main.cc
+++ b/sky/shell/linux/main.cc
@@ -16,6 +16,7 @@
#include "sky/shell/shell.h"
#include "sky/shell/shell_view.h"
#include "sky/shell/switches.h"
+#include "sky/shell/testing/test_runner.h"
namespace sky {
namespace shell {
@@ -23,39 +24,26 @@ namespace {
void Usage() {
std::cerr << "Usage: sky_shell"
- << " [MAIN_DART --" << switches::kPackageRoot << "=PACKAGE_ROOT]"
- << " [--" << switches::kSnapshot << "=SNAPSHOT]" << std::endl;
+ << " --" << switches::kPackageRoot << "=PACKAGE_ROOT"
+ << " [ MAIN_DART ]" << std::endl;
}
void Init() {
Shell::Init(make_scoped_ptr(new ServiceProviderContext(
base::MessageLoop::current()->task_runner())));
- // TODO(abarth): Currently we leak the ShellView.
- ShellView* shell_view = new ShellView(Shell::Shared());
-
- ViewportObserverPtr viewport_observer;
- shell_view->view()->ConnectToViewportObserver(GetProxy(&viewport_observer));
-
base::CommandLine& command_line = *base::CommandLine::ForCurrentProcess();
- if (command_line.HasSwitch(switches::kSnapshot)) {
- std::string snapshot =
- command_line.GetSwitchValueASCII(switches::kSnapshot);
- viewport_observer->RunFromSnapshot(snapshot);
- return;
- }
+ std::string package_root =
+ command_line.GetSwitchValueASCII(switches::kPackageRoot);
- if (command_line.HasSwitch(switches::kPackageRoot)) {
- std::string main = command_line.GetArgs()[0];
- std::string package_root =
- command_line.GetSwitchValueASCII(switches::kPackageRoot);
- viewport_observer->RunFromFile(main, package_root);
- return;
- }
+ std::string main;
+ auto args = command_line.GetArgs();
+ if (!args.empty())
+ main = args[0];
- std::cerr << "One of --" << switches::kPackageRoot << " or --"
- << switches::kSnapshot << " is required." << std::endl;
+ TestRunner::Shared().set_package_root(package_root);
+ TestRunner::Shared().Start(main);
}
} // namespace
@@ -68,7 +56,8 @@ int main(int argc, const char* argv[]) {
base::CommandLine& command_line = *base::CommandLine::ForCurrentProcess();
- if (command_line.HasSwitch(sky::shell::switches::kHelp)) {
+ if (command_line.HasSwitch(sky::shell::switches::kHelp) ||
+ !command_line.HasSwitch(sky::shell::switches::kPackageRoot)) {
sky::shell::Usage();
return 0;
}
« no previous file with comments | « sky/shell/BUILD.gn ('k') | sky/shell/linux/platform_service_provider_linux.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698