OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "shell/command_line_util.h" | 5 #include "shell/command_line_util.h" |
6 | 6 |
7 #include "base/logging.h" | 7 #include "base/logging.h" |
8 #include "testing/gtest/include/gtest/gtest.h" | 8 #include "testing/gtest/include/gtest/gtest.h" |
9 | 9 |
10 namespace shell { | 10 namespace shell { |
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
60 Context context; | 60 Context context; |
61 context.SetCommandLineCWD(base::FilePath("/root")); | 61 context.SetCommandLineCWD(base::FilePath("/root")); |
62 for (auto& expectation : EXPECTATIONS) { | 62 for (auto& expectation : EXPECTATIONS) { |
63 std::vector<std::string> args; | 63 std::vector<std::string> args; |
64 GURL result(GetAppURLAndArgs(&context, expectation.args, &args)); | 64 GURL result(GetAppURLAndArgs(&context, expectation.args, &args)); |
65 EXPECT_EQ(bool(expectation.url), result.is_valid()); | 65 EXPECT_EQ(bool(expectation.url), result.is_valid()); |
66 if (expectation.url && result.is_valid()) { | 66 if (expectation.url && result.is_valid()) { |
67 EXPECT_EQ(GURL(expectation.url), result); | 67 EXPECT_EQ(GURL(expectation.url), result); |
68 std::vector<std::string> expected_args; | 68 std::vector<std::string> expected_args; |
69 if (expectation.values) { | 69 if (expectation.values) { |
70 if (*expectation.values) | |
71 expected_args.push_back(expectation.url); | |
72 for (const char** value = expectation.values; *value; ++value) | 70 for (const char** value = expectation.values; *value; ++value) |
73 expected_args.push_back(*value); | 71 expected_args.push_back(*value); |
74 } | 72 } |
75 EXPECT_EQ(expected_args, args); | 73 EXPECT_EQ(expected_args, args); |
76 } | 74 } |
77 } | 75 } |
78 } | 76 } |
79 | 77 |
80 } // namespace | 78 } // namespace |
81 } // namespace shell | 79 } // namespace shell |
OLD | NEW |