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..83c130217e4762f2b23043d7374d56aee7e0982f |
| --- /dev/null |
| +++ b/chrome/browser/ui/views/hung_renderer_view_browsertest.cc |
| @@ -0,0 +1,54 @@ |
| +// Copyright (c) 2012 The Chromium Authors. All rights reserved. |
|
tapted
2017/02/01 00:52:48
nit: 2017
Bret
2017/02/01 02:21:46
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. |
| +class HungRendererDialogViewBrowserTest : public DialogBrowserTest { |
| + public: |
| + HungRendererDialogViewBrowserTest() {} |
| + |
| + // TestDialogInterface: |
|
tapted
2017/02/01 00:52:48
// DialogBrowserTest:
(sorry - I'll update that d
Bret
2017/02/01 02:21:46
Done. I took it from the collected cookies version
|
| + void ShowDialog(const std::string& name) override { |
| + content::WebContents* web_contents = |
| + browser()->tab_strip_model()->GetActiveWebContents(); |
| + TabDialogs::FromWebContents(web_contents) |
| + ->ShowHungRendererDialog(content::WebContentsUnresponsiveState()); |
| + } |
| + |
| + views::Widget* widget_; |
|
tapted
2017/02/01 00:52:48
unused?
Bret
2017/02/01 02:21:46
Oops yeah. Removed.
|
| + |
| + private: |
| + DISALLOW_COPY_AND_ASSIGN(HungRendererDialogViewBrowserTest); |
| +}; |
| + |
| +class HungRendererDialogViewBrowserTestMd |
| + : public HungRendererDialogViewBrowserTest { |
| + public: |
| + HungRendererDialogViewBrowserTestMd() {} |
| + |
| + // content::BrowserTestBase: |
| + void SetUpCommandLine(base::CommandLine* command_line) override { |
|
tapted
2017/02/01 00:52:48
I think this can be merged into the above test har
Bret
2017/02/01 02:21:46
Done.
|
| + command_line->AppendSwitch(switches::kExtendMdToSecondaryUi); |
| + } |
| + |
| + private: |
| + DISALLOW_COPY_AND_ASSIGN(HungRendererDialogViewBrowserTestMd); |
| +}; |
| + |
| +IN_PROC_BROWSER_TEST_F(HungRendererDialogViewBrowserTestMd, |
|
tapted
2017/02/01 00:52:48
nit: add a comment (I try to ensure every TEST_F h
Bret
2017/02/01 02:21:46
I don't like the idea of baking the invocation int
|
| + InvokeDialog_default) { |
| + RunDialog(); |
| +} |