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/desktop_background/desktop_background_controller.h" | 5 #include "ash/desktop_background/desktop_background_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" |
(...skipping 197 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
208 const int kQuality = 80; | 208 const int kQuality = 80; |
209 std::vector<unsigned char> output; | 209 std::vector<unsigned char> output; |
210 if (!gfx::JPEGCodec::Encode( | 210 if (!gfx::JPEGCodec::Encode( |
211 static_cast<const unsigned char*>(bitmap.getPixels()), | 211 static_cast<const unsigned char*>(bitmap.getPixels()), |
212 gfx::JPEGCodec::FORMAT_SkBitmap, width, height, bitmap.rowBytes(), | 212 gfx::JPEGCodec::FORMAT_SkBitmap, width, height, bitmap.rowBytes(), |
213 kQuality, &output)) { | 213 kQuality, &output)) { |
214 LOG(ERROR) << "Unable to encode " << width << "x" << height << " bitmap"; | 214 LOG(ERROR) << "Unable to encode " << width << "x" << height << " bitmap"; |
215 return false; | 215 return false; |
216 } | 216 } |
217 | 217 |
218 size_t bytes_written = file_util::WriteFile( | 218 size_t bytes_written = base::WriteFile( |
219 path, reinterpret_cast<const char*>(&output[0]), output.size()); | 219 path, reinterpret_cast<const char*>(&output[0]), output.size()); |
220 if (bytes_written != output.size()) { | 220 if (bytes_written != output.size()) { |
221 LOG(ERROR) << "Wrote " << bytes_written << " byte(s) instead of " | 221 LOG(ERROR) << "Wrote " << bytes_written << " byte(s) instead of " |
222 << output.size() << " to " << path.value(); | 222 << output.size() << " to " << path.value(); |
223 return false; | 223 return false; |
224 } | 224 } |
225 | 225 |
226 return true; | 226 return true; |
227 } | 227 } |
228 | 228 |
(...skipping 458 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
687 // new load task was started (since the previous one was interrupted by | 687 // new load task was started (since the previous one was interrupted by |
688 // SetCustomWallpaper()). See http://crbug.com/327443. | 688 // SetCustomWallpaper()). See http://crbug.com/327443. |
689 TestObserver observer(controller_); | 689 TestObserver observer(controller_); |
690 ASSERT_TRUE(controller_->SetDefaultWallpaper(false)); | 690 ASSERT_TRUE(controller_->SetDefaultWallpaper(false)); |
691 observer.WaitForWallpaperDataChanged(); | 691 observer.WaitForWallpaperDataChanged(); |
692 EXPECT_TRUE(ImageIsNearColor(controller_->GetWallpaper(), | 692 EXPECT_TRUE(ImageIsNearColor(controller_->GetWallpaper(), |
693 kSmallWallpaperColor)); | 693 kSmallWallpaperColor)); |
694 } | 694 } |
695 | 695 |
696 } // namespace ash | 696 } // namespace ash |
OLD | NEW |