| 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 354 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 365 EXPECT_EQ(gfx::Size(320, 200).ToString(), resized_image.size().ToString()); | 365 EXPECT_EQ(gfx::Size(320, 200).ToString(), resized_image.size().ToString()); |
| 366 | 366 |
| 367 // Load the original wallpaper again and check that we're still using the | 367 // Load the original wallpaper again and check that we're still using the |
| 368 // previously-resized image instead of doing another resize | 368 // previously-resized image instead of doing another resize |
| 369 // (http://crbug.com/321402). | 369 // (http://crbug.com/321402). |
| 370 controller_->SetWallpaperImage(image, WALLPAPER_LAYOUT_STRETCH); | 370 controller_->SetWallpaperImage(image, WALLPAPER_LAYOUT_STRETCH); |
| 371 RunAllBlockingPoolTasksUntilIdle(WmShell::Get()->blocking_pool().get()); | 371 RunAllBlockingPoolTasksUntilIdle(WmShell::Get()->blocking_pool().get()); |
| 372 EXPECT_TRUE(resized_image.BackedBySameObjectAs(controller_->GetWallpaper())); | 372 EXPECT_TRUE(resized_image.BackedBySameObjectAs(controller_->GetWallpaper())); |
| 373 } | 373 } |
| 374 | 374 |
| 375 #if defined(OS_WIN) && !defined(USE_ASH) | 375 TEST_F(WallpaperControllerTest, GetMaxDisplaySize) { |
| 376 // TODO(msw): Broken on Windows. http://crbug.com/584038 | |
| 377 #define MAYBE_GetMaxDisplaySize DISABLED_GetMaxDisplaySize | |
| 378 #else | |
| 379 #define MAYBE_GetMaxDisplaySize GetMaxDisplaySize | |
| 380 #endif | |
| 381 TEST_F(WallpaperControllerTest, MAYBE_GetMaxDisplaySize) { | |
| 382 // Device scale factor shouldn't affect the native size. | 376 // Device scale factor shouldn't affect the native size. |
| 383 UpdateDisplay("1000x300*2"); | 377 UpdateDisplay("1000x300*2"); |
| 384 EXPECT_EQ("1000x300", | 378 EXPECT_EQ("1000x300", |
| 385 WallpaperController::GetMaxDisplaySizeInNative().ToString()); | 379 WallpaperController::GetMaxDisplaySizeInNative().ToString()); |
| 386 | 380 |
| 387 // Rotated display should return the rotated size. | 381 // Rotated display should return the rotated size. |
| 388 UpdateDisplay("1000x300*2/r"); | 382 UpdateDisplay("1000x300*2/r"); |
| 389 EXPECT_EQ("300x1000", | 383 EXPECT_EQ("300x1000", |
| 390 WallpaperController::GetMaxDisplaySizeInNative().ToString()); | 384 WallpaperController::GetMaxDisplaySizeInNative().ToString()); |
| 391 | 385 |
| (...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 473 { | 467 { |
| 474 SCOPED_TRACE(base::StringPrintf("1200x600/u@1.5 low resolution")); | 468 SCOPED_TRACE(base::StringPrintf("1200x600/u@1.5 low resolution")); |
| 475 controller_->SetWallpaperImage(image_low_res, WALLPAPER_LAYOUT_CENTER); | 469 controller_->SetWallpaperImage(image_low_res, WALLPAPER_LAYOUT_CENTER); |
| 476 WallpaperFitToNativeResolution( | 470 WallpaperFitToNativeResolution( |
| 477 wallpaper_view(), low_dsf, low_resolution.width(), | 471 wallpaper_view(), low_dsf, low_resolution.width(), |
| 478 low_resolution.height(), kCustomWallpaperColor); | 472 low_resolution.height(), kCustomWallpaperColor); |
| 479 } | 473 } |
| 480 } | 474 } |
| 481 | 475 |
| 482 } // namespace ash | 476 } // namespace ash |
| OLD | NEW |