OLD | NEW |
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/wallpaper/wallpaper_controller.h" | 5 #include "ash/wallpaper/wallpaper_controller.h" |
6 | 6 |
7 #include <cmath> | 7 #include <cmath> |
8 #include <cstdlib> | 8 #include <cstdlib> |
9 | 9 |
10 #include "ash/ash_switches.h" | 10 #include "ash/ash_switches.h" |
| 11 #include "ash/public/cpp/config.h" |
11 #include "ash/public/cpp/shell_window_ids.h" | 12 #include "ash/public/cpp/shell_window_ids.h" |
12 #include "ash/root_window_controller.h" | 13 #include "ash/root_window_controller.h" |
13 #include "ash/session/session_controller.h" | 14 #include "ash/session/session_controller.h" |
14 #include "ash/shell.h" | 15 #include "ash/shell.h" |
15 #include "ash/shell_port.h" | 16 #include "ash/shell_port.h" |
16 #include "ash/test/ash_test_base.h" | 17 #include "ash/test/ash_test_base.h" |
17 #include "ash/test/test_session_controller_client.h" | 18 #include "ash/test/test_session_controller_client.h" |
18 #include "ash/test/test_wallpaper_delegate.h" | 19 #include "ash/test/test_wallpaper_delegate.h" |
19 #include "ash/wallpaper/wallpaper_view.h" | 20 #include "ash/wallpaper/wallpaper_view.h" |
20 #include "ash/wallpaper/wallpaper_widget_controller.h" | 21 #include "ash/wallpaper/wallpaper_widget_controller.h" |
(...skipping 376 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
397 EXPECT_TRUE(resized_image.BackedBySameObjectAs(controller_->GetWallpaper())); | 398 EXPECT_TRUE(resized_image.BackedBySameObjectAs(controller_->GetWallpaper())); |
398 } | 399 } |
399 | 400 |
400 TEST_F(WallpaperControllerTest, GetMaxDisplaySize) { | 401 TEST_F(WallpaperControllerTest, GetMaxDisplaySize) { |
401 // Device scale factor shouldn't affect the native size. | 402 // Device scale factor shouldn't affect the native size. |
402 UpdateDisplay("1000x300*2"); | 403 UpdateDisplay("1000x300*2"); |
403 EXPECT_EQ("1000x300", | 404 EXPECT_EQ("1000x300", |
404 WallpaperController::GetMaxDisplaySizeInNative().ToString()); | 405 WallpaperController::GetMaxDisplaySizeInNative().ToString()); |
405 | 406 |
406 // TODO: mash doesn't support rotation yet, http://crbug.com/695556. | 407 // TODO: mash doesn't support rotation yet, http://crbug.com/695556. |
407 if (!ShellPort::Get()->IsRunningInMash()) { | 408 if (Shell::GetAshConfig() != Config::MASH) { |
408 // Rotated display should return the rotated size. | 409 // Rotated display should return the rotated size. |
409 UpdateDisplay("1000x300*2/r"); | 410 UpdateDisplay("1000x300*2/r"); |
410 EXPECT_EQ("300x1000", | 411 EXPECT_EQ("300x1000", |
411 WallpaperController::GetMaxDisplaySizeInNative().ToString()); | 412 WallpaperController::GetMaxDisplaySizeInNative().ToString()); |
412 } | 413 } |
413 | 414 |
414 // UI Scaling shouldn't affect the native size. | 415 // UI Scaling shouldn't affect the native size. |
415 UpdateDisplay("1000x300*2@1.5"); | 416 UpdateDisplay("1000x300*2@1.5"); |
416 EXPECT_EQ("1000x300", | 417 EXPECT_EQ("1000x300", |
417 WallpaperController::GetMaxDisplaySizeInNative().ToString()); | 418 WallpaperController::GetMaxDisplaySizeInNative().ToString()); |
(...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
525 EXPECT_TRUE(ShouldCalculateColors()); | 526 EXPECT_TRUE(ShouldCalculateColors()); |
526 | 527 |
527 SetSessionState(SessionState::LOCKED); | 528 SetSessionState(SessionState::LOCKED); |
528 EXPECT_FALSE(ShouldCalculateColors()); | 529 EXPECT_FALSE(ShouldCalculateColors()); |
529 | 530 |
530 SetSessionState(SessionState::LOGIN_SECONDARY); | 531 SetSessionState(SessionState::LOGIN_SECONDARY); |
531 EXPECT_FALSE(ShouldCalculateColors()); | 532 EXPECT_FALSE(ShouldCalculateColors()); |
532 } | 533 } |
533 | 534 |
534 } // namespace ash | 535 } // namespace ash |
OLD | NEW |