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

Side by Side Diff: ui/views/widget/widget_unittest.cc

Issue 14696007: Warn on missing OVERRIDE/virtual everywhere, not just in header files. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 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 unified diff | Download patch | Annotate | Revision Log
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 "base/basictypes.h" 5 #include "base/basictypes.h"
6 #include "base/memory/scoped_ptr.h" 6 #include "base/memory/scoped_ptr.h"
7 #include "base/message_loop.h" 7 #include "base/message_loop.h"
8 #include "base/utf_string_conversions.h" 8 #include "base/utf_string_conversions.h"
9 #include "testing/gtest/include/gtest/gtest.h" 9 #include "testing/gtest/include/gtest/gtest.h"
10 #include "ui/base/events/event_utils.h" 10 #include "ui/base/events/event_utils.h"
(...skipping 1726 matching lines...) Expand 10 before | Expand all | Expand 10 after
1737 EXPECT_TRUE(delegate->on_before_init_called()); 1737 EXPECT_TRUE(delegate->on_before_init_called());
1738 EXPECT_TRUE(delegate->is_top_level()); 1738 EXPECT_TRUE(delegate->is_top_level());
1739 } 1739 }
1740 1740
1741 // A scumbag View that deletes its owning widget OnMousePressed. 1741 // A scumbag View that deletes its owning widget OnMousePressed.
1742 class WidgetDeleterView : public View { 1742 class WidgetDeleterView : public View {
1743 public: 1743 public:
1744 WidgetDeleterView() : View() {} 1744 WidgetDeleterView() : View() {}
1745 1745
1746 // Overridden from View. 1746 // Overridden from View.
1747 bool OnMousePressed(const ui::MouseEvent& event) OVERRIDE { 1747 virtual bool OnMousePressed(const ui::MouseEvent& event) OVERRIDE {
1748 delete GetWidget(); 1748 delete GetWidget();
1749 return true; 1749 return true;
1750 } 1750 }
1751 1751
1752 private: 1752 private:
1753 DISALLOW_COPY_AND_ASSIGN(WidgetDeleterView); 1753 DISALLOW_COPY_AND_ASSIGN(WidgetDeleterView);
1754 }; 1754 };
1755 1755
1756 TEST_F(WidgetTest, TestWidgetDeletedInOnMousePressed) { 1756 TEST_F(WidgetTest, TestWidgetDeletedInOnMousePressed) {
1757 Widget* widget = new Widget; 1757 Widget* widget = new Widget;
(...skipping 10 matching lines...) Expand all
1768 gfx::Point click_location(45, 15); 1768 gfx::Point click_location(45, 15);
1769 ui::MouseEvent press(ui::ET_MOUSE_PRESSED, click_location, click_location, 1769 ui::MouseEvent press(ui::ET_MOUSE_PRESSED, click_location, click_location,
1770 ui::EF_LEFT_MOUSE_BUTTON); 1770 ui::EF_LEFT_MOUSE_BUTTON);
1771 widget->OnMouseEvent(&press); 1771 widget->OnMouseEvent(&press);
1772 1772
1773 // Yay we did not crash! 1773 // Yay we did not crash!
1774 } 1774 }
1775 1775
1776 } // namespace 1776 } // namespace
1777 } // namespace views 1777 } // namespace views
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698