| 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 <string> | 5 #include <string> |
| 6 #include <vector> | 6 #include <vector> |
| 7 | 7 |
| 8 #include "ash/desktop_background/desktop_background_controller.h" | 8 #include "ash/desktop_background/desktop_background_controller.h" |
| 9 #include "ash/desktop_background/desktop_background_controller_observer.h" | 9 #include "ash/desktop_background/desktop_background_controller_observer.h" |
| 10 #include "ash/shell.h" | 10 #include "ash/shell.h" |
| (...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 81 // Compute the average ARGB color of |bitmap|. | 81 // Compute the average ARGB color of |bitmap|. |
| 82 SkColor ComputeAverageColor(const SkBitmap& bitmap) { | 82 SkColor ComputeAverageColor(const SkBitmap& bitmap) { |
| 83 if (bitmap.empty() || bitmap.width() < 1 || bitmap.height() < 1) { | 83 if (bitmap.empty() || bitmap.width() < 1 || bitmap.height() < 1) { |
| 84 ADD_FAILURE() << "Empty or invalid bitmap."; | 84 ADD_FAILURE() << "Empty or invalid bitmap."; |
| 85 return SkColorSetARGB(0, 0, 0, 0); | 85 return SkColorSetARGB(0, 0, 0, 0); |
| 86 } | 86 } |
| 87 if (bitmap.isNull()) { | 87 if (bitmap.isNull()) { |
| 88 ADD_FAILURE() << "Bitmap has no pixelref."; | 88 ADD_FAILURE() << "Bitmap has no pixelref."; |
| 89 return SkColorSetARGB(0, 0, 0, 0); | 89 return SkColorSetARGB(0, 0, 0, 0); |
| 90 } | 90 } |
| 91 if (bitmap.config() == SkBitmap::kNo_Config) { | 91 if (bitmap.colorType() == kUnknown_SkColorType) { |
| 92 ADD_FAILURE() << "Bitmap has not been configured."; | 92 ADD_FAILURE() << "Bitmap has not been configured."; |
| 93 return SkColorSetARGB(0, 0, 0, 0); | 93 return SkColorSetARGB(0, 0, 0, 0); |
| 94 } | 94 } |
| 95 uint64 a = 0, r = 0, g = 0, b = 0; | 95 uint64 a = 0, r = 0, g = 0, b = 0; |
| 96 bitmap.lockPixels(); | 96 bitmap.lockPixels(); |
| 97 for (int x = 0; x < bitmap.width(); ++x) { | 97 for (int x = 0; x < bitmap.width(); ++x) { |
| 98 for (int y = 0; y < bitmap.height(); ++y) { | 98 for (int y = 0; y < bitmap.height(); ++y) { |
| 99 const SkColor color = bitmap.getColor(x, y); | 99 const SkColor color = bitmap.getColor(x, y); |
| 100 a += SkColorGetA(color); | 100 a += SkColorGetA(color); |
| 101 r += SkColorGetR(color); | 101 r += SkColorGetR(color); |
| (...skipping 296 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 398 | 398 |
| 399 IN_PROC_BROWSER_TEST_F(WallpaperManagerPolicyTest, PersistOverLogout) { | 399 IN_PROC_BROWSER_TEST_F(WallpaperManagerPolicyTest, PersistOverLogout) { |
| 400 LoginUser(kTestUsers[0]); | 400 LoginUser(kTestUsers[0]); |
| 401 | 401 |
| 402 // Wait until wallpaper has been loaded. | 402 // Wait until wallpaper has been loaded. |
| 403 RunUntilWallpaperChangeCount(1); | 403 RunUntilWallpaperChangeCount(1); |
| 404 ASSERT_EQ(kRedImageColor, GetAverageBackgroundColor()); | 404 ASSERT_EQ(kRedImageColor, GetAverageBackgroundColor()); |
| 405 } | 405 } |
| 406 | 406 |
| 407 } // namespace chromeos | 407 } // namespace chromeos |
| OLD | NEW |