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

Side by Side Diff: ash/wm/workspace/multi_window_resize_controller_unittest.cc

Issue 2095193002: clang-format all of //ash (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 5 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
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/common/wm/workspace/multi_window_resize_controller.h" 5 #include "ash/common/wm/workspace/multi_window_resize_controller.h"
6 6
7 #include "ash/aura/wm_window_aura.h" 7 #include "ash/aura/wm_window_aura.h"
8 #include "ash/common/ash_constants.h" 8 #include "ash/common/ash_constants.h"
9 #include "ash/frame/custom_frame_view_ash.h" 9 #include "ash/frame/custom_frame_view_ash.h"
10 #include "ash/shell.h" 10 #include "ash/shell.h"
(...skipping 16 matching lines...) Expand all
27 namespace { 27 namespace {
28 28
29 // WidgetDelegate for a resizable widget which creates a NonClientFrameView 29 // WidgetDelegate for a resizable widget which creates a NonClientFrameView
30 // which is actually used in Ash. 30 // which is actually used in Ash.
31 class TestWidgetDelegate : public views::WidgetDelegateView { 31 class TestWidgetDelegate : public views::WidgetDelegateView {
32 public: 32 public:
33 TestWidgetDelegate() {} 33 TestWidgetDelegate() {}
34 ~TestWidgetDelegate() override {} 34 ~TestWidgetDelegate() override {}
35 35
36 // views::WidgetDelegateView: 36 // views::WidgetDelegateView:
37 bool CanResize() const override { 37 bool CanResize() const override { return true; }
38 return true;
39 }
40 38
41 views::NonClientFrameView* CreateNonClientFrameView( 39 views::NonClientFrameView* CreateNonClientFrameView(
42 views::Widget* widget) override { 40 views::Widget* widget) override {
43 return new CustomFrameViewAsh(widget); 41 return new CustomFrameViewAsh(widget);
44 } 42 }
45 43
46 private: 44 private:
47 DISALLOW_COPY_AND_ASSIGN(TestWidgetDelegate); 45 DISALLOW_COPY_AND_ASSIGN(TestWidgetDelegate);
48 }; 46 };
49 47
50 } // namespace 48 } // namespace
51 49
52 class MultiWindowResizeControllerTest : public test::AshTestBase { 50 class MultiWindowResizeControllerTest : public test::AshTestBase {
53 public: 51 public:
54 MultiWindowResizeControllerTest() : resize_controller_(NULL) {} 52 MultiWindowResizeControllerTest() : resize_controller_(NULL) {}
55 ~MultiWindowResizeControllerTest() override {} 53 ~MultiWindowResizeControllerTest() override {}
56 54
57 void SetUp() override { 55 void SetUp() override {
58 test::AshTestBase::SetUp(); 56 test::AshTestBase::SetUp();
59 WorkspaceController* wc = 57 WorkspaceController* wc =
60 test::ShellTestApi(Shell::GetInstance()).workspace_controller(); 58 test::ShellTestApi(Shell::GetInstance()).workspace_controller();
61 WorkspaceEventHandler* event_handler = 59 WorkspaceEventHandler* event_handler =
62 WorkspaceControllerTestHelper(wc).GetEventHandler(); 60 WorkspaceControllerTestHelper(wc).GetEventHandler();
63 resize_controller_ = WorkspaceEventHandlerTestHelper(event_handler). 61 resize_controller_ =
64 resize_controller(); 62 WorkspaceEventHandlerTestHelper(event_handler).resize_controller();
65 } 63 }
66 64
67 protected: 65 protected:
68 aura::Window* CreateTestWindow(aura::WindowDelegate* delegate, 66 aura::Window* CreateTestWindow(aura::WindowDelegate* delegate,
69 const gfx::Rect& bounds) { 67 const gfx::Rect& bounds) {
70 aura::Window* window = new aura::Window(delegate); 68 aura::Window* window = new aura::Window(delegate);
71 window->SetType(ui::wm::WINDOW_TYPE_NORMAL); 69 window->SetType(ui::wm::WINDOW_TYPE_NORMAL);
72 window->Init(ui::LAYER_TEXTURED); 70 window->Init(ui::LAYER_TEXTURED);
73 ParentWindowInPrimaryRootWindow(window); 71 ParentWindowInPrimaryRootWindow(window);
74 window->SetBounds(bounds); 72 window->SetBounds(bounds);
75 window->Show(); 73 window->Show();
76 return window; 74 return window;
77 } 75 }
78 76
79 void ShowNow() { 77 void ShowNow() { resize_controller_->ShowNow(); }
80 resize_controller_->ShowNow();
81 }
82 78
83 bool IsShowing() { 79 bool IsShowing() { return resize_controller_->IsShowing(); }
84 return resize_controller_->IsShowing();
85 }
86 80
87 bool HasPendingShow() { 81 bool HasPendingShow() { return resize_controller_->show_timer_.IsRunning(); }
88 return resize_controller_->show_timer_.IsRunning();
89 }
90 82
91 void Hide() { 83 void Hide() { resize_controller_->Hide(); }
92 resize_controller_->Hide();
93 }
94 84
95 bool HasTarget(aura::Window* window) { 85 bool HasTarget(aura::Window* window) {
96 if (!resize_controller_->windows_.is_valid()) 86 if (!resize_controller_->windows_.is_valid())
97 return false; 87 return false;
98 WmWindow* wm_window = WmWindowAura::Get(window); 88 WmWindow* wm_window = WmWindowAura::Get(window);
99 if ((resize_controller_->windows_.window1 == wm_window || 89 if ((resize_controller_->windows_.window1 == wm_window ||
100 resize_controller_->windows_.window2 == wm_window)) 90 resize_controller_->windows_.window2 == wm_window))
101 return true; 91 return true;
102 return ContainsValue(resize_controller_->windows_.other_windows, wm_window); 92 return ContainsValue(resize_controller_->windows_.other_windows, wm_window);
103 } 93 }
(...skipping 260 matching lines...) Expand 10 before | Expand all | Expand 10 after
364 354
365 // Clicking outside the resize handle should immediately hide the resize 355 // Clicking outside the resize handle should immediately hide the resize
366 // handle. 356 // handle.
367 EXPECT_FALSE(resize_widget_bounds_in_screen.Contains(w1_center_in_screen)); 357 EXPECT_FALSE(resize_widget_bounds_in_screen.Contains(w1_center_in_screen));
368 generator.MoveMouseTo(w1_center_in_screen); 358 generator.MoveMouseTo(w1_center_in_screen);
369 generator.ClickLeftButton(); 359 generator.ClickLeftButton();
370 EXPECT_FALSE(IsShowing()); 360 EXPECT_FALSE(IsShowing());
371 } 361 }
372 362
373 } // namespace ash 363 } // namespace ash
OLDNEW
« no previous file with comments | « ash/wm/workspace/magnetism_matcher_unittest.cc ('k') | ash/wm/workspace/workspace_event_handler.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698