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

Unified Diff: chrome/browser/chromeos/login/user_image_manager_test_util.cc

Issue 286933002: [cros login] Split login related classes into subfolders. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fix includes in new tests Created 6 years, 7 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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/chromeos/login/user_image_manager_test_util.cc
diff --git a/chrome/browser/chromeos/login/user_image_manager_test_util.cc b/chrome/browser/chromeos/login/user_image_manager_test_util.cc
deleted file mode 100644
index ce64d200c01a3aa75d71694d30f4f81bbba4340f..0000000000000000000000000000000000000000
--- a/chrome/browser/chromeos/login/user_image_manager_test_util.cc
+++ /dev/null
@@ -1,77 +0,0 @@
-// Copyright 2013 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#include "chrome/browser/chromeos/login/user_image_manager_test_util.h"
-
-#include <string>
-
-#include "base/file_util.h"
-#include "base/memory/ref_counted.h"
-#include "base/message_loop/message_loop_proxy.h"
-#include "third_party/skia/include/core/SkBitmap.h"
-#include "ui/gfx/image/image_skia.h"
-#include "ui/gfx/image/image_skia_rep.h"
-
-namespace chromeos {
-namespace test {
-
-const char kUserAvatarImage1RelativePath[] = "chromeos/avatar1.jpg";
-const char kUserAvatarImage2RelativePath[] = "chromeos/avatar2.jpg";
-
-bool AreImagesEqual(const gfx::ImageSkia& first, const gfx::ImageSkia& second) {
- if (first.width() != second.width() || first.height() != second.height())
- return false;
- const SkBitmap* first_bitmap = first.bitmap();
- const SkBitmap* second_bitmap = second.bitmap();
- if (!first_bitmap && !second_bitmap)
- return true;
- if (!first_bitmap || !second_bitmap)
- return false;
-
- const size_t size = first_bitmap->getSize();
- if (second_bitmap->getSize() != size)
- return false;
-
- SkAutoLockPixels first_pixel_lock(*first_bitmap);
- SkAutoLockPixels second_pixel_lock(*second_bitmap);
- uint8_t* first_data = reinterpret_cast<uint8_t*>(first_bitmap->getPixels());
- uint8_t* second_data = reinterpret_cast<uint8_t*>(second_bitmap->getPixels());
- for (size_t i = 0; i < size; ++i) {
- if (first_data[i] != second_data[i])
- return false;
- }
- return true;
-}
-
-ImageLoader::ImageLoader(const base::FilePath& path) : path_(path) {
-}
-
-ImageLoader::~ImageLoader() {
-}
-
-scoped_ptr<gfx::ImageSkia> ImageLoader::Load() {
- std::string image_data;
- ReadFileToString(path_, &image_data);
- scoped_refptr<ImageDecoder> image_decoder = new ImageDecoder(
- this,
- image_data,
- ImageDecoder::ROBUST_JPEG_CODEC);
- image_decoder->Start(base::MessageLoopProxy::current());
- run_loop_.Run();
- return decoded_image_.Pass();
-}
-
-void ImageLoader::OnImageDecoded(const ImageDecoder* decoder,
- const SkBitmap& decoded_image) {
- decoded_image_.reset(
- new gfx::ImageSkia(gfx::ImageSkiaRep(decoded_image, 1.0f)));
- run_loop_.Quit();
-}
-
-void ImageLoader::OnDecodeImageFailed(const ImageDecoder* decoder) {
- run_loop_.Quit();
-}
-
-} // namespace test
-} // namespace chromeos
« no previous file with comments | « chrome/browser/chromeos/login/user_image_manager_test_util.h ('k') | chrome/browser/chromeos/login/user_image_sync_observer.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698