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

Unified Diff: mojo/shell/desktop/launcher_process.cc

Issue 1070463003: Initialize command line arguments for Mojo apptests. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Restoring url-mappings and specifying test apps on the commandline. Created 5 years, 8 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 | « mojo/shell/context.cc ('k') | mojo/shell/switches.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: mojo/shell/desktop/launcher_process.cc
diff --git a/mojo/shell/desktop/launcher_process.cc b/mojo/shell/desktop/launcher_process.cc
index 09f7fc57e60411668e04279fb751f8c8246226c2..620f9935b7698f3271b4f5ac0aa1c8f9479e1348 100644
--- a/mojo/shell/desktop/launcher_process.cc
+++ b/mojo/shell/desktop/launcher_process.cc
@@ -15,6 +15,7 @@
#include "base/message_loop/message_loop.h"
#include "base/synchronization/waitable_event.h"
#include "base/trace_event/trace_event.h"
+#include "mojo/shell/command_line_util.h"
#include "mojo/shell/context.h"
#include "mojo/shell/switches.h"
@@ -22,6 +23,29 @@ namespace mojo {
namespace shell {
namespace {
+void Usage() {
+ std::cerr << "Launch Mojo applications.\n";
+ std::cerr
+ << "Usage: mojo_shell"
+ << " [--" << switches::kContentHandlers << "=<handlers>]"
+ << " [--" << switches::kDisableCache << "]"
+ << " [--" << switches::kEnableMultiprocess << "]"
+ << " [--" << switches::kOrigin << "=<url-lib-path>]"
+ << " [--" << switches::kTraceStartup << "]"
+ << " [--" << switches::kURLMappings << "=from1=to1,from2=to2]"
+ << " [--" << switches::kPredictableAppFilenames << "]"
+ << " [--" << switches::kWaitForDebugger << "]"
+ << " [--" << switches::kTestApp << "]"
+ << " [<mojo-app>] ...\n\n"
+ << "A <mojo-app> is a Mojo URL or a Mojo URL and arguments within "
+ << "quotes.\n"
+ << "Example: mojo_shell \"mojo:js_standalone test.js\".\n"
+ << "<url-lib-path> is searched for shared libraries named by mojo URLs.\n"
+ << "The value of <handlers> is a comma separated list like:\n"
+ << "text/html,mojo:html_viewer,"
+ << "application/javascript,mojo:js_content_handler\n";
+}
+
// Whether we're currently tracing.
bool g_tracing = false;
@@ -84,6 +108,12 @@ void StartWindowManager(mojo::shell::Context* context) {
int LauncherProcessMain(int argc, char** argv) {
const base::CommandLine& command_line =
*base::CommandLine::ForCurrentProcess();
+
+ if (command_line.HasSwitch(switches::kHelp)) {
+ Usage();
+ return 0;
+ }
+
if (command_line.HasSwitch(switches::kTraceStartup)) {
g_tracing = true;
base::trace_event::CategoryFilter category_filter(
@@ -99,6 +129,7 @@ int LauncherProcessMain(int argc, char** argv) {
{
base::MessageLoop message_loop;
if (!shell_context.Init()) {
+ Usage();
return 0;
}
if (g_tracing) {
@@ -107,8 +138,22 @@ int LauncherProcessMain(int argc, char** argv) {
base::TimeDelta::FromSeconds(5));
}
- message_loop.PostTask(FROM_HERE,
- base::Bind(&StartWindowManager, &shell_context));
+ // // The mojo_shell --args-for command-line switch is handled specially
+ // // because it can appear more than once. The base::CommandLine class
+ // // collapses multiple occurrences of the same switch.
+ // for (int i = 1; i < argc; i++) {
+ // ApplyApplicationArgs(&shell_context, argv[i]);
+ // }
+
+ if (command_line.HasSwitch(switches::kTestApp)) {
+ message_loop.PostTask(
+ FROM_HERE,
+ base::Bind(&mojo::shell::RunCommandLineApps, &shell_context));
+ } else {
+ message_loop.PostTask(
+ FROM_HERE,
+ base::Bind(&StartWindowManager, &shell_context));
+ }
message_loop.Run();
// Must be called before |message_loop| is destroyed.
« no previous file with comments | « mojo/shell/context.cc ('k') | mojo/shell/switches.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698