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

Side by Side Diff: ui/views/widget/widget_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 | « ui/views/widget/desktop_aura/desktop_native_widget_aura_unittest.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 <algorithm> 5 #include <algorithm>
6 #include <memory> 6 #include <memory>
7 #include <set> 7 #include <set>
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/environment.h" 10 #include "base/environment.h"
(...skipping 3618 matching lines...) Expand 10 before | Expand all | Expand 10 after
3629 // Moving the child to a different widget should call the removals observer. 3629 // Moving the child to a different widget should call the removals observer.
3630 WidgetAutoclosePtr widget2(CreateTopLevelPlatformWidget()); 3630 WidgetAutoclosePtr widget2(CreateTopLevelPlatformWidget());
3631 widget2->client_view()->AddChildView(child); 3631 widget2->client_view()->AddChildView(child);
3632 EXPECT_TRUE(removals_observer.DidRemoveView(child)); 3632 EXPECT_TRUE(removals_observer.DidRemoveView(child));
3633 3633
3634 widget->RemoveRemovalsObserver(&removals_observer); 3634 widget->RemoveRemovalsObserver(&removals_observer);
3635 } 3635 }
3636 3636
3637 #if defined(OS_WIN) 3637 #if defined(OS_WIN)
3638 3638
3639 namespace {
3640
3639 // Provides functionality to create a window modal dialog. 3641 // Provides functionality to create a window modal dialog.
3640 class ModalDialogDelegate : public DialogDelegateView { 3642 class ModalDialogDelegate : public DialogDelegateView {
3641 public: 3643 public:
3642 explicit ModalDialogDelegate(ui::ModalType type) : type_(type) {} 3644 explicit ModalDialogDelegate(ui::ModalType type) : type_(type) {}
3643 ~ModalDialogDelegate() override {} 3645 ~ModalDialogDelegate() override {}
3644 3646
3645 // WidgetDelegate overrides. 3647 // WidgetDelegate overrides.
3646 ui::ModalType GetModalType() const override { return type_; } 3648 ui::ModalType GetModalType() const override { return type_; }
3647 3649
3648 private: 3650 private:
3649 const ui::ModalType type_; 3651 const ui::ModalType type_;
3650 3652
3651 DISALLOW_COPY_AND_ASSIGN(ModalDialogDelegate); 3653 DISALLOW_COPY_AND_ASSIGN(ModalDialogDelegate);
3652 }; 3654 };
3653 3655
3656 } // namespace
3657
3654 // Tests the case where an intervening owner popup window is destroyed out from 3658 // Tests the case where an intervening owner popup window is destroyed out from
3655 // under the currently active modal top-level window. In this instance, the 3659 // under the currently active modal top-level window. In this instance, the
3656 // remaining top-level windows should be re-enabled. 3660 // remaining top-level windows should be re-enabled.
3657 TEST_F(WidgetTest, WindowModalOwnerDestroyedEnabledTest) { 3661 TEST_F(WidgetTest, WindowModalOwnerDestroyedEnabledTest) {
3658 // Modality etc. are controlled by mus. 3662 // Modality etc. are controlled by mus.
3659 if (IsMus()) 3663 if (IsMus())
3660 return; 3664 return;
3661 // top_level_widget owns owner_dialog_widget which owns owned_dialog_widget. 3665 // top_level_widget owns owner_dialog_widget which owns owned_dialog_widget.
3662 Widget top_level_widget; 3666 Widget top_level_widget;
3663 Widget owner_dialog_widget; 3667 Widget owner_dialog_widget;
(...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after
3799 CreateParams(Widget::InitParams::TYPE_WINDOW), 3803 CreateParams(Widget::InitParams::TYPE_WINDOW),
3800 Widget::InitParams::TRANSLUCENT_WINDOW); 3804 Widget::InitParams::TRANSLUCENT_WINDOW);
3801 EXPECT_EQ(IsNativeWindowTransparent(widget.GetNativeWindow()), 3805 EXPECT_EQ(IsNativeWindowTransparent(widget.GetNativeWindow()),
3802 widget.ShouldWindowContentsBeTransparent()); 3806 widget.ShouldWindowContentsBeTransparent());
3803 } 3807 }
3804 3808
3805 #endif // !defined(OS_CHROMEOS) 3809 #endif // !defined(OS_CHROMEOS)
3806 3810
3807 } // namespace test 3811 } // namespace test
3808 } // namespace views 3812 } // namespace views
OLDNEW
« no previous file with comments | « ui/views/widget/desktop_aura/desktop_native_widget_aura_unittest.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698