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

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

Issue 18339006: Rename RenderViewGone IPC/methods to better reflect reality (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fixes for reviews by creis@ and palmer@. Created 7 years, 5 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 "base/command_line.h" 5 #include "base/command_line.h"
6 #include "base/process_util.h" 6 #include "base/process_util.h"
7 #include "chrome/browser/devtools/devtools_window.h" 7 #include "chrome/browser/devtools/devtools_window.h"
8 #include "chrome/browser/ui/browser.h" 8 #include "chrome/browser/ui/browser.h"
9 #include "chrome/browser/ui/browser_commands.h" 9 #include "chrome/browser/ui/browser_commands.h"
10 #include "chrome/browser/ui/singleton_tabs.h" 10 #include "chrome/browser/ui/singleton_tabs.h"
(...skipping 339 matching lines...) Expand 10 before | Expand all | Expand 10 after
350 350
351 // DevTools start in a separate process. 351 // DevTools start in a separate process.
352 DevToolsWindow::ToggleDevToolsWindow( 352 DevToolsWindow::ToggleDevToolsWindow(
353 devtools, true, DEVTOOLS_TOGGLE_ACTION_INSPECT); 353 devtools, true, DEVTOOLS_TOGGLE_ACTION_INSPECT);
354 host_count++; 354 host_count++;
355 EXPECT_EQ(tab_count, browser()->tab_strip_model()->count()); 355 EXPECT_EQ(tab_count, browser()->tab_strip_model()->count());
356 EXPECT_EQ(host_count, RenderProcessHostCount()); 356 EXPECT_EQ(host_count, RenderProcessHostCount());
357 } 357 }
358 358
359 // This class's goal is to close the browser window when a renderer process has 359 // This class's goal is to close the browser window when a renderer process has
360 // crashed. It does so by monitoring WebContents for RenderViewGone event and 360 // crashed. It does so by monitoring WebContents for RenderProcessGone event and
361 // closing the passed in TabStripModel. This is used in the following test case. 361 // closing the passed in TabStripModel. This is used in the following test case.
362 class WindowDestroyer : public content::WebContentsObserver { 362 class WindowDestroyer : public content::WebContentsObserver {
363 public: 363 public:
364 WindowDestroyer(content::WebContents* web_contents, TabStripModel* model) 364 WindowDestroyer(content::WebContents* web_contents, TabStripModel* model)
365 : content::WebContentsObserver(web_contents), 365 : content::WebContentsObserver(web_contents),
366 tab_strip_model_(model) { 366 tab_strip_model_(model) {
367 } 367 }
368 368
369 virtual void RenderViewGone(base::TerminationStatus status) OVERRIDE { 369 virtual void RenderProcessGone(base::TerminationStatus status) OVERRIDE {
370 // Wait for the window to be destroyed, which will ensure all other 370 // Wait for the window to be destroyed, which will ensure all other
371 // RenderViewHost objects are deleted before we return and proceed with 371 // RenderViewHost objects are deleted before we return and proceed with
372 // the next iteration of notifications. 372 // the next iteration of notifications.
373 content::WindowedNotificationObserver observer( 373 content::WindowedNotificationObserver observer(
374 chrome::NOTIFICATION_BROWSER_CLOSED, 374 chrome::NOTIFICATION_BROWSER_CLOSED,
375 content::NotificationService::AllSources()); 375 content::NotificationService::AllSources());
376 tab_strip_model_->CloseAllTabs(); 376 tab_strip_model_->CloseAllTabs();
377 observer.Wait(); 377 observer.Wait();
378 } 378 }
379 379
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
411 chrome::NOTIFICATION_BROWSER_CLOSED, 411 chrome::NOTIFICATION_BROWSER_CLOSED,
412 content::NotificationService::AllSources()); 412 content::NotificationService::AllSources());
413 413
414 // Kill the renderer process, simulating a crash. This should the ProcessDied 414 // Kill the renderer process, simulating a crash. This should the ProcessDied
415 // method to be called. Alternatively, RenderProcessHost::OnChannelError can 415 // method to be called. Alternatively, RenderProcessHost::OnChannelError can
416 // be called to directly force a call to ProcessDied. 416 // be called to directly force a call to ProcessDied.
417 base::KillProcess(wc1->GetRenderProcessHost()->GetHandle(), -1, true); 417 base::KillProcess(wc1->GetRenderProcessHost()->GetHandle(), -1, true);
418 418
419 observer.Wait(); 419 observer.Wait();
420 } 420 }
OLDNEW
« no previous file with comments | « chrome/browser/printing/print_view_manager.cc ('k') | chrome/browser/tab_contents/background_contents.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698