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

Side by Side Diff: chrome/browser/renderer_host/render_process_host_chrome_browsertest.cc

Issue 926663002: Handle RenderProcessHostImpl::SetBackgrounded on Windows (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@908473002_ps2
Patch Set: as an experiment Created 5 years, 10 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
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 "base/command_line.h" 5 #include "base/command_line.h"
6 #include "base/process/process.h" 6 #include "base/process/process.h"
7 #include "chrome/browser/chrome_notification_types.h" 7 #include "chrome/browser/chrome_notification_types.h"
8 #include "chrome/browser/devtools/devtools_window.h" 8 #include "chrome/browser/devtools/devtools_window.h"
9 #include "chrome/browser/search/search.h" 9 #include "chrome/browser/search/search.h"
10 #include "chrome/browser/ui/browser.h" 10 #include "chrome/browser/ui/browser.h"
(...skipping 273 matching lines...) Expand 10 before | Expand all | Expand 10 after
284 browser(), omnibox, NEW_FOREGROUND_TAB, 284 browser(), omnibox, NEW_FOREGROUND_TAB,
285 ui_test_utils::BROWSER_TEST_WAIT_FOR_NAVIGATION); 285 ui_test_utils::BROWSER_TEST_WAIT_FOR_NAVIGATION);
286 tab_count++; 286 tab_count++;
287 EXPECT_EQ(tab_count, browser()->tab_strip_model()->count()); 287 EXPECT_EQ(tab_count, browser()->tab_strip_model()->count());
288 EXPECT_EQ(host_count, RenderProcessHostCount()); 288 EXPECT_EQ(host_count, RenderProcessHostCount());
289 } 289 }
290 290
291 // We don't change process priorities on Mac or Posix because the user lacks the 291 // We don't change process priorities on Mac or Posix because the user lacks the
292 // permission to raise a process' priority even after lowering it. 292 // permission to raise a process' priority even after lowering it.
293 #if defined(OS_WIN) || defined(OS_LINUX) 293 #if defined(OS_WIN) || defined(OS_LINUX)
294 #if defined(OS_WIN) 294 IN_PROC_BROWSER_TEST_F(ChromeRenderProcessHostTest, Backgrounding) {
295 // Flaky test: crbug.com/394368
296 #define MAYBE_Backgrounding DISABLED_Backgrounding
297 #else
298 #define MAYBE_Backgrounding Backgrounding
299 #endif
300 IN_PROC_BROWSER_TEST_F(ChromeRenderProcessHostTest, MAYBE_Backgrounding) {
301 if (!base::Process::CanBackgroundProcesses()) { 295 if (!base::Process::CanBackgroundProcesses()) {
302 LOG(ERROR) << "Can't background processes"; 296 LOG(ERROR) << "Can't background processes";
303 return; 297 return;
304 } 298 }
305 base::CommandLine& parsed_command_line = 299 base::CommandLine& parsed_command_line =
306 *base::CommandLine::ForCurrentProcess(); 300 *base::CommandLine::ForCurrentProcess();
307 parsed_command_line.AppendSwitch(switches::kProcessPerTab); 301 parsed_command_line.AppendSwitch(switches::kProcessPerTab);
308 302
309 // Change the first tab to be the omnibox page (TYPE_WEBUI). 303 // Change the first tab to be the omnibox page (TYPE_WEBUI).
310 GURL omnibox(chrome::kChromeUIOmniboxURL); 304 GURL omnibox(chrome::kChromeUIOmniboxURL);
(...skipping 216 matching lines...) Expand 10 before | Expand all | Expand 10 after
527 chrome::NOTIFICATION_BROWSER_CLOSED, 521 chrome::NOTIFICATION_BROWSER_CLOSED,
528 content::NotificationService::AllSources()); 522 content::NotificationService::AllSources());
529 523
530 // Kill the renderer process, simulating a crash. This should the ProcessDied 524 // Kill the renderer process, simulating a crash. This should the ProcessDied
531 // method to be called. Alternatively, RenderProcessHost::OnChannelError can 525 // method to be called. Alternatively, RenderProcessHost::OnChannelError can
532 // be called to directly force a call to ProcessDied. 526 // be called to directly force a call to ProcessDied.
533 wc1->GetRenderProcessHost()->Shutdown(-1, true); 527 wc1->GetRenderProcessHost()->Shutdown(-1, true);
534 528
535 observer.Wait(); 529 observer.Wait();
536 } 530 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698