| 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/test/ui/ui_test.h" | 5 #include "chrome/test/ui/ui_test.h" |
| 6 | 6 |
| 7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
| 8 #include "base/path_service.h" | 8 #include "base/path_service.h" |
| 9 #include "base/process/launch.h" | 9 #include "base/process/launch.h" |
| 10 #include "chrome/browser/chrome_notification_types.h" | 10 #include "chrome/browser/chrome_notification_types.h" |
| (...skipping 14 matching lines...) Expand all Loading... |
| 25 | 25 |
| 26 // These tests don't apply to the Mac version; see GetCommandLineForRelaunch | 26 // These tests don't apply to the Mac version; see GetCommandLineForRelaunch |
| 27 // for details. | 27 // for details. |
| 28 #if !defined(OS_MACOSX) | 28 #if !defined(OS_MACOSX) |
| 29 | 29 |
| 30 class ChromeMainTest : public InProcessBrowserTest { | 30 class ChromeMainTest : public InProcessBrowserTest { |
| 31 public: | 31 public: |
| 32 ChromeMainTest() {} | 32 ChromeMainTest() {} |
| 33 | 33 |
| 34 void Relaunch(const CommandLine& new_command_line) { | 34 void Relaunch(const CommandLine& new_command_line) { |
| 35 base::LaunchProcess(new_command_line, base::LaunchOptions(), NULL); | 35 base::LaunchOptions options; |
| 36 #if defined(OS_LINUX) |
| 37 // To prevent accidental privilege sharing to an untrusted child, processes |
| 38 // are started with PR_SET_NO_NEW_PRIVS. Do not set that here, since this |
| 39 // new child will be a test browser process. |
| 40 options.allow_new_privs = true; |
| 41 #endif |
| 42 base::LaunchProcess(new_command_line, options, NULL); |
| 36 } | 43 } |
| 37 }; | 44 }; |
| 38 | 45 |
| 39 // Make sure that the second invocation creates a new window. | 46 // Make sure that the second invocation creates a new window. |
| 40 IN_PROC_BROWSER_TEST_F(ChromeMainTest, SecondLaunch) { | 47 IN_PROC_BROWSER_TEST_F(ChromeMainTest, SecondLaunch) { |
| 41 #if defined(OS_WIN) && defined(USE_ASH) | 48 #if defined(OS_WIN) && defined(USE_ASH) |
| 42 // Disable this test in Metro+Ash for now (http://crbug.com/262796). | 49 // Disable this test in Metro+Ash for now (http://crbug.com/262796). |
| 43 if (CommandLine::ForCurrentProcess()->HasSwitch(switches::kAshBrowserTests)) | 50 if (CommandLine::ForCurrentProcess()->HasSwitch(switches::kAshBrowserTests)) |
| 44 return; | 51 return; |
| 45 #endif | 52 #endif |
| (...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 147 content::NotificationService::AllSources()); | 154 content::NotificationService::AllSources()); |
| 148 Relaunch(new_command_line); | 155 Relaunch(new_command_line); |
| 149 tab_observer.Wait(); | 156 tab_observer.Wait(); |
| 150 | 157 |
| 151 // There should be one normal and one incognito window now. | 158 // There should be one normal and one incognito window now. |
| 152 ASSERT_EQ(2u, chrome::GetTotalBrowserCount()); | 159 ASSERT_EQ(2u, chrome::GetTotalBrowserCount()); |
| 153 ASSERT_EQ(1u, chrome::GetTabbedBrowserCount(profile, host_desktop_type)); | 160 ASSERT_EQ(1u, chrome::GetTabbedBrowserCount(profile, host_desktop_type)); |
| 154 } | 161 } |
| 155 | 162 |
| 156 #endif // !OS_MACOSX | 163 #endif // !OS_MACOSX |
| OLD | NEW |