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

Side by Side Diff: chrome/browser/chromeos/login/wallpaper_manager_browsertest.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
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 "chrome/browser/chromeos/login/wallpaper_manager.h" 5 #include "chrome/browser/chromeos/login/wallpaper_manager.h"
6 6
7 #include "ash/ash_resources/grit/ash_resources.h" 7 #include "ash/ash_resources/grit/ash_resources.h"
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/display/display_manager.h" 10 #include "ash/display/display_manager.h"
(...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after
123 UserManager::Get()->UserLoggedIn(username, username_hash, false); 123 UserManager::Get()->UserLoggedIn(username, username_hash, false);
124 WaitAsyncWallpaperLoadStarted(); 124 WaitAsyncWallpaperLoadStarted();
125 } 125 }
126 126
127 // Saves bitmap |resource_id| to disk. 127 // Saves bitmap |resource_id| to disk.
128 void SaveUserWallpaperData(const base::FilePath& wallpaper_path, 128 void SaveUserWallpaperData(const base::FilePath& wallpaper_path,
129 int resource_id) { 129 int resource_id) {
130 scoped_refptr<base::RefCountedStaticMemory> image_data( 130 scoped_refptr<base::RefCountedStaticMemory> image_data(
131 ResourceBundle::GetSharedInstance().LoadDataResourceBytesForScale( 131 ResourceBundle::GetSharedInstance().LoadDataResourceBytesForScale(
132 resource_id, ui::SCALE_FACTOR_100P)); 132 resource_id, ui::SCALE_FACTOR_100P));
133 int written = file_util::WriteFile( 133 int written = base::WriteFile(
134 wallpaper_path, 134 wallpaper_path,
135 reinterpret_cast<const char*>(image_data->front()), 135 reinterpret_cast<const char*>(image_data->front()),
136 image_data->size()); 136 image_data->size());
137 EXPECT_EQ(static_cast<int>(image_data->size()), written); 137 EXPECT_EQ(static_cast<int>(image_data->size()), written);
138 } 138 }
139 139
140 int LoadedWallpapers() { 140 int LoadedWallpapers() {
141 return WallpaperManager::Get()->loaded_wallpapers(); 141 return WallpaperManager::Get()->loaded_wallpapers();
142 } 142 }
143 143
(...skipping 402 matching lines...) Expand 10 before | Expand all | Expand 10 after
546 EXPECT_TRUE(test_api->GetWallpaperFromCache(kTestUser1, &cached_wallpaper)); 546 EXPECT_TRUE(test_api->GetWallpaperFromCache(kTestUser1, &cached_wallpaper));
547 EXPECT_TRUE(cached_wallpaper.BackedBySameObjectAs(green_wallpaper)); 547 EXPECT_TRUE(cached_wallpaper.BackedBySameObjectAs(green_wallpaper));
548 548
549 wallpaper_manager->SetDefaultWallpaperNow(kTestUser1); 549 wallpaper_manager->SetDefaultWallpaperNow(kTestUser1);
550 WaitAsyncWallpaperLoadFinished(); 550 WaitAsyncWallpaperLoadFinished();
551 // SetDefaultWallpaper should invalidate the user's wallpaper cache. 551 // SetDefaultWallpaper should invalidate the user's wallpaper cache.
552 EXPECT_FALSE(test_api->GetWallpaperFromCache(kTestUser1, &cached_wallpaper)); 552 EXPECT_FALSE(test_api->GetWallpaperFromCache(kTestUser1, &cached_wallpaper));
553 } 553 }
554 554
555 } // namespace chromeos 555 } // namespace chromeos
OLDNEW
« no previous file with comments | « chrome/browser/chromeos/login/wallpaper_manager.cc ('k') | chrome/browser/chromeos/policy/device_policy_cros_browser_test.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698