summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authortc@google.com <tc@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2008-08-14 22:09:39 +0000
committertc@google.com <tc@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2008-08-14 22:09:39 +0000
commite63d59867890b09ccac706b3bc99ec69efd261c1 (patch)
tree01327ba09f7693c310cd737d6bb9b061718d31af
parent51077acd7f613ca7bc38d61ad1d22be2233a6e15 (diff)
downloadchromium_src-e63d59867890b09ccac706b3bc99ec69efd261c1.zip
chromium_src-e63d59867890b09ccac706b3bc99ec69efd261c1.tar.gz
chromium_src-e63d59867890b09ccac706b3bc99ec69efd261c1.tar.bz2
Add command_line_unittest and pr_time_test to the linux set of unittests. Fix the const-ness of argv in CommandLine on posix.
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@901 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r--base/SConscript4
-rw-r--r--base/command_line.cc8
-rw-r--r--base/command_line.h4
-rw-r--r--base/command_line_unittest.cc12
4 files changed, 14 insertions, 14 deletions
diff --git a/base/SConscript b/base/SConscript
index 719b019..de6748f 100644
--- a/base/SConscript
+++ b/base/SConscript
@@ -231,11 +231,13 @@ if env['PLATFORM'] == 'win32':
# cross-platform live below.
test_files = [
'at_exit_unittest.cc',
+ 'command_line_unittest.cc',
'json_reader_unittest.cc',
'json_writer_unittest.cc',
'linked_ptr_unittest.cc',
'observer_list_unittest.cc',
'pickle_unittest.cc',
+ 'pr_time_test.cc',
'ref_counted_unittest.cc',
'run_all_unittests.cc',
'sha2_unittest.cc',
@@ -260,7 +262,6 @@ if env['PLATFORM'] == 'win32':
test_files.extend([
'clipboard_unittest.cc',
- 'command_line_unittest.cc',
'condition_variable_test.cc',
'file_util_unittest.cc',
'idletimer_unittest.cc',
@@ -269,7 +270,6 @@ if env['PLATFORM'] == 'win32':
'object_watcher_unittest.cc',
'path_service_unittest.cc',
'process_util_unittest.cc',
- 'pr_time_test.cc',
'run_all_unittests.cc',
'shared_event_unittest.cc',
'shared_memory_unittest.cc',
diff --git a/base/command_line.cc b/base/command_line.cc
index 4346268..8849149 100644
--- a/base/command_line.cc
+++ b/base/command_line.cc
@@ -91,7 +91,7 @@ class CommandLine::Data {
Init(command_line);
}
#elif defined(OS_POSIX)
- Data(int argc, char** argv) {
+ Data(int argc, const char* const* argv) {
Init(argc, argv);
}
#endif
@@ -131,7 +131,7 @@ class CommandLine::Data {
#elif defined(OS_POSIX)
// Does the actual parsing of the command line.
- void Init(int argc, char** argv) {
+ void Init(int argc, const char* const* argv) {
if (argc < 1)
return;
program_ = base::SysNativeMBToWide(argv[0]);
@@ -225,7 +225,7 @@ CommandLine::CommandLine(const wstring& command_line)
data_(new Data(command_line)) {
}
#elif defined(OS_POSIX)
-CommandLine::CommandLine(const int argc, char** argv)
+CommandLine::CommandLine(const int argc, const char* const* argv)
: we_own_data_(true),
data_(new Data(argc, argv)) {
}
@@ -237,7 +237,7 @@ CommandLine::~CommandLine() {
}
// static
-void CommandLine::SetArgcArgv(int argc, char** argv) {
+void CommandLine::SetArgcArgv(int argc, const char* const* argv) {
#if !defined(OS_WIN)
Singleton<Data>::get()->Init(argc, argv);
#endif
diff --git a/base/command_line.h b/base/command_line.h
index 72cf8c9..f4f3843 100644
--- a/base/command_line.h
+++ b/base/command_line.h
@@ -55,7 +55,7 @@ class CommandLine {
// The program name is assumed to be the first item in the string.
CommandLine(const std::wstring& command_line);
#elif defined(OS_POSIX)
- CommandLine(int argc, char** argv);
+ CommandLine(int argc, const char* const* argv);
#endif
~CommandLine();
@@ -64,7 +64,7 @@ class CommandLine {
// any members of this class.
// On Windows, this call is a no-op (we instead parse GetCommandLineW()
// directly) because we don't trust the CRT's parsing of the command line.
- static void SetArgcArgv(int argc, char** argv);
+ static void SetArgcArgv(int argc, const char* const* argv);
// Returns true if this command line contains the given switch.
// (Switch names are case-insensitive.)
diff --git a/base/command_line_unittest.cc b/base/command_line_unittest.cc
index d9992c2..c477827 100644
--- a/base/command_line_unittest.cc
+++ b/base/command_line_unittest.cc
@@ -48,12 +48,12 @@ TEST(CommandLineTest, CommandLineConstructor) {
L"--input-translation=\"45\"--output-rotation "
L"\"in the time of submarines...\"");
#elif defined(OS_POSIX)
- char* argv[] = {"program", "--foo=", "-bAr",
- "-Spaetzel=pierogi", "-Baz", "flim",
- "--other-switches=--dog=canine --cat=feline",
- "-spaetzle=Crepe", "-=loosevalue", "flan",
- "--input-translation=45--output-rotation",
- "in the time of submarines..."};
+ const char* argv[] = {"program", "--foo=", "-bAr",
+ "-Spaetzel=pierogi", "-Baz", "flim",
+ "--other-switches=--dog=canine --cat=feline",
+ "-spaetzle=Crepe", "-=loosevalue", "flan",
+ "--input-translation=45--output-rotation",
+ "in the time of submarines..."};
CommandLine cl(arraysize(argv), argv);
#endif
EXPECT_FALSE(cl.command_line_string().empty());