| 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/common/wallpaper/wallpaper_controller.h" | 5 #include "ash/common/wallpaper/wallpaper_controller.h" |
| 6 | 6 |
| 7 #include <cmath> | 7 #include <cmath> |
| 8 #include <cstdlib> | 8 #include <cstdlib> |
| 9 | 9 |
| 10 #include "ash/common/wallpaper/wallpaper_view.h" | 10 #include "ash/common/wallpaper/wallpaper_view.h" |
| (...skipping 357 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 368 RunAllBlockingPoolTasksUntilIdle(WmShell::Get()->blocking_pool().get()); | 368 RunAllBlockingPoolTasksUntilIdle(WmShell::Get()->blocking_pool().get()); |
| 369 EXPECT_TRUE(resized_image.BackedBySameObjectAs(controller_->GetWallpaper())); | 369 EXPECT_TRUE(resized_image.BackedBySameObjectAs(controller_->GetWallpaper())); |
| 370 } | 370 } |
| 371 | 371 |
| 372 TEST_F(WallpaperControllerTest, GetMaxDisplaySize) { | 372 TEST_F(WallpaperControllerTest, GetMaxDisplaySize) { |
| 373 // Device scale factor shouldn't affect the native size. | 373 // Device scale factor shouldn't affect the native size. |
| 374 UpdateDisplay("1000x300*2"); | 374 UpdateDisplay("1000x300*2"); |
| 375 EXPECT_EQ("1000x300", | 375 EXPECT_EQ("1000x300", |
| 376 WallpaperController::GetMaxDisplaySizeInNative().ToString()); | 376 WallpaperController::GetMaxDisplaySizeInNative().ToString()); |
| 377 | 377 |
| 378 // Rotated display should return the rotated size. | 378 // TODO: mash doesn't support rotation yet, http://crbug.com/695556. |
| 379 UpdateDisplay("1000x300*2/r"); | 379 if (!WmShell::Get()->IsRunningInMash()) { |
| 380 EXPECT_EQ("300x1000", | 380 // Rotated display should return the rotated size. |
| 381 WallpaperController::GetMaxDisplaySizeInNative().ToString()); | 381 UpdateDisplay("1000x300*2/r"); |
| 382 EXPECT_EQ("300x1000", |
| 383 WallpaperController::GetMaxDisplaySizeInNative().ToString()); |
| 384 } |
| 382 | 385 |
| 383 // UI Scaling shouldn't affect the native size. | 386 // UI Scaling shouldn't affect the native size. |
| 384 UpdateDisplay("1000x300*2@1.5"); | 387 UpdateDisplay("1000x300*2@1.5"); |
| 385 EXPECT_EQ("1000x300", | 388 EXPECT_EQ("1000x300", |
| 386 WallpaperController::GetMaxDisplaySizeInNative().ToString()); | 389 WallpaperController::GetMaxDisplaySizeInNative().ToString()); |
| 387 | 390 |
| 388 // First display has maximum size. | 391 // First display has maximum size. |
| 389 UpdateDisplay("400x300,100x100"); | 392 UpdateDisplay("400x300,100x100"); |
| 390 EXPECT_EQ("400x300", | 393 EXPECT_EQ("400x300", |
| 391 WallpaperController::GetMaxDisplaySizeInNative().ToString()); | 394 WallpaperController::GetMaxDisplaySizeInNative().ToString()); |
| (...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 461 { | 464 { |
| 462 SCOPED_TRACE(base::StringPrintf("1200x600/u@1.5 low resolution")); | 465 SCOPED_TRACE(base::StringPrintf("1200x600/u@1.5 low resolution")); |
| 463 controller_->SetWallpaperImage(image_low_res, WALLPAPER_LAYOUT_CENTER); | 466 controller_->SetWallpaperImage(image_low_res, WALLPAPER_LAYOUT_CENTER); |
| 464 WallpaperFitToNativeResolution( | 467 WallpaperFitToNativeResolution( |
| 465 wallpaper_view(), low_dsf, low_resolution.width(), | 468 wallpaper_view(), low_dsf, low_resolution.width(), |
| 466 low_resolution.height(), kCustomWallpaperColor); | 469 low_resolution.height(), kCustomWallpaperColor); |
| 467 } | 470 } |
| 468 } | 471 } |
| 469 | 472 |
| 470 } // namespace ash | 473 } // namespace ash |
| OLD | NEW |