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

Side by Side Diff: ui/views/widget/desktop_aura/desktop_native_widget_aura_unittest.cc

Issue 2217233002: Fix an ODR violation for ModalDialogDelegate found by ASan (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 4 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
« no previous file with comments | « no previous file | ui/views/widget/widget_unittest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 "ui/views/widget/desktop_aura/desktop_native_widget_aura.h" 5 #include "ui/views/widget/desktop_aura/desktop_native_widget_aura.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/macros.h" 8 #include "base/macros.h"
9 #include "base/run_loop.h" 9 #include "base/run_loop.h"
10 #include "build/build_config.h" 10 #include "build/build_config.h"
(...skipping 491 matching lines...) Expand 10 before | Expand all | Expand 10 after
502 // Verifies deleting the widget from a mouse pressed event doesn't crash. 502 // Verifies deleting the widget from a mouse pressed event doesn't crash.
503 TEST_F(DesktopAuraWidgetTest, CloseWidgetDuringMousePress) { 503 TEST_F(DesktopAuraWidgetTest, CloseWidgetDuringMousePress) {
504 RunCloseWidgetDuringDispatchTest(this, ui::ET_MOUSE_PRESSED); 504 RunCloseWidgetDuringDispatchTest(this, ui::ET_MOUSE_PRESSED);
505 } 505 }
506 506
507 // Verifies deleting the widget from a mouse released event doesn't crash. 507 // Verifies deleting the widget from a mouse released event doesn't crash.
508 TEST_F(DesktopAuraWidgetTest, CloseWidgetDuringMouseReleased) { 508 TEST_F(DesktopAuraWidgetTest, CloseWidgetDuringMouseReleased) {
509 RunCloseWidgetDuringDispatchTest(this, ui::ET_MOUSE_RELEASED); 509 RunCloseWidgetDuringDispatchTest(this, ui::ET_MOUSE_RELEASED);
510 } 510 }
511 511
512 namespace {
513
512 // Provides functionality to create a window modal dialog. 514 // Provides functionality to create a window modal dialog.
513 class ModalDialogDelegate : public DialogDelegateView { 515 class ModalDialogDelegate : public DialogDelegateView {
514 public: 516 public:
515 ModalDialogDelegate() {} 517 ModalDialogDelegate() {}
516 ~ModalDialogDelegate() override {} 518 ~ModalDialogDelegate() override {}
517 519
518 // WidgetDelegate overrides. 520 // WidgetDelegate overrides.
519 ui::ModalType GetModalType() const override { return ui::MODAL_TYPE_WINDOW; } 521 ui::ModalType GetModalType() const override { return ui::MODAL_TYPE_WINDOW; }
520 522
521 private: 523 private:
522 DISALLOW_COPY_AND_ASSIGN(ModalDialogDelegate); 524 DISALLOW_COPY_AND_ASSIGN(ModalDialogDelegate);
523 }; 525 };
524 526
527 } // namespace
528
525 // This test verifies that whether mouse events when a modal dialog is 529 // This test verifies that whether mouse events when a modal dialog is
526 // displayed are eaten or recieved by the dialog. 530 // displayed are eaten or recieved by the dialog.
527 TEST_F(WidgetTest, WindowMouseModalityTest) { 531 TEST_F(WidgetTest, WindowMouseModalityTest) {
528 // Create a top level widget. 532 // Create a top level widget.
529 Widget top_level_widget; 533 Widget top_level_widget;
530 Widget::InitParams init_params = 534 Widget::InitParams init_params =
531 CreateParams(Widget::InitParams::TYPE_WINDOW); 535 CreateParams(Widget::InitParams::TYPE_WINDOW);
532 init_params.show_state = ui::SHOW_STATE_NORMAL; 536 init_params.show_state = ui::SHOW_STATE_NORMAL;
533 gfx::Rect initial_bounds(0, 0, 500, 500); 537 gfx::Rect initial_bounds(0, 0, 500, 500);
534 init_params.bounds = initial_bounds; 538 init_params.bounds = initial_bounds;
(...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after
654 target->HandleKeyboardMessage(WM_CHAR, 0, 0, &handled); 658 target->HandleKeyboardMessage(WM_CHAR, 0, 0, &handled);
655 target->HandleKeyboardMessage(WM_SYSCHAR, 0, 0, &handled); 659 target->HandleKeyboardMessage(WM_SYSCHAR, 0, 0, &handled);
656 target->HandleKeyboardMessage(WM_SYSDEADCHAR, 0, 0, &handled); 660 target->HandleKeyboardMessage(WM_SYSDEADCHAR, 0, 0, &handled);
657 widget.CloseNow(); 661 widget.CloseNow();
658 } 662 }
659 663
660 #endif // defined(OS_WIN) 664 #endif // defined(OS_WIN)
661 665
662 } // namespace test 666 } // namespace test
663 } // namespace views 667 } // namespace views
OLDNEW
« no previous file with comments | « no previous file | ui/views/widget/widget_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698