OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 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/display/resolution_notification_controller.h" | 5 #include "ash/display/resolution_notification_controller.h" |
6 | 6 |
7 #include "ash/display/display_manager.h" | 7 #include "ash/display/display_manager.h" |
8 #include "ash/screen_util.h" | 8 #include "ash/screen_util.h" |
9 #include "ash/shell.h" | 9 #include "ash/shell.h" |
10 #include "ash/test/ash_test_base.h" | 10 #include "ash/test/ash_test_base.h" |
(...skipping 215 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
226 } | 226 } |
227 | 227 |
228 TEST_F(ResolutionNotificationControllerTest, AcceptButton) { | 228 TEST_F(ResolutionNotificationControllerTest, AcceptButton) { |
229 if (!SupportsMultipleDisplays()) | 229 if (!SupportsMultipleDisplays()) |
230 return; | 230 return; |
231 | 231 |
232 ash::DisplayManager* display_manager = | 232 ash::DisplayManager* display_manager = |
233 ash::Shell::GetInstance()->display_manager(); | 233 ash::Shell::GetInstance()->display_manager(); |
234 | 234 |
235 UpdateDisplay("300x300#300x300%59|200x200%60"); | 235 UpdateDisplay("300x300#300x300%59|200x200%60"); |
236 const gfx::Display& display = ash::Shell::GetScreen()->GetPrimaryDisplay(); | 236 const gfx::Display& display = gfx::Screen::GetScreen()->GetPrimaryDisplay(); |
237 SetDisplayResolutionAndNotify(display, gfx::Size(200, 200)); | 237 SetDisplayResolutionAndNotify(display, gfx::Size(200, 200)); |
238 EXPECT_TRUE(IsNotificationVisible()); | 238 EXPECT_TRUE(IsNotificationVisible()); |
239 | 239 |
240 // If there's a single display only, it will have timeout and the first button | 240 // If there's a single display only, it will have timeout and the first button |
241 // becomes accept. | 241 // becomes accept. |
242 EXPECT_TRUE(controller()->DoesNotificationTimeout()); | 242 EXPECT_TRUE(controller()->DoesNotificationTimeout()); |
243 ClickOnNotificationButton(0); | 243 ClickOnNotificationButton(0); |
244 EXPECT_FALSE(IsNotificationVisible()); | 244 EXPECT_FALSE(IsNotificationVisible()); |
245 EXPECT_EQ(1, accept_count()); | 245 EXPECT_EQ(1, accept_count()); |
246 DisplayMode mode; | 246 DisplayMode mode; |
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
291 RunAllPendingInMessageLoop(); | 291 RunAllPendingInMessageLoop(); |
292 EXPECT_FALSE(IsNotificationVisible()); | 292 EXPECT_FALSE(IsNotificationVisible()); |
293 EXPECT_EQ(1, accept_count()); | 293 EXPECT_EQ(1, accept_count()); |
294 } | 294 } |
295 | 295 |
296 TEST_F(ResolutionNotificationControllerTest, Timeout) { | 296 TEST_F(ResolutionNotificationControllerTest, Timeout) { |
297 if (!SupportsMultipleDisplays()) | 297 if (!SupportsMultipleDisplays()) |
298 return; | 298 return; |
299 | 299 |
300 UpdateDisplay("300x300#300x300%59|200x200%60"); | 300 UpdateDisplay("300x300#300x300%59|200x200%60"); |
301 const gfx::Display& display = ash::Shell::GetScreen()->GetPrimaryDisplay(); | 301 const gfx::Display& display = gfx::Screen::GetScreen()->GetPrimaryDisplay(); |
302 SetDisplayResolutionAndNotify(display, gfx::Size(200, 200)); | 302 SetDisplayResolutionAndNotify(display, gfx::Size(200, 200)); |
303 | 303 |
304 for (int i = 0; i < ResolutionNotificationController::kTimeoutInSec; ++i) { | 304 for (int i = 0; i < ResolutionNotificationController::kTimeoutInSec; ++i) { |
305 EXPECT_TRUE(IsNotificationVisible()) << "notification is closed after " | 305 EXPECT_TRUE(IsNotificationVisible()) << "notification is closed after " |
306 << i << "-th timer tick"; | 306 << i << "-th timer tick"; |
307 TickTimer(); | 307 TickTimer(); |
308 RunAllPendingInMessageLoop(); | 308 RunAllPendingInMessageLoop(); |
309 } | 309 } |
310 EXPECT_FALSE(IsNotificationVisible()); | 310 EXPECT_FALSE(IsNotificationVisible()); |
311 EXPECT_EQ(0, accept_count()); | 311 EXPECT_EQ(0, accept_count()); |
(...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
414 ClickOnNotificationButton(0); | 414 ClickOnNotificationButton(0); |
415 RunAllPendingInMessageLoop(); | 415 RunAllPendingInMessageLoop(); |
416 EXPECT_FALSE(IsNotificationVisible()); | 416 EXPECT_FALSE(IsNotificationVisible()); |
417 EXPECT_EQ(0, accept_count()); | 417 EXPECT_EQ(0, accept_count()); |
418 EXPECT_TRUE(display_manager->GetSelectedModeForDisplayId(id2, &mode)); | 418 EXPECT_TRUE(display_manager->GetSelectedModeForDisplayId(id2, &mode)); |
419 EXPECT_EQ("250x250", mode.size.ToString()); | 419 EXPECT_EQ("250x250", mode.size.ToString()); |
420 EXPECT_EQ(58.0f, mode.refresh_rate); | 420 EXPECT_EQ(58.0f, mode.refresh_rate); |
421 } | 421 } |
422 | 422 |
423 } // namespace ash | 423 } // namespace ash |
OLD | NEW |