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

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

Issue 10834079: views: Extract Widget observer into its own header file. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 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 | Annotate | Revision Log
« no previous file with comments | « ui/views/widget/widget_observer.h ('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 "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 "testing/gtest/include/gtest/gtest.h" 8 #include "testing/gtest/include/gtest/gtest.h"
9 #include "ui/gfx/native_widget_types.h" 9 #include "ui/gfx/native_widget_types.h"
10 #include "ui/gfx/point.h" 10 #include "ui/gfx/point.h"
(...skipping 592 matching lines...) Expand 10 before | Expand all | Expand 10 after
603 603
604 EXPECT_TRUE(state.widget_deleted); 604 EXPECT_TRUE(state.widget_deleted);
605 EXPECT_TRUE(state.native_widget_deleted); 605 EXPECT_TRUE(state.native_widget_deleted);
606 } 606 }
607 607
608 //////////////////////////////////////////////////////////////////////////////// 608 ////////////////////////////////////////////////////////////////////////////////
609 // Widget observer tests. 609 // Widget observer tests.
610 // 610 //
611 611
612 class WidgetObserverTest : public WidgetTest, 612 class WidgetObserverTest : public WidgetTest,
613 Widget::Observer { 613 public WidgetObserver {
614 public: 614 public:
615 WidgetObserverTest() 615 WidgetObserverTest()
616 : active_(NULL), 616 : active_(NULL),
617 widget_closed_(NULL), 617 widget_closed_(NULL),
618 widget_activated_(NULL), 618 widget_activated_(NULL),
619 widget_shown_(NULL), 619 widget_shown_(NULL),
620 widget_hidden_(NULL) { 620 widget_hidden_(NULL) {
621 } 621 }
622 622
623 virtual ~WidgetObserverTest() {} 623 virtual ~WidgetObserverTest() {}
624 624
625 // Overridden from WidgetObserver:
625 virtual void OnWidgetClosing(Widget* widget) OVERRIDE { 626 virtual void OnWidgetClosing(Widget* widget) OVERRIDE {
626 if (active_ == widget) 627 if (active_ == widget)
627 active_ = NULL; 628 active_ = NULL;
628 widget_closed_ = widget; 629 widget_closed_ = widget;
629 } 630 }
630 631
631 virtual void OnWidgetActivationChanged(Widget* widget, 632 virtual void OnWidgetActivationChanged(Widget* widget,
632 bool active) OVERRIDE { 633 bool active) OVERRIDE {
633 if (active) { 634 if (active) {
634 if (widget_activated_) 635 if (widget_activated_)
(...skipping 180 matching lines...) Expand 10 before | Expand all | Expand 10 after
815 // And it stays maximized after getting out of full screen. 816 // And it stays maximized after getting out of full screen.
816 EXPECT_EQ(ui::SHOW_STATE_MAXIMIZED, GetWidgetShowState(toplevel)); 817 EXPECT_EQ(ui::SHOW_STATE_MAXIMIZED, GetWidgetShowState(toplevel));
817 818
818 // Clean up. 819 // Clean up.
819 toplevel->Close(); 820 toplevel->Close();
820 RunPendingMessages(); 821 RunPendingMessages();
821 } 822 }
822 823
823 } // namespace 824 } // namespace
824 } // namespace views 825 } // namespace views
OLDNEW
« no previous file with comments | « ui/views/widget/widget_observer.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698