Commit 3ccb9455 authored by Michael Giuffrida's avatar Michael Giuffrida Committed by Commit Bot

AppShell: Support --crash-test

Crash intentionally, e.g. to test out the crash reporter.

Example:
  $ ./out/rel/app_shell --crash_test --enable-reporting
  DevTools listening on
  ws://127.0.0.1:37703/devtools/browser/ef324347-b8b4-4660-9270-aca50d1fb9d8

  Redirecting output to ‘wget-log’.

  Crash dump id: d920a038bd86b598
  zsh: illegal hardware instruction  ./out/rel/app_shell

Bug: None
Change-Id: I3f69080f19a81b2661cce4b7ee867378ea166b13
Reviewed-on: https://chromium-review.googlesource.com/966545Reviewed-by: default avatarJames Cook <jamescook@chromium.org>
Commit-Queue: Michael Giuffrida <michaelpg@chromium.org>
Cr-Commit-Position: refs/heads/master@{#543754}
parent 0b7308c3
......@@ -17,6 +17,7 @@
#include "content/public/browser/child_process_security_policy.h"
#include "content/public/browser/context_factory.h"
#include "content/public/browser/devtools_agent_host.h"
#include "content/public/common/content_switches.h"
#include "content/public/common/result_codes.h"
#include "content/shell/browser/shell_devtools_manager_delegate.h"
#include "extensions/browser/browser_context_keyed_service_factories.h"
......@@ -87,6 +88,16 @@ using content::BrowserThread;
namespace extensions {
namespace {
// Intentionally dereferences a null pointer to test the crash reporter.
void CrashForTest() {
int* bad_pointer = nullptr;
*bad_pointer = 0;
}
} // namespace
ShellBrowserMainParts::ShellBrowserMainParts(
const content::MainFunctionParams& parameters,
ShellBrowserMainDelegate* browser_main_delegate)
......@@ -232,6 +243,10 @@ void ShellBrowserMainParts::PreMainMessageLoopRun() {
content::ShellDevToolsManagerDelegate::StartHttpHandler(
browser_context_.get());
if (cmd->HasSwitch(::switches::kBrowserCrashTest))
CrashForTest();
if (parameters_.ui_task) {
// For running browser tests.
parameters_.ui_task->Run();
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment