| Index: chrome/browser/ui/test/test_browser_dialog.cc
|
| diff --git a/chrome/browser/ui/test/test_browser_dialog.cc b/chrome/browser/ui/test/test_browser_dialog.cc
|
| index 5ec5e0d9afe01fe996aaa23c811e7a2ba1bb1afd..527a576ae273f2341aca8d47ea2ec75c072451fa 100644
|
| --- a/chrome/browser/ui/test/test_browser_dialog.cc
|
| +++ b/chrome/browser/ui/test/test_browser_dialog.cc
|
| @@ -30,20 +30,19 @@
|
| enum class DialogAction {
|
| INTERACTIVE, // Run interactively.
|
| CLOSE_NOW, // Call Widget::CloseNow().
|
| - CLOSE, // Call Widget::Close().
|
| };
|
|
|
| // Helper to break out of the nested run loop that runs a test dialog.
|
| class WidgetCloser : public views::WidgetObserver {
|
| public:
|
| WidgetCloser(views::Widget* widget, DialogAction action)
|
| - : action_(action), widget_(widget), weak_ptr_factory_(this) {
|
| + : widget_(widget), weak_ptr_factory_(this) {
|
| widget->AddObserver(this);
|
| if (action == DialogAction::INTERACTIVE)
|
| return;
|
|
|
| base::ThreadTaskRunnerHandle::Get()->PostTask(
|
| - FROM_HERE, base::BindOnce(&WidgetCloser::CloseAction,
|
| + FROM_HERE, base::BindOnce(&WidgetCloser::CloseNow,
|
| weak_ptr_factory_.GetWeakPtr()));
|
| }
|
|
|
| @@ -55,24 +54,11 @@
|
| }
|
|
|
| private:
|
| - void CloseAction() {
|
| - if (!widget_)
|
| - return;
|
| -
|
| - switch (action_) {
|
| - case DialogAction::CLOSE_NOW:
|
| - widget_->CloseNow();
|
| - break;
|
| - case DialogAction::CLOSE:
|
| - widget_->Close();
|
| - break;
|
| - case DialogAction::INTERACTIVE:
|
| - NOTREACHED();
|
| - break;
|
| - }
|
| + void CloseNow() {
|
| + if (widget_)
|
| + widget_->CloseNow();
|
| }
|
|
|
| - const DialogAction action_;
|
| views::Widget* widget_;
|
|
|
| base::WeakPtrFactory<WidgetCloser> weak_ptr_factory_;
|
| @@ -138,20 +124,11 @@
|
| // views dialog, or if more than one child dialog was shown.
|
| ASSERT_EQ(1u, added.size());
|
|
|
| - DialogAction action = DialogAction::CLOSE_NOW;
|
| - if (base::CommandLine::ForCurrentProcess()->HasSwitch(
|
| - internal::kInteractiveSwitch)) {
|
| - action = DialogAction::INTERACTIVE;
|
| - } else if (AlwaysCloseAsynchronously()) {
|
| - // TODO(tapted): Iterate over close methods when non-interactive for greater
|
| - // test coverage.
|
| - action = DialogAction::CLOSE;
|
| - }
|
| + const DialogAction action = base::CommandLine::ForCurrentProcess()->HasSwitch(
|
| + internal::kInteractiveSwitch)
|
| + ? DialogAction::INTERACTIVE
|
| + : DialogAction::CLOSE_NOW;
|
|
|
| WidgetCloser closer(added[0], action);
|
| ::test::RunTestInteractively();
|
| }
|
| -
|
| -bool TestBrowserDialog::AlwaysCloseAsynchronously() {
|
| - return false;
|
| -}
|
|
|