Commit 51461a9a authored by Elly Fong-Jones's avatar Elly Fong-Jones Committed by Commit Bot

cbuiv: reinstate session crashed bubble's close button

This change also adds a unit test to validate this behavior.

Bug: 1081393
Change-Id: Ia7354b3cab0adbe0cf83f41084e0402073036446
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2199398
Commit-Queue: Elly Fong-Jones <ellyjones@chromium.org>
Reviewed-by: default avatarPeter Kasting <pkasting@chromium.org>
Cr-Commit-Position: refs/heads/master@{#768506}
parent a8cdf5a0
......@@ -171,10 +171,13 @@ SessionCrashedBubbleView::SessionCrashedBubbleView(views::View* anchor_view,
ignored_(true) {
DCHECK(anchor_view);
SetShowCloseButton(true);
SetTitle(l10n_util::GetStringUTF16(IDS_SESSION_CRASHED_BUBBLE_TITLE));
// Allow unit tests to leave out Browser.
const SessionStartupPref session_startup_pref =
SessionStartupPref::GetStartupPref(browser_->profile());
browser_ ? SessionStartupPref::GetStartupPref(browser_->profile())
: SessionStartupPref{SessionStartupPref::DEFAULT};
// Offer the option to open the startup pages using the cancel button, but
// only when the user has selected the URLS option, and set at least one url.
DialogDelegate::SetButtons(
......
......@@ -35,6 +35,11 @@ class SessionCrashedBubbleView : public SessionCrashedBubble,
static void Show(std::unique_ptr<BrowserRemovalObserver> browser_observer,
bool uma_opted_in_already);
SessionCrashedBubbleView(views::View* anchor_view,
Browser* browser,
bool offer_uma_optin);
~SessionCrashedBubbleView() override;
protected:
// views::BubbleDialogDelegateView:
ax::mojom::Role GetAccessibleWindowRole() override;
......@@ -42,11 +47,6 @@ class SessionCrashedBubbleView : public SessionCrashedBubble,
private:
friend class SessionCrashedBubbleViewTest;
SessionCrashedBubbleView(views::View* anchor_view,
Browser* browser,
bool offer_uma_optin);
~SessionCrashedBubbleView() override;
// WidgetDelegateView methods.
void OnWidgetDestroying(views::Widget* widget) override;
......
// Copyright 2020 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "chrome/browser/ui/views/session_crashed_bubble_view.h"
#include "chrome/test/views/chrome_views_test_base.h"
using SessionCrashedBubbleViewUnitTest = ChromeViewsTestBase;
TEST_F(SessionCrashedBubbleViewUnitTest, BubbleHasCloseButton) {
views::View anchor;
SessionCrashedBubbleView bubble(&anchor, nullptr, true);
EXPECT_TRUE(bubble.ShouldShowCloseButton());
}
......@@ -5425,6 +5425,7 @@ test("unit_tests") {
"../browser/ui/views/relaunch_notification/relaunch_notification_controller_unittest.cc",
"../browser/ui/views/relaunch_notification/relaunch_required_timer_internal_unittest.cc",
"../browser/ui/views/send_tab_to_self/send_tab_to_self_bubble_view_impl_unittest.cc",
"../browser/ui/views/session_crashed_bubble_view_unittest.cc",
"../browser/ui/views/status_icons/status_tray_win_unittest.cc",
"../browser/ui/views/tab_contents/chrome_web_contents_view_delegate_views_unittest.cc",
"../browser/ui/views/tabs/color_picker_view_unittest.cc",
......
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