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

Side by Side Diff: ash/system/web_notification/ash_popup_alignment_delegate_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, 6 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
« no previous file with comments | « ash/system/user/user_view.cc ('k') | ash/system/web_notification/web_notification_tray.cc » ('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 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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/system/web_notification/ash_popup_alignment_delegate.h" 5 #include "ash/system/web_notification/ash_popup_alignment_delegate.h"
6 6
7 #include <utility> 7 #include <utility>
8 #include <vector> 8 #include <vector>
9 9
10 #include "ash/common/shelf/shelf_types.h" 10 #include "ash/common/shelf/shelf_types.h"
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
48 test::AshTestBase::TearDown(); 48 test::AshTestBase::TearDown();
49 } 49 }
50 50
51 void SetKeyboardBounds(const gfx::Rect& new_bounds) { 51 void SetKeyboardBounds(const gfx::Rect& new_bounds) {
52 Shelf::ForPrimaryDisplay() 52 Shelf::ForPrimaryDisplay()
53 ->shelf_layout_manager() 53 ->shelf_layout_manager()
54 ->OnKeyboardBoundsChanging(new_bounds); 54 ->OnKeyboardBoundsChanging(new_bounds);
55 } 55 }
56 56
57 protected: 57 protected:
58 enum Position { 58 enum Position { TOP_LEFT, TOP_RIGHT, BOTTOM_LEFT, BOTTOM_RIGHT, OUTSIDE };
59 TOP_LEFT,
60 TOP_RIGHT,
61 BOTTOM_LEFT,
62 BOTTOM_RIGHT,
63 OUTSIDE
64 };
65 59
66 AshPopupAlignmentDelegate* alignment_delegate() { 60 AshPopupAlignmentDelegate* alignment_delegate() {
67 return alignment_delegate_.get(); 61 return alignment_delegate_.get();
68 } 62 }
69 63
70 void UpdateWorkArea(AshPopupAlignmentDelegate* alignment_delegate, 64 void UpdateWorkArea(AshPopupAlignmentDelegate* alignment_delegate,
71 const display::Display& display) { 65 const display::Display& display) {
72 alignment_delegate->StartObserving(display::Screen::GetScreen(), display); 66 alignment_delegate->StartObserving(display::Screen::GetScreen(), display);
73 // Update the layout 67 // Update the layout
74 alignment_delegate->OnDisplayWorkAreaInsetsChanged(); 68 alignment_delegate->OnDisplayWorkAreaInsetsChanged();
(...skipping 18 matching lines...) Expand all
93 work_area.right() < point.x() || work_area.bottom() < point.y()) { 87 work_area.right() < point.x() || work_area.bottom() < point.y()) {
94 return OUTSIDE; 88 return OUTSIDE;
95 } 89 }
96 90
97 if (center_point.x() < point.x()) 91 if (center_point.x() < point.x())
98 return (center_point.y() < point.y()) ? BOTTOM_RIGHT : TOP_RIGHT; 92 return (center_point.y() < point.y()) ? BOTTOM_RIGHT : TOP_RIGHT;
99 else 93 else
100 return (center_point.y() < point.y()) ? BOTTOM_LEFT : TOP_LEFT; 94 return (center_point.y() < point.y()) ? BOTTOM_LEFT : TOP_LEFT;
101 } 95 }
102 96
103 gfx::Rect GetWorkArea() { 97 gfx::Rect GetWorkArea() { return alignment_delegate_->work_area_; }
104 return alignment_delegate_->work_area_;
105 }
106 98
107 std::unique_ptr<views::Widget> CreateTestWidget(int container_id) { 99 std::unique_ptr<views::Widget> CreateTestWidget(int container_id) {
108 std::unique_ptr<views::Widget> widget(new views::Widget); 100 std::unique_ptr<views::Widget> widget(new views::Widget);
109 views::Widget::InitParams params; 101 views::Widget::InitParams params;
110 params.ownership = views::Widget::InitParams::WIDGET_OWNS_NATIVE_WIDGET; 102 params.ownership = views::Widget::InitParams::WIDGET_OWNS_NATIVE_WIDGET;
111 params.bounds = gfx::Rect(0, 0, 50, 50); 103 params.bounds = gfx::Rect(0, 0, 50, 50);
112 WmShell::Get() 104 WmShell::Get()
113 ->GetPrimaryRootWindow() 105 ->GetPrimaryRootWindow()
114 ->GetRootWindowController() 106 ->GetRootWindowController()
115 ->ConfigureWidgetInitParamsForContainer(widget.get(), container_id, 107 ->ConfigureWidgetInitParamsForContainer(widget.get(), container_id,
(...skipping 220 matching lines...) Expand 10 before | Expand all | Expand 10 after
336 SetKeyboardBounds(keyboard_bounds); 328 SetKeyboardBounds(keyboard_bounds);
337 int keyboard_baseline = alignment_delegate()->GetBaseLine(); 329 int keyboard_baseline = alignment_delegate()->GetBaseLine();
338 EXPECT_NE(baseline, keyboard_baseline); 330 EXPECT_NE(baseline, keyboard_baseline);
339 EXPECT_GT(keyboard_bounds.y(), keyboard_baseline); 331 EXPECT_GT(keyboard_bounds.y(), keyboard_baseline);
340 332
341 SetKeyboardBounds(gfx::Rect()); 333 SetKeyboardBounds(gfx::Rect());
342 EXPECT_EQ(baseline, alignment_delegate()->GetBaseLine()); 334 EXPECT_EQ(baseline, alignment_delegate()->GetBaseLine());
343 } 335 }
344 336
345 } // namespace ash 337 } // namespace ash
OLDNEW
« no previous file with comments | « ash/system/user/user_view.cc ('k') | ash/system/web_notification/web_notification_tray.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698