| 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;
|
| }
|
|
|