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 29 matching lines...) Expand all Loading... |
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::ProcessHandle handle; | 48 base::ProcessHandle handle; |
49 bool launched = | 49 bool launched = |
50 base::LaunchProcess(new_command_line, base::LaunchOptions(), &handle); | 50 base::LaunchProcess(new_command_line, base::LaunchOptionsForTest(), |
| 51 &handle); |
51 EXPECT_TRUE(launched); | 52 EXPECT_TRUE(launched); |
52 | 53 |
53 observer.Wait(); | 54 observer.Wait(); |
54 | 55 |
55 int exit_code = -100; | 56 int exit_code = -100; |
56 bool exited = | 57 bool exited = |
57 base::WaitForExitCodeWithTimeout(handle, &exit_code, | 58 base::WaitForExitCodeWithTimeout(handle, &exit_code, |
58 TestTimeouts::action_timeout()); | 59 TestTimeouts::action_timeout()); |
59 | 60 |
60 EXPECT_TRUE(exited); | 61 EXPECT_TRUE(exited); |
61 EXPECT_EQ(chrome::RESULT_CODE_NORMAL_EXIT_PROCESS_NOTIFIED, exit_code); | 62 EXPECT_EQ(chrome::RESULT_CODE_NORMAL_EXIT_PROCESS_NOTIFIED, exit_code); |
62 base::CloseProcessHandle(handle); | 63 base::CloseProcessHandle(handle); |
63 } | 64 } |
64 | 65 |
65 // Disabled due to http://crbug.com/144393. | 66 // Disabled due to http://crbug.com/144393. |
66 IN_PROC_BROWSER_TEST_F(CloudPrintPolicyTest, DISABLED_CloudPrintPolicyFlag) { | 67 IN_PROC_BROWSER_TEST_F(CloudPrintPolicyTest, DISABLED_CloudPrintPolicyFlag) { |
67 CommandLine new_command_line(GetCommandLineForRelaunch()); | 68 CommandLine new_command_line(GetCommandLineForRelaunch()); |
68 new_command_line.AppendSwitch(switches::kCheckCloudPrintConnectorPolicy); | 69 new_command_line.AppendSwitch(switches::kCheckCloudPrintConnectorPolicy); |
69 | 70 |
70 base::ProcessHandle handle; | 71 base::ProcessHandle handle; |
71 bool launched = | 72 bool launched = |
72 base::LaunchProcess(new_command_line, base::LaunchOptions(), &handle); | 73 base::LaunchProcess(new_command_line, base::LaunchOptionsForTest(), |
| 74 &handle); |
73 EXPECT_TRUE(launched); | 75 EXPECT_TRUE(launched); |
74 | 76 |
75 int exit_code = -100; | 77 int exit_code = -100; |
76 bool exited = | 78 bool exited = |
77 base::WaitForExitCodeWithTimeout(handle, &exit_code, | 79 base::WaitForExitCodeWithTimeout(handle, &exit_code, |
78 TestTimeouts::action_timeout()); | 80 TestTimeouts::action_timeout()); |
79 | 81 |
80 EXPECT_TRUE(exited); | 82 EXPECT_TRUE(exited); |
81 EXPECT_EQ(content::RESULT_CODE_NORMAL_EXIT, exit_code); | 83 EXPECT_EQ(content::RESULT_CODE_NORMAL_EXIT, exit_code); |
82 base::CloseProcessHandle(handle); | 84 base::CloseProcessHandle(handle); |
83 } | 85 } |
84 | 86 |
85 } // namespace | 87 } // namespace |
OLD | NEW |