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

Unified Diff: shell/command_line_util_unittest.cc

Issue 873253003: Resolve URLs passed on the command line relative to the CWD. (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Rebase Created 5 years, 11 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 | « shell/command_line_util.cc ('k') | shell/context.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: shell/command_line_util_unittest.cc
diff --git a/shell/command_line_util_unittest.cc b/shell/command_line_util_unittest.cc
index 0c31eb8ec30f2d369f917ff82365d6a8989442cc..75b233e5c5ffe882d271c045fd8200dcb75a4fc2 100644
--- a/shell/command_line_util_unittest.cc
+++ b/shell/command_line_util_unittest.cc
@@ -46,7 +46,10 @@ TEST(CommandLineUtil, GetAppURLAndArgs) {
const char** values;
} EXPECTATIONS[] = {
{"", nullptr, nullptr},
- {"foo", nullptr, nullptr},
+ {"foo", "file:///root/foo", NO_ARGUMENTS},
+ {"/foo", "file:///foo", NO_ARGUMENTS},
+ {"file:foo", "file:///root/foo", NO_ARGUMENTS},
+ {"file:///foo", "file:///foo", NO_ARGUMENTS},
{"http://example.com", "http://example.com", NO_ARGUMENTS},
{"http://example.com 1", "http://example.com", ONE_ARGUMENTS},
{"http://example.com 1 ", "http://example.com", ONE_ARGUMENTS},
@@ -55,9 +58,11 @@ TEST(CommandLineUtil, GetAppURLAndArgs) {
{" http://example.com 1 two ",
"http://example.com",
TWO_ARGUMENTS}};
+ Context context;
+ context.SetCommandLineCWD(base::FilePath("/root"));
for (auto& expectation : EXPECTATIONS) {
std::vector<std::string> args;
- GURL result(GetAppURLAndArgs(expectation.args, &args));
+ GURL result(GetAppURLAndArgs(&context, expectation.args, &args));
EXPECT_EQ(bool(expectation.url), result.is_valid());
if (expectation.url && result.is_valid()) {
EXPECT_EQ(GURL(expectation.url), result);
« no previous file with comments | « shell/command_line_util.cc ('k') | shell/context.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698