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

Side by Side Diff: ash/root_window_controller_unittest.cc

Issue 680153002: Standardize usage of virtual/override/final specifiers. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 1 month 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 (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 "ash/root_window_controller.h" 5 #include "ash/root_window_controller.h"
6 6
7 #include "ash/session/session_state_delegate.h" 7 #include "ash/session/session_state_delegate.h"
8 #include "ash/shelf/shelf_layout_manager.h" 8 #include "ash/shelf/shelf_layout_manager.h"
9 #include "ash/shell.h" 9 #include "ash/shell.h"
10 #include "ash/shell_window_ids.h" 10 #include "ash/shell_window_ids.h"
(...skipping 30 matching lines...) Expand all
41 41
42 using aura::Window; 42 using aura::Window;
43 using views::Widget; 43 using views::Widget;
44 44
45 namespace ash { 45 namespace ash {
46 namespace { 46 namespace {
47 47
48 class TestDelegate : public views::WidgetDelegateView { 48 class TestDelegate : public views::WidgetDelegateView {
49 public: 49 public:
50 explicit TestDelegate(bool system_modal) : system_modal_(system_modal) {} 50 explicit TestDelegate(bool system_modal) : system_modal_(system_modal) {}
51 virtual ~TestDelegate() {} 51 ~TestDelegate() override {}
52 52
53 // Overridden from views::WidgetDelegate: 53 // Overridden from views::WidgetDelegate:
54 virtual views::View* GetContentsView() override { 54 views::View* GetContentsView() override { return this; }
55 return this;
56 }
57 55
58 virtual ui::ModalType GetModalType() const override { 56 ui::ModalType GetModalType() const override {
59 return system_modal_ ? ui::MODAL_TYPE_SYSTEM : ui::MODAL_TYPE_NONE; 57 return system_modal_ ? ui::MODAL_TYPE_SYSTEM : ui::MODAL_TYPE_NONE;
60 } 58 }
61 59
62 private: 60 private:
63 bool system_modal_; 61 bool system_modal_;
64 62
65 DISALLOW_COPY_AND_ASSIGN(TestDelegate); 63 DISALLOW_COPY_AND_ASSIGN(TestDelegate);
66 }; 64 };
67 65
68 class DeleteOnBlurDelegate : public aura::test::TestWindowDelegate, 66 class DeleteOnBlurDelegate : public aura::test::TestWindowDelegate,
69 public aura::client::FocusChangeObserver { 67 public aura::client::FocusChangeObserver {
70 public: 68 public:
71 DeleteOnBlurDelegate() : window_(NULL) {} 69 DeleteOnBlurDelegate() : window_(NULL) {}
72 virtual ~DeleteOnBlurDelegate() {} 70 ~DeleteOnBlurDelegate() override {}
73 71
74 void SetWindow(aura::Window* window) { 72 void SetWindow(aura::Window* window) {
75 window_ = window; 73 window_ = window;
76 aura::client::SetFocusChangeObserver(window_, this); 74 aura::client::SetFocusChangeObserver(window_, this);
77 } 75 }
78 76
79 private: 77 private:
80 // aura::test::TestWindowDelegate overrides: 78 // aura::test::TestWindowDelegate overrides:
81 virtual bool CanFocus() override { 79 bool CanFocus() override { return true; }
82 return true;
83 }
84 80
85 // aura::client::FocusChangeObserver implementation: 81 // aura::client::FocusChangeObserver implementation:
86 virtual void OnWindowFocused(aura::Window* gained_focus, 82 void OnWindowFocused(aura::Window* gained_focus,
87 aura::Window* lost_focus) override { 83 aura::Window* lost_focus) override {
88 if (window_ == lost_focus) 84 if (window_ == lost_focus)
89 delete window_; 85 delete window_;
90 } 86 }
91 87
92 aura::Window* window_; 88 aura::Window* window_;
93 89
94 DISALLOW_COPY_AND_ASSIGN(DeleteOnBlurDelegate); 90 DISALLOW_COPY_AND_ASSIGN(DeleteOnBlurDelegate);
95 }; 91 };
96 92
97 } // namespace 93 } // namespace
(...skipping 421 matching lines...) Expand 10 before | Expand all | Expand 10 after
519 session_window->Focus(); 515 session_window->Focus();
520 EXPECT_FALSE(session_window->HasFocus()); 516 EXPECT_FALSE(session_window->HasFocus());
521 UnblockUserSession(); 517 UnblockUserSession();
522 } 518 }
523 } 519 }
524 520
525 // Tracks whether OnWindowDestroying() has been invoked. 521 // Tracks whether OnWindowDestroying() has been invoked.
526 class DestroyedWindowObserver : public aura::WindowObserver { 522 class DestroyedWindowObserver : public aura::WindowObserver {
527 public: 523 public:
528 DestroyedWindowObserver() : destroyed_(false), window_(NULL) {} 524 DestroyedWindowObserver() : destroyed_(false), window_(NULL) {}
529 virtual ~DestroyedWindowObserver() { 525 ~DestroyedWindowObserver() override { Shutdown(); }
530 Shutdown();
531 }
532 526
533 void SetWindow(Window* window) { 527 void SetWindow(Window* window) {
534 window_ = window; 528 window_ = window;
535 window->AddObserver(this); 529 window->AddObserver(this);
536 } 530 }
537 531
538 bool destroyed() const { return destroyed_; } 532 bool destroyed() const { return destroyed_; }
539 533
540 // WindowObserver overrides: 534 // WindowObserver overrides:
541 virtual void OnWindowDestroying(Window* window) override { 535 void OnWindowDestroying(Window* window) override {
542 destroyed_ = true; 536 destroyed_ = true;
543 Shutdown(); 537 Shutdown();
544 } 538 }
545 539
546 private: 540 private:
547 void Shutdown() { 541 void Shutdown() {
548 if (!window_) 542 if (!window_)
549 return; 543 return;
550 window_->RemoveObserver(this); 544 window_->RemoveObserver(this);
551 window_ = NULL; 545 window_ = NULL;
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
608 root->GetEventHandlerForPoint(gfx::Point(0, size.height() - 1))); 602 root->GetEventHandlerForPoint(gfx::Point(0, size.height() - 1)));
609 EXPECT_EQ(event_target, 603 EXPECT_EQ(event_target,
610 root->GetEventHandlerForPoint( 604 root->GetEventHandlerForPoint(
611 gfx::Point(size.width() - 1, size.height() - 1))); 605 gfx::Point(size.width() - 1, size.height() - 1)));
612 } 606 }
613 607
614 class VirtualKeyboardRootWindowControllerTest 608 class VirtualKeyboardRootWindowControllerTest
615 : public RootWindowControllerTest { 609 : public RootWindowControllerTest {
616 public: 610 public:
617 VirtualKeyboardRootWindowControllerTest() {}; 611 VirtualKeyboardRootWindowControllerTest() {};
618 virtual ~VirtualKeyboardRootWindowControllerTest() {}; 612 ~VirtualKeyboardRootWindowControllerTest() override{};
Daniel Erat 2014/10/27 21:55:49 nit: override {}
dcheng 2014/10/27 22:03:41 Fixed this one too.
619 613
620 virtual void SetUp() override { 614 void SetUp() override {
621 CommandLine::ForCurrentProcess()->AppendSwitch( 615 CommandLine::ForCurrentProcess()->AppendSwitch(
622 keyboard::switches::kEnableVirtualKeyboard); 616 keyboard::switches::kEnableVirtualKeyboard);
623 test::AshTestBase::SetUp(); 617 test::AshTestBase::SetUp();
624 Shell::GetPrimaryRootWindowController()->ActivateKeyboard( 618 Shell::GetPrimaryRootWindowController()->ActivateKeyboard(
625 keyboard::KeyboardController::GetInstance()); 619 keyboard::KeyboardController::GetInstance());
626 } 620 }
627 621
628 private: 622 private:
629 DISALLOW_COPY_AND_ASSIGN(VirtualKeyboardRootWindowControllerTest); 623 DISALLOW_COPY_AND_ASSIGN(VirtualKeyboardRootWindowControllerTest);
630 }; 624 };
631 625
632 class MockTextInputClient : public ui::DummyTextInputClient { 626 class MockTextInputClient : public ui::DummyTextInputClient {
633 public: 627 public:
634 MockTextInputClient() : 628 MockTextInputClient() :
635 ui::DummyTextInputClient(ui::TEXT_INPUT_TYPE_TEXT) {} 629 ui::DummyTextInputClient(ui::TEXT_INPUT_TYPE_TEXT) {}
636 630
637 virtual void EnsureCaretInRect(const gfx::Rect& rect) override { 631 void EnsureCaretInRect(const gfx::Rect& rect) override {
638 visible_rect_ = rect; 632 visible_rect_ = rect;
639 } 633 }
640 634
641 const gfx::Rect& visible_rect() const { 635 const gfx::Rect& visible_rect() const {
642 return visible_rect_; 636 return visible_rect_;
643 } 637 }
644 638
645 private: 639 private:
646 gfx::Rect visible_rect_; 640 gfx::Rect visible_rect_;
647 641
648 DISALLOW_COPY_AND_ASSIGN(MockTextInputClient); 642 DISALLOW_COPY_AND_ASSIGN(MockTextInputClient);
649 }; 643 };
650 644
651 class TargetHitTestEventHandler : public ui::test::TestEventHandler { 645 class TargetHitTestEventHandler : public ui::test::TestEventHandler {
652 public: 646 public:
653 TargetHitTestEventHandler() {} 647 TargetHitTestEventHandler() {}
654 648
655 // ui::test::TestEventHandler overrides. 649 // ui::test::TestEventHandler overrides.
656 virtual void OnMouseEvent(ui::MouseEvent* event) override { 650 void OnMouseEvent(ui::MouseEvent* event) override {
657 if (event->type() == ui::ET_MOUSE_PRESSED) 651 if (event->type() == ui::ET_MOUSE_PRESSED)
658 ui::test::TestEventHandler::OnMouseEvent(event); 652 ui::test::TestEventHandler::OnMouseEvent(event);
659 event->StopPropagation(); 653 event->StopPropagation();
660 } 654 }
661 655
662 private: 656 private:
663 DISALLOW_COPY_AND_ASSIGN(TargetHitTestEventHandler); 657 DISALLOW_COPY_AND_ASSIGN(TargetHitTestEventHandler);
664 }; 658 };
665 659
666 // Test for http://crbug.com/297858. Virtual keyboard container should only show 660 // Test for http://crbug.com/297858. Virtual keyboard container should only show
(...skipping 294 matching lines...) Expand 10 before | Expand all | Expand 10 after
961 ASSERT_TRUE(keyboard_container); 955 ASSERT_TRUE(keyboard_container);
962 keyboard_container->Show(); 956 keyboard_container->Show();
963 EXPECT_EQ("0,0 800x600", keyboard_container->bounds().ToString()); 957 EXPECT_EQ("0,0 800x600", keyboard_container->bounds().ToString());
964 958
965 UpdateDisplay("600x800"); 959 UpdateDisplay("600x800");
966 EXPECT_EQ("0,0 600x800", keyboard_container->bounds().ToString()); 960 EXPECT_EQ("0,0 600x800", keyboard_container->bounds().ToString());
967 } 961 }
968 962
969 } // namespace test 963 } // namespace test
970 } // namespace ash 964 } // namespace ash
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698