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

Unified Diff: base/command_line_unittest.cc

Issue 4989001: Attempt to reland http://codereview.chromium.org/4928002/... (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 10 years, 1 month 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 | « base/command_line.cc ('k') | chrome/browser/browser_main_win.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: base/command_line_unittest.cc
===================================================================
--- base/command_line_unittest.cc (revision 66087)
+++ base/command_line_unittest.cc (working copy)
@@ -5,8 +5,8 @@
#include <string>
#include <vector>
+#include "base/basictypes.h"
#include "base/command_line.h"
-#include "base/basictypes.h"
#include "base/file_path.h"
#include "base/utf_string_conversions.h"
#include "testing/gtest/include/gtest/gtest.h"
@@ -154,3 +154,28 @@
cl.command_line_string());
#endif
}
+
+// Tests that when AppendArguments is called that the program is set correctly
+// on the target CommandLine object and the switches from the source
+// CommandLine are added to the target.
+TEST(CommandLineTest, AppendArguments) {
+ CommandLine cl1(FilePath(FILE_PATH_LITERAL("Program")));
+ cl1.AppendSwitch("switch1");
+ cl1.AppendSwitchASCII("switch2", "foo");
+
+ CommandLine cl2(CommandLine::NO_PROGRAM);
+ cl2.AppendArguments(cl1, true);
+ EXPECT_EQ(cl1.GetProgram().value(), cl2.GetProgram().value());
+ EXPECT_EQ(cl1.command_line_string(), cl2.command_line_string());
+
+ CommandLine c1(FilePath(FILE_PATH_LITERAL("Program1")));
+ c1.AppendSwitch("switch1");
+ CommandLine c2(FilePath(FILE_PATH_LITERAL("Program2")));
+ c2.AppendSwitch("switch2");
+
+ c1.AppendArguments(c2, true);
+ EXPECT_EQ(c1.GetProgram().value(), c2.GetProgram().value());
+ EXPECT_TRUE(c1.HasSwitch("switch1"));
+ EXPECT_TRUE(c1.HasSwitch("switch2"));
+}
+
« no previous file with comments | « base/command_line.cc ('k') | chrome/browser/browser_main_win.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698