Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(2093)

Unified Diff: ui/views/window/dialog_delegate_unittest.cc

Issue 933893003: Use standard icon/title in global error bubble (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « ui/views/widget/widget.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/views/window/dialog_delegate_unittest.cc
diff --git a/ui/views/window/dialog_delegate_unittest.cc b/ui/views/window/dialog_delegate_unittest.cc
index 7f9149065da2636b9c5614aabf9ec95871a5e04e..9a653e65af0ed5c186b8d432d8b301c2fcaaaf07 100644
--- a/ui/views/window/dialog_delegate_unittest.cc
+++ b/ui/views/window/dialog_delegate_unittest.cc
@@ -26,6 +26,11 @@ class TestDialog : public DialogDelegateView, public ButtonListener {
last_pressed_button_(NULL) {}
~TestDialog() override {}
+ // WidgetDelegate overrides:
+ bool ShouldShowWindowTitle() const override {
+ return !title_.empty();
+ }
+
// DialogDelegateView overrides:
bool Cancel() override {
canceled_ = true;
@@ -183,8 +188,8 @@ TEST_F(DialogTest, RemoveDefaultButton) {
delete dialog()->GetDialogClientView()->cancel_button();
}
-TEST_F(DialogTest, HitTest) {
- // Ensure that the new style's BubbleFrameView hit-tests as expected.
+TEST_F(DialogTest, HitTest_HiddenTitle) {
+ // Ensure that BubbleFrameView hit-tests as expected when the title is hidden.
const NonClientView* view = dialog()->GetWidget()->non_client_view();
BubbleFrameView* frame = static_cast<BubbleFrameView*>(view->frame_view());
const int border = frame->bubble_border()->GetBorderThickness();
@@ -195,9 +200,36 @@ TEST_F(DialogTest, HitTest) {
} cases[] = {
{ border, HTSYSMENU },
{ border + 10, HTSYSMENU },
+ { border + 20, HTCLIENT },
+ { border + 50, HTCLIENT },
+ { border + 60, HTCLIENT },
+ { 1000, HTNOWHERE },
+ };
+
+ for (size_t i = 0; i < arraysize(cases); ++i) {
+ gfx::Point point(cases[i].point, cases[i].point);
+ EXPECT_EQ(cases[i].hit, frame->NonClientHitTest(point))
+ << " with border: " << border << ", at point " << cases[i].point;
+ }
+}
+
+TEST_F(DialogTest, HitTest_WithTitle) {
+ // Ensure that BubbleFrameView hit-tests as expected when the title is shown.
+ const NonClientView* view = dialog()->GetWidget()->non_client_view();
+ dialog()->set_title(base::ASCIIToUTF16("Title"));
+ dialog()->GetWidget()->UpdateWindowTitle();
+ BubbleFrameView* frame = static_cast<BubbleFrameView*>(view->frame_view());
+ const int border = frame->bubble_border()->GetBorderThickness();
+
+ struct {
+ const int point;
+ const int hit;
+ } cases[] = {
+ { border, HTSYSMENU },
+ { border + 10, HTSYSMENU },
{ border + 20, HTCAPTION },
- { border + 40, HTCLIENT },
{ border + 50, HTCLIENT },
+ { border + 60, HTCLIENT },
{ 1000, HTNOWHERE },
};
« no previous file with comments | « ui/views/widget/widget.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698