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

Side by Side Diff: ash/wm/partial_screenshot_view_unittest.cc

Issue 645513008: 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
« no previous file with comments | « ash/wm/partial_screenshot_view.cc ('k') | ash/wm/power_button_controller.h » ('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 (c) 2013 The Chromium Authors. All rights reserved. 1 // Copyright (c) 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 "ash/wm/partial_screenshot_view.h" 5 #include "ash/wm/partial_screenshot_view.h"
6 6
7 #include "ash/screenshot_delegate.h" 7 #include "ash/screenshot_delegate.h"
8 #include "ash/shell.h" 8 #include "ash/shell.h"
9 #include "ash/shell_window_ids.h" 9 #include "ash/shell_window_ids.h"
10 #include "ash/test/ash_test_base.h" 10 #include "ash/test/ash_test_base.h"
11 #include "ash/test/test_overlay_delegate.h" 11 #include "ash/test/test_overlay_delegate.h"
12 #include "ash/test/test_screenshot_delegate.h" 12 #include "ash/test/test_screenshot_delegate.h"
13 #include "ui/aura/window_event_dispatcher.h" 13 #include "ui/aura/window_event_dispatcher.h"
14 #include "ui/events/test/event_generator.h" 14 #include "ui/events/test/event_generator.h"
15 #include "ui/views/widget/widget.h" 15 #include "ui/views/widget/widget.h"
16 #include "ui/views/widget/widget_observer.h" 16 #include "ui/views/widget/widget_observer.h"
17 17
18 namespace ash { 18 namespace ash {
19 19
20 class PartialScreenshotViewTest : public test::AshTestBase, 20 class PartialScreenshotViewTest : public test::AshTestBase,
21 public views::WidgetObserver { 21 public views::WidgetObserver {
22 public: 22 public:
23 PartialScreenshotViewTest() : view_(NULL) {} 23 PartialScreenshotViewTest() : view_(NULL) {}
24 virtual ~PartialScreenshotViewTest() { 24 ~PartialScreenshotViewTest() override {
25 if (view_) 25 if (view_)
26 view_->GetWidget()->RemoveObserver(this); 26 view_->GetWidget()->RemoveObserver(this);
27 } 27 }
28 28
29 void StartPartialScreenshot() { 29 void StartPartialScreenshot() {
30 std::vector<PartialScreenshotView*> views = 30 std::vector<PartialScreenshotView*> views =
31 PartialScreenshotView::StartPartialScreenshot(GetScreenshotDelegate()); 31 PartialScreenshotView::StartPartialScreenshot(GetScreenshotDelegate());
32 if (!views.empty()) { 32 if (!views.empty()) {
33 view_ = views[0]; 33 view_ = views[0];
34 view_->GetWidget()->AddObserver(this); 34 view_->GetWidget()->AddObserver(this);
35 } 35 }
36 } 36 }
37 37
38 protected: 38 protected:
39 PartialScreenshotView* view_; 39 PartialScreenshotView* view_;
40 40
41 private: 41 private:
42 // views::WidgetObserver: 42 // views::WidgetObserver:
43 virtual void OnWidgetDestroying(views::Widget* widget) override { 43 void OnWidgetDestroying(views::Widget* widget) override {
44 if (view_ && view_->GetWidget() == widget) 44 if (view_ && view_->GetWidget() == widget)
45 view_ = NULL; 45 view_ = NULL;
46 widget->RemoveObserver(this); 46 widget->RemoveObserver(this);
47 } 47 }
48 48
49 DISALLOW_COPY_AND_ASSIGN(PartialScreenshotViewTest); 49 DISALLOW_COPY_AND_ASSIGN(PartialScreenshotViewTest);
50 }; 50 };
51 51
52 TEST_F(PartialScreenshotViewTest, BasicMouse) { 52 TEST_F(PartialScreenshotViewTest, BasicMouse) {
53 StartPartialScreenshot(); 53 StartPartialScreenshot();
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after
113 113
114 // Someone else attempts to activate the overlay session, which should cancel 114 // Someone else attempts to activate the overlay session, which should cancel
115 // the current partial screenshot session. 115 // the current partial screenshot session.
116 overlay_filter->Activate(&delegate); 116 overlay_filter->Activate(&delegate);
117 RunAllPendingInMessageLoop(); 117 RunAllPendingInMessageLoop();
118 EXPECT_EQ(&delegate, overlay_filter->delegate_); 118 EXPECT_EQ(&delegate, overlay_filter->delegate_);
119 EXPECT_TRUE(view_ == NULL); 119 EXPECT_TRUE(view_ == NULL);
120 } 120 }
121 121
122 } // namespace ash 122 } // namespace ash
OLDNEW
« no previous file with comments | « ash/wm/partial_screenshot_view.cc ('k') | ash/wm/power_button_controller.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698