Chromium Code Reviews| Index: chrome/browser/ui/views/hung_renderer_view_browsertest.cc |
| diff --git a/chrome/browser/ui/views/hung_renderer_view_browsertest.cc b/chrome/browser/ui/views/hung_renderer_view_browsertest.cc |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..d720fed7700e85af2d25cb7ad9cdb29a9d98c14a |
| --- /dev/null |
| +++ b/chrome/browser/ui/views/hung_renderer_view_browsertest.cc |
| @@ -0,0 +1,45 @@ |
| +// Copyright (c) 2017 The Chromium Authors. All rights reserved. |
|
tapted
2017/02/03 02:07:54
nit: remove (c)
Bret
2017/02/03 21:58:35
Done.
|
| +// Use of this source code is governed by a BSD-style license that can be |
| +// found in the LICENSE file. |
| + |
| +#include <string> |
| + |
| +#include "base/command_line.h" |
| +#include "chrome/browser/platform_util.h" |
| +#include "chrome/browser/ui/browser.cc" |
| +#include "chrome/browser/ui/tab_dialogs.h" |
| +#include "chrome/browser/ui/tabs/tab_strip_model.h" |
| +#include "chrome/browser/ui/test/test_browser_dialog.h" |
| +#include "chrome/browser/ui/views/hung_renderer_view.h" |
| +#include "content/public/browser/web_contents_unresponsive_state.h" |
| +#include "ui/base/ui_base_switches.h" |
| + |
| +// TODO(crbug.com/687387): If the dialog is invisible when invoked interactively |
| +// pass --disable-gpu as a workaround. |
|
tapted
2017/02/03 02:07:54
perhaps merge in the stuff from https://codereview
Bret
2017/02/03 21:58:35
Okay I coordinated with Allen and pulled in his wo
|
| +class HungRendererDialogViewBrowserTest : public DialogBrowserTest { |
| + public: |
| + HungRendererDialogViewBrowserTest() {} |
| + |
| + // DialogBrowserTest: |
| + void ShowDialog(const std::string& name) override { |
| + content::WebContents* web_contents = |
| + browser()->tab_strip_model()->GetActiveWebContents(); |
| + TabDialogs::FromWebContents(web_contents) |
| + ->ShowHungRendererDialog(content::WebContentsUnresponsiveState()); |
| + } |
| + |
| + // content::BrowserTestBase: |
| + void SetUpCommandLine(base::CommandLine* command_line) override { |
| + command_line->AppendSwitch(switches::kExtendMdToSecondaryUi); |
| + } |
| + |
| + private: |
| + DISALLOW_COPY_AND_ASSIGN(HungRendererDialogViewBrowserTest); |
| +}; |
| + |
| +// Invokes the hung renderer (aka page unresponsive) dialog. See |
| +// test_browser_dialog.h. |
| +IN_PROC_BROWSER_TEST_F(HungRendererDialogViewBrowserTest, |
| + InvokeDialog_default) { |
| + RunDialog(); |
| +} |