OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 "chrome/common/service_process_util.h" | 5 #include "chrome/common/service_process_util.h" |
6 | 6 |
7 #include "base/basictypes.h" | 7 #include "base/basictypes.h" |
8 #include "base/bind.h" | 8 #include "base/bind.h" |
9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
10 #include "base/files/file_path.h" | 10 #include "base/files/file_path.h" |
(...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
143 EXPECT_TRUE(AutoStart::GetAutostartFileValue( | 143 EXPECT_TRUE(AutoStart::GetAutostartFileValue( |
144 GetServiceProcessScopedName(base_desktop_name), "Exec", &exec_value)); | 144 GetServiceProcessScopedName(base_desktop_name), "Exec", &exec_value)); |
145 | 145 |
146 // Make sure |exec_value| doesn't contain strings a shell would | 146 // Make sure |exec_value| doesn't contain strings a shell would |
147 // treat specially. | 147 // treat specially. |
148 ASSERT_EQ(std::string::npos, exec_value.find('#')); | 148 ASSERT_EQ(std::string::npos, exec_value.find('#')); |
149 ASSERT_EQ(std::string::npos, exec_value.find('\n')); | 149 ASSERT_EQ(std::string::npos, exec_value.find('\n')); |
150 ASSERT_EQ(std::string::npos, exec_value.find('"')); | 150 ASSERT_EQ(std::string::npos, exec_value.find('"')); |
151 ASSERT_EQ(std::string::npos, exec_value.find('\'')); | 151 ASSERT_EQ(std::string::npos, exec_value.find('\'')); |
152 | 152 |
153 base::CommandLine::StringVector argv; | 153 base::CommandLine::StringVector argv = base::SplitString( |
154 base::SplitString(exec_value, ' ', &argv); | 154 exec_value, base::CommandLine::StringType(1, ' '), |
| 155 base::TRIM_WHITESPACE, base::SPLIT_WANT_ALL); |
155 ASSERT_GE(argv.size(), 2U) | 156 ASSERT_GE(argv.size(), 2U) |
156 << "Expected at least one command-line option in: " << exec_value; | 157 << "Expected at least one command-line option in: " << exec_value; |
157 autorun_command_line.reset(new base::CommandLine(argv)); | 158 autorun_command_line.reset(new base::CommandLine(argv)); |
158 #endif // defined(OS_WIN) | 159 #endif // defined(OS_WIN) |
159 if (autorun_command_line.get()) { | 160 if (autorun_command_line.get()) { |
160 EXPECT_EQ(autorun_command_line->GetSwitchValueASCII(switches::kProcessType), | 161 EXPECT_EQ(autorun_command_line->GetSwitchValueASCII(switches::kProcessType), |
161 std::string(switches::kServiceProcess)); | 162 std::string(switches::kServiceProcess)); |
162 } | 163 } |
163 ASSERT_TRUE(state.RemoveFromAutoRun()); | 164 ASSERT_TRUE(state.RemoveFromAutoRun()); |
164 #if defined(OS_WIN) | 165 #if defined(OS_WIN) |
(...skipping 252 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
417 ScopedAttributesRestorer restorer(bundle_path(), 0777); | 418 ScopedAttributesRestorer restorer(bundle_path(), 0777); |
418 GetIOMessageLoopProxy()->PostTask( | 419 GetIOMessageLoopProxy()->PostTask( |
419 FROM_HERE, | 420 FROM_HERE, |
420 base::Bind(&ChangeAttr, bundle_path(), 0222)); | 421 base::Bind(&ChangeAttr, bundle_path(), 0222)); |
421 Run(); | 422 Run(); |
422 ASSERT_TRUE(mock_launchd()->remove_called()); | 423 ASSERT_TRUE(mock_launchd()->remove_called()); |
423 ASSERT_TRUE(mock_launchd()->delete_called()); | 424 ASSERT_TRUE(mock_launchd()->delete_called()); |
424 } | 425 } |
425 | 426 |
426 #endif // !OS_MACOSX | 427 #endif // !OS_MACOSX |
OLD | NEW |