OLD | NEW |
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 <vector> | 7 #include <vector> |
8 | 8 |
9 #include "ash/display/display_manager.h" | 9 #include "ash/display/display_manager.h" |
10 #include "ash/shelf/shelf_layout_manager.h" | 10 #include "ash/shelf/shelf_layout_manager.h" |
11 #include "ash/shelf/shelf_types.h" | 11 #include "ash/shelf/shelf_types.h" |
12 #include "ash/shell.h" | 12 #include "ash/shell.h" |
13 #include "ash/shell_window_ids.h" | 13 #include "ash/shell_window_ids.h" |
14 #include "ash/test/ash_test_base.h" | 14 #include "ash/test/ash_test_base.h" |
15 #include "ash/test/display_manager_test_api.h" | |
16 #include "ui/gfx/screen.h" | 15 #include "ui/gfx/screen.h" |
17 #include "ui/message_center/message_center_style.h" | 16 #include "ui/message_center/message_center_style.h" |
18 | 17 |
19 namespace ash { | 18 namespace ash { |
20 | 19 |
21 class AshPopupAlignmentDelegateTest : public test::AshTestBase { | 20 class AshPopupAlignmentDelegateTest : public test::AshTestBase { |
22 public: | 21 public: |
23 AshPopupAlignmentDelegateTest() {} | 22 AshPopupAlignmentDelegateTest() {} |
24 ~AshPopupAlignmentDelegateTest() override {} | 23 ~AshPopupAlignmentDelegateTest() override {} |
25 | 24 |
(...skipping 200 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
226 | 225 |
227 EXPECT_EQ(origin_x, alignment_delegate()->GetToastOriginX(toast_size)); | 226 EXPECT_EQ(origin_x, alignment_delegate()->GetToastOriginX(toast_size)); |
228 EXPECT_EQ(baseline - kTrayHeight - message_center::kMarginBetweenItems, | 227 EXPECT_EQ(baseline - kTrayHeight - message_center::kMarginBetweenItems, |
229 alignment_delegate()->GetBaseLine()); | 228 alignment_delegate()->GetBaseLine()); |
230 } | 229 } |
231 | 230 |
232 TEST_F(AshPopupAlignmentDelegateTest, Unified) { | 231 TEST_F(AshPopupAlignmentDelegateTest, Unified) { |
233 if (!SupportsMultipleDisplays()) | 232 if (!SupportsMultipleDisplays()) |
234 return; | 233 return; |
235 DisplayManager* display_manager = Shell::GetInstance()->display_manager(); | 234 DisplayManager* display_manager = Shell::GetInstance()->display_manager(); |
236 test::DisplayManagerTestApi test_api(display_manager); | 235 display_manager->SetDefaultMultiDisplayMode(DisplayManager::UNIFIED); |
237 test_api.SetDefaultMultiDisplayMode(DisplayManager::UNIFIED); | |
238 display_manager->SetMultiDisplayMode(DisplayManager::UNIFIED); | 236 display_manager->SetMultiDisplayMode(DisplayManager::UNIFIED); |
239 | 237 |
240 // Reset the delegate as the primary display's shelf will be destroyed during | 238 // Reset the delegate as the primary display's shelf will be destroyed during |
241 // transition. | 239 // transition. |
242 SetAlignmentDelegate(scoped_ptr<AshPopupAlignmentDelegate>()); | 240 SetAlignmentDelegate(scoped_ptr<AshPopupAlignmentDelegate>()); |
243 | 241 |
244 UpdateDisplay("600x600,800x800"); | 242 UpdateDisplay("600x600,800x800"); |
245 SetAlignmentDelegate(make_scoped_ptr(new AshPopupAlignmentDelegate())); | 243 SetAlignmentDelegate(make_scoped_ptr(new AshPopupAlignmentDelegate())); |
246 | 244 |
247 EXPECT_GT(600, | 245 EXPECT_GT(600, |
248 alignment_delegate()->GetToastOriginX(gfx::Rect(0, 0, 10, 10))); | 246 alignment_delegate()->GetToastOriginX(gfx::Rect(0, 0, 10, 10))); |
249 } | 247 } |
250 | 248 |
251 } // namespace ash | 249 } // namespace ash |
OLD | NEW |