Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(144)

Side by Side Diff: ash/desktop_background/desktop_background_controller_unittest.cc

Issue 184563006: Move WriteFile and WriteFileDescriptor from file_util to base namespace. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | base/file_util.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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
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
OLDNEW
« no previous file with comments | « no previous file | base/file_util.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698