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

Side by Side Diff: ui/views/window/dialog_delegate_unittest.cc

Issue 2785683003: views: implement width snapping for DialogDelegateViews (Closed)
Patch Set: Created 3 years, 8 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 unified diff | Download patch
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include <stddef.h> 5 #include <stddef.h>
6 6
7 #include "base/macros.h" 7 #include "base/macros.h"
8 #include "base/strings/utf_string_conversions.h" 8 #include "base/strings/utf_string_conversions.h"
9 #include "ui/base/hit_test.h" 9 #include "ui/base/hit_test.h"
10 #include "ui/events/event_processor.h" 10 #include "ui/events/event_processor.h"
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
60 bool Accept() override { 60 bool Accept() override {
61 accepted_ = true; 61 accepted_ = true;
62 return closeable_; 62 return closeable_;
63 } 63 }
64 bool Close() override { 64 bool Close() override {
65 closed_ = true; 65 closed_ = true;
66 return closeable_; 66 return closeable_;
67 } 67 }
68 68
69 // DialogDelegateView overrides: 69 // DialogDelegateView overrides:
70 gfx::Size GetPreferredSize() const override { return gfx::Size(200, 200); } 70 gfx::Size GetUnsnappedPreferredSize() const override {
71 return gfx::Size(200, 200);
72 }
71 bool AcceleratorPressed(const ui::Accelerator& accelerator) override { 73 bool AcceleratorPressed(const ui::Accelerator& accelerator) override {
72 return should_handle_escape_; 74 return should_handle_escape_;
73 } 75 }
74 base::string16 GetWindowTitle() const override { return title_; } 76 base::string16 GetWindowTitle() const override { return title_; }
75 View* GetInitiallyFocusedView() override { return input_; } 77 View* GetInitiallyFocusedView() override { return input_; }
76 bool ShouldUseCustomFrame() const override { return true; } 78 bool ShouldUseCustomFrame() const override { return true; }
77 79
78 void CheckAndResetStates(bool canceled, 80 void CheckAndResetStates(bool canceled,
79 bool accepted, 81 bool accepted,
80 bool closed) { 82 bool closed) {
(...skipping 262 matching lines...) Expand 10 before | Expand all | Expand 10 after
343 // On showing the dialog, the initially focused View will be the OK button. 345 // On showing the dialog, the initially focused View will be the OK button.
344 // Since it is no longer focusable, focus should advance to the next focusable 346 // Since it is no longer focusable, focus should advance to the next focusable
345 // View, which is |textfield|. 347 // View, which is |textfield|.
346 dialog_widget->Show(); 348 dialog_widget->Show();
347 EXPECT_TRUE(textfield->HasFocus()); 349 EXPECT_TRUE(textfield->HasFocus());
348 EXPECT_EQ(textfield, dialog->GetFocusManager()->GetFocusedView()); 350 EXPECT_EQ(textfield, dialog->GetFocusManager()->GetFocusedView());
349 dialog_widget->CloseNow(); 351 dialog_widget->CloseNow();
350 } 352 }
351 353
352 } // namespace views 354 } // namespace views
OLDNEW
« ui/views/window/dialog_delegate.h ('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