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

Side by Side Diff: ash/system/web_notification/web_notification_tray_unittest.cc

Issue 369573004: Separate the logic of popup alignment and workarea handling as delegate. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: polish Created 6 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 | Annotate | Revision Log
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/system/web_notification/web_notification_tray.h" 5 #include "ash/system/web_notification/web_notification_tray.h"
6 6
7 #include <vector> 7 #include <vector>
8 8
9 #include "ash/display/display_manager.h" 9 #include "ash/display/display_manager.h"
10 #include "ash/root_window_controller.h" 10 #include "ash/root_window_controller.h"
11 #include "ash/shelf/shelf_layout_manager.h" 11 #include "ash/shelf/shelf_layout_manager.h"
12 #include "ash/shelf/shelf_widget.h" 12 #include "ash/shelf/shelf_widget.h"
13 #include "ash/shell.h" 13 #include "ash/shell.h"
14 #include "ash/system/status_area_widget.h" 14 #include "ash/system/status_area_widget.h"
15 #include "ash/system/tray/system_tray.h" 15 #include "ash/system/tray/system_tray.h"
16 #include "ash/system/tray/system_tray_item.h" 16 #include "ash/system/tray/system_tray_item.h"
17 #include "ash/system/web_notification/popup_alignment_delegate.h"
17 #include "ash/test/ash_test_base.h" 18 #include "ash/test/ash_test_base.h"
18 #include "ash/test/status_area_widget_test_helper.h" 19 #include "ash/test/status_area_widget_test_helper.h"
19 #include "ash/test/test_system_tray_delegate.h" 20 #include "ash/test/test_system_tray_delegate.h"
20 #include "ash/wm/window_state.h" 21 #include "ash/wm/window_state.h"
21 #include "base/strings/stringprintf.h" 22 #include "base/strings/stringprintf.h"
22 #include "base/strings/utf_string_conversions.h" 23 #include "base/strings/utf_string_conversions.h"
23 #include "ui/aura/client/aura_constants.h" 24 #include "ui/aura/client/aura_constants.h"
24 #include "ui/aura/test/event_generator.h" 25 #include "ui/aura/test/event_generator.h"
25 #include "ui/aura/window.h" 26 #include "ui/aura/window.h"
26 #include "ui/gfx/display.h" 27 #include "ui/gfx/display.h"
(...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after
132 133
133 views::Widget* GetWidget() { 134 views::Widget* GetWidget() {
134 return GetTray()->GetWidget(); 135 return GetTray()->GetWidget();
135 } 136 }
136 137
137 gfx::Rect GetPopupWorkArea() { 138 gfx::Rect GetPopupWorkArea() {
138 return GetPopupWorkAreaForTray(GetTray()); 139 return GetPopupWorkAreaForTray(GetTray());
139 } 140 }
140 141
141 gfx::Rect GetPopupWorkAreaForTray(WebNotificationTray* tray) { 142 gfx::Rect GetPopupWorkAreaForTray(WebNotificationTray* tray) {
142 return tray->popup_collection_->work_area_; 143 return tray->popup_alignment_delegate_->work_area_;
143 } 144 }
144 145
145 bool IsPopupVisible() { 146 bool IsPopupVisible() {
146 return GetTray()->IsPopupVisible(); 147 return GetTray()->IsPopupVisible();
147 } 148 }
148 149
149 private: 150 private:
150 DISALLOW_COPY_AND_ASSIGN(WebNotificationTrayTest); 151 DISALLOW_COPY_AND_ASSIGN(WebNotificationTrayTest);
151 }; 152 };
152 153
(...skipping 316 matching lines...) Expand 10 before | Expand all | Expand 10 after
469 470
470 // System tray is created on the primary display. The popups in the secondary 471 // System tray is created on the primary display. The popups in the secondary
471 // tray aren't affected. 472 // tray aren't affected.
472 GetSystemTray()->ShowDefaultView(BUBBLE_CREATE_NEW); 473 GetSystemTray()->ShowDefaultView(BUBBLE_CREATE_NEW);
473 EXPECT_GT(work_area.size().GetArea(), GetPopupWorkArea().size().GetArea()); 474 EXPECT_GT(work_area.size().GetArea(), GetPopupWorkArea().size().GetArea());
474 EXPECT_EQ(work_area_second.ToString(), 475 EXPECT_EQ(work_area_second.ToString(),
475 GetPopupWorkAreaForTray(GetSecondaryTray()).ToString()); 476 GetPopupWorkAreaForTray(GetSecondaryTray()).ToString());
476 } 477 }
477 478
478 } // namespace ash 479 } // namespace ash
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698