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

Unified Diff: mojo/shell/context.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/services/html_viewer/ax_provider_apptest.cc ('k') | mojo/shell/desktop/launcher_process.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: mojo/shell/context.cc
diff --git a/mojo/shell/context.cc b/mojo/shell/context.cc
index fc56476f819ea3392cb56a58ddb5b08aa9d4b71b..032d392ea154cee84708737bda5bd13b2a5431ce 100644
--- a/mojo/shell/context.cc
+++ b/mojo/shell/context.cc
@@ -84,6 +84,26 @@ bool ConfigureURLMappings(const base::CommandLine& command_line,
resolver->AddOriginMapping(GURL(origin_mapping.origin),
GURL(origin_mapping.base_url));
+ // TODO(msw): Ensure URL mappings are only used for testing???
+ if (command_line.HasSwitch(switches::kURLMappings)) {
+ const std::string mappings =
+ command_line.GetSwitchValueASCII(switches::kURLMappings);
+
+ base::StringPairs pairs;
+ if (!base::SplitStringIntoKeyValuePairs(mappings, '=', ',', &pairs))
+ return false;
+ using StringPair = std::pair<std::string, std::string>;
+ for (const StringPair& pair : pairs) {
+ const GURL from(pair.first);
+ const GURL to = context->ResolveCommandLineURL(pair.second);
+ //printf("MSW mapping: %s -> %s\n", from.possibly_invalid_spec().c_str(), to.possibly_invalid_spec().c_str());
+ if (!from.is_valid() || !to.is_valid())
+ return false;
+
+ resolver->AddURLMapping(from, to);
+ }
+ }
+
return true;
}
« no previous file with comments | « mojo/services/html_viewer/ax_provider_apptest.cc ('k') | mojo/shell/desktop/launcher_process.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698