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 "base/command_line.h" | 5 #include "base/command_line.h" |
6 #include "base/path_service.h" | 6 #include "base/path_service.h" |
7 #include "base/process/kill.h" | 7 #include "base/process/kill.h" |
8 #include "base/process/launch.h" | 8 #include "base/process/launch.h" |
9 #include "base/test/test_timeouts.h" | 9 #include "base/test/test_timeouts.h" |
10 #include "chrome/browser/chrome_notification_types.h" | 10 #include "chrome/browser/chrome_notification_types.h" |
(...skipping 27 matching lines...) Expand all Loading... |
38 | 38 |
39 base::FilePath test_file_path = ui_test_utils::GetTestFilePath( | 39 base::FilePath test_file_path = ui_test_utils::GetTestFilePath( |
40 base::FilePath(), base::FilePath().AppendASCII("empty.html")); | 40 base::FilePath(), base::FilePath().AppendASCII("empty.html")); |
41 CommandLine new_command_line(GetCommandLineForRelaunch()); | 41 CommandLine new_command_line(GetCommandLineForRelaunch()); |
42 new_command_line.AppendArgPath(test_file_path); | 42 new_command_line.AppendArgPath(test_file_path); |
43 | 43 |
44 content::WindowedNotificationObserver observer( | 44 content::WindowedNotificationObserver observer( |
45 chrome::NOTIFICATION_TAB_ADDED, | 45 chrome::NOTIFICATION_TAB_ADDED, |
46 content::NotificationService::AllSources()); | 46 content::NotificationService::AllSources()); |
47 | 47 |
| 48 base::LaunchOptions options; |
| 49 #if defined(OS_LINUX) |
| 50 // To prevent accidental privilege sharing to an untrusted child, processes |
| 51 // are started with PR_SET_NO_NEW_PRIVS. Do not set that here, since this |
| 52 // new child will be a test browser process. |
| 53 options.allow_new_privs = true; |
| 54 #endif |
48 base::ProcessHandle handle; | 55 base::ProcessHandle handle; |
49 bool launched = | 56 bool launched = |
50 base::LaunchProcess(new_command_line, base::LaunchOptions(), &handle); | 57 base::LaunchProcess(new_command_line, options, &handle); |
51 EXPECT_TRUE(launched); | 58 EXPECT_TRUE(launched); |
52 | 59 |
53 observer.Wait(); | 60 observer.Wait(); |
54 | 61 |
55 int exit_code = -100; | 62 int exit_code = -100; |
56 bool exited = | 63 bool exited = |
57 base::WaitForExitCodeWithTimeout(handle, &exit_code, | 64 base::WaitForExitCodeWithTimeout(handle, &exit_code, |
58 TestTimeouts::action_timeout()); | 65 TestTimeouts::action_timeout()); |
59 | 66 |
60 EXPECT_TRUE(exited); | 67 EXPECT_TRUE(exited); |
61 EXPECT_EQ(chrome::RESULT_CODE_NORMAL_EXIT_PROCESS_NOTIFIED, exit_code); | 68 EXPECT_EQ(chrome::RESULT_CODE_NORMAL_EXIT_PROCESS_NOTIFIED, exit_code); |
62 base::CloseProcessHandle(handle); | 69 base::CloseProcessHandle(handle); |
63 } | 70 } |
64 | 71 |
65 // Disabled due to http://crbug.com/144393. | 72 // Disabled due to http://crbug.com/144393. |
66 IN_PROC_BROWSER_TEST_F(CloudPrintPolicyTest, DISABLED_CloudPrintPolicyFlag) { | 73 IN_PROC_BROWSER_TEST_F(CloudPrintPolicyTest, DISABLED_CloudPrintPolicyFlag) { |
67 CommandLine new_command_line(GetCommandLineForRelaunch()); | 74 CommandLine new_command_line(GetCommandLineForRelaunch()); |
68 new_command_line.AppendSwitch(switches::kCheckCloudPrintConnectorPolicy); | 75 new_command_line.AppendSwitch(switches::kCheckCloudPrintConnectorPolicy); |
69 | 76 |
| 77 base::LaunchOptions options; |
| 78 #if defined(OS_LINUX) |
| 79 // To prevent accidental privilege sharing to an untrusted child, processes |
| 80 // are started with PR_SET_NO_NEW_PRIVS. Do not set that here, since this |
| 81 // new child will be a test browser process. |
| 82 options.allow_new_privs = true; |
| 83 #endif |
70 base::ProcessHandle handle; | 84 base::ProcessHandle handle; |
71 bool launched = | 85 bool launched = |
72 base::LaunchProcess(new_command_line, base::LaunchOptions(), &handle); | 86 base::LaunchProcess(new_command_line, options, &handle); |
73 EXPECT_TRUE(launched); | 87 EXPECT_TRUE(launched); |
74 | 88 |
75 int exit_code = -100; | 89 int exit_code = -100; |
76 bool exited = | 90 bool exited = |
77 base::WaitForExitCodeWithTimeout(handle, &exit_code, | 91 base::WaitForExitCodeWithTimeout(handle, &exit_code, |
78 TestTimeouts::action_timeout()); | 92 TestTimeouts::action_timeout()); |
79 | 93 |
80 EXPECT_TRUE(exited); | 94 EXPECT_TRUE(exited); |
81 EXPECT_EQ(content::RESULT_CODE_NORMAL_EXIT, exit_code); | 95 EXPECT_EQ(content::RESULT_CODE_NORMAL_EXIT, exit_code); |
82 base::CloseProcessHandle(handle); | 96 base::CloseProcessHandle(handle); |
83 } | 97 } |
84 | 98 |
85 } // namespace | 99 } // namespace |
OLD | NEW |