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

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

Issue 2880433002: views: don't snap dialogs with no buttons (Closed)
Patch Set: add unittest Created 3 years, 7 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
« ui/views/window/dialog_delegate.cc ('K') | « ui/views/window/dialog_delegate.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 ff365d4f98b2c78200ceb69eaf8c4e087a715e21..59e46551ee5e8186d6a2d29e9030995ae016f0e7 100644
--- a/ui/views/window/dialog_delegate_unittest.cc
+++ b/ui/views/window/dialog_delegate_unittest.cc
@@ -66,6 +66,7 @@ class TestDialog : public DialogDelegateView {
base::string16 GetWindowTitle() const override { return title_; }
View* GetInitiallyFocusedView() override { return input_; }
bool ShouldUseCustomFrame() const override { return true; }
+ int GetDialogButtons() const override { return dialog_buttons_; }
void CheckAndResetStates(bool canceled,
bool accepted,
@@ -90,6 +91,9 @@ class TestDialog : public DialogDelegateView {
void set_should_handle_escape(bool should_handle_escape) {
should_handle_escape_ = should_handle_escape;
}
+ void set_dialog_buttons(int dialog_buttons) {
+ dialog_buttons_ = dialog_buttons;
+ }
views::Textfield* input() { return input_; }
@@ -103,6 +107,7 @@ class TestDialog : public DialogDelegateView {
base::string16 title_;
bool show_close_button_ = true;
bool should_handle_escape_ = false;
+ int dialog_buttons_ = ui::DIALOG_BUTTON_OK | ui::DIALOG_BUTTON_CANCEL;
DISALLOW_COPY_AND_ASSIGN(TestDialog);
};
@@ -382,4 +387,11 @@ TEST_F(DialogTest, UnfocusableInitialFocus) {
dialog_widget->CloseNow();
}
+TEST_F(DialogTest, DontSnapWithoutButtons) {
+ TestDialog dialog;
+ EXPECT_TRUE(dialog.ShouldSnapFrameWidth());
+ dialog.set_dialog_buttons(ui::DIALOG_BUTTON_NONE);
+ EXPECT_FALSE(dialog.ShouldSnapFrameWidth());
+}
+
} // namespace views
« ui/views/window/dialog_delegate.cc ('K') | « ui/views/window/dialog_delegate.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698