Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(560)

Side by Side Diff: chrome/browser/sessions/session_restore_browsertest.cc

Issue 197213015: [Linux] Use PR_SET_NO_NEW_PRIVS by default in base/process/launch.h. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Address jln's comments Created 6 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 <vector> 5 #include <vector>
6 6
7 #include "base/command_line.h" 7 #include "base/command_line.h"
8 #include "base/files/file_path.h" 8 #include "base/files/file_path.h"
9 #include "base/process/launch.h" 9 #include "base/process/launch.h"
10 #include "base/strings/utf_string_conversions.h" 10 #include "base/strings/utf_string_conversions.h"
(...skipping 905 matching lines...) Expand 10 before | Expand all | Expand 10 after
916 #endif 916 #endif
917 917
918 ui_test_utils::NavigateToURL(browser(), url1_); 918 ui_test_utils::NavigateToURL(browser(), url1_);
919 919
920 // Launch an app. 920 // Launch an app.
921 CommandLine app_launch_arguments = GetCommandLineForRelaunch(); 921 CommandLine app_launch_arguments = GetCommandLineForRelaunch();
922 app_launch_arguments.AppendSwitchASCII(switches::kApp, url2_.spec()); 922 app_launch_arguments.AppendSwitchASCII(switches::kApp, url2_.spec());
923 923
924 ui_test_utils::BrowserAddedObserver window_observer; 924 ui_test_utils::BrowserAddedObserver window_observer;
925 925
926 base::LaunchProcess(app_launch_arguments, base::LaunchOptions(), NULL); 926 base::LaunchOptions options;
927 #if defined(OS_LINUX)
928 // To prevent accidental privilege sharing to an untrusted child, processes
929 // are started with PR_SET_NO_NEW_PRIVS. Do not set that here, since this
930 // new child will be a test browser process.
931 options.allow_new_privs = true;
932 #endif
933 base::LaunchProcess(app_launch_arguments, options, NULL);
927 934
928 Browser* app_window = window_observer.WaitForSingleNewBrowser(); 935 Browser* app_window = window_observer.WaitForSingleNewBrowser();
929 ASSERT_EQ(2u, active_browser_list_->size()); 936 ASSERT_EQ(2u, active_browser_list_->size());
930 937
931 // Close the first window. The only window left is the App window. 938 // Close the first window. The only window left is the App window.
932 CloseBrowserSynchronously(browser()); 939 CloseBrowserSynchronously(browser());
933 940
934 // Restore the session, which should bring back the first window with url1_. 941 // Restore the session, which should bring back the first window with url1_.
935 Browser* new_browser = QuitBrowserAndRestore(app_window, 1); 942 Browser* new_browser = QuitBrowserAndRestore(app_window, 1);
936 943
(...skipping 245 matching lines...) Expand 10 before | Expand all | Expand 10 after
1182 content::NavigationController* controller = 1189 content::NavigationController* controller =
1183 &browser()->tab_strip_model()->GetActiveWebContents()->GetController(); 1190 &browser()->tab_strip_model()->GetActiveWebContents()->GetController();
1184 EXPECT_TRUE( 1191 EXPECT_TRUE(
1185 controller->GetDefaultSessionStorageNamespace()->should_persist()); 1192 controller->GetDefaultSessionStorageNamespace()->should_persist());
1186 1193
1187 // Quit and restore. Check that no extra tabs were created. 1194 // Quit and restore. Check that no extra tabs were created.
1188 Browser* new_browser = QuitBrowserAndRestore(browser(), 1); 1195 Browser* new_browser = QuitBrowserAndRestore(browser(), 1);
1189 ASSERT_EQ(1u, active_browser_list_->size()); 1196 ASSERT_EQ(1u, active_browser_list_->size());
1190 EXPECT_EQ(1, new_browser->tab_strip_model()->count()); 1197 EXPECT_EQ(1, new_browser->tab_strip_model()->count());
1191 } 1198 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698