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

Side by Side Diff: chrome/browser/extensions/extension_action_icon_factory_unittest.cc

Issue 19579005: Move ReadFileToString to the base namespace. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 3 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/extensions/extension_action_icon_factory.h" 5 #include "chrome/browser/extensions/extension_action_icon_factory.h"
6 6
7 #include "base/command_line.h" 7 #include "base/command_line.h"
8 #include "base/file_util.h" 8 #include "base/file_util.h"
9 #include "base/json/json_file_value_serializer.h" 9 #include "base/json/json_file_value_serializer.h"
10 #include "base/message_loop/message_loop.h" 10 #include "base/message_loop/message_loop.h"
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
63 bitmap.eraseColor(SkColorSetARGB(0, 0, 0, 0)); 63 bitmap.eraseColor(SkColorSetARGB(0, 0, 0, 0));
64 return gfx::ImageSkiaRep(bitmap, scale_factor); 64 return gfx::ImageSkiaRep(bitmap, scale_factor);
65 } 65 }
66 66
67 gfx::Image LoadIcon(const std::string& filename) { 67 gfx::Image LoadIcon(const std::string& filename) {
68 base::FilePath path; 68 base::FilePath path;
69 PathService::Get(chrome::DIR_TEST_DATA, &path); 69 PathService::Get(chrome::DIR_TEST_DATA, &path);
70 path = path.AppendASCII("extensions/api_test").AppendASCII(filename); 70 path = path.AppendASCII("extensions/api_test").AppendASCII(filename);
71 71
72 std::string file_contents; 72 std::string file_contents;
73 file_util::ReadFileToString(path, &file_contents); 73 base::ReadFileToString(path, &file_contents);
74 const unsigned char* data = 74 const unsigned char* data =
75 reinterpret_cast<const unsigned char*>(file_contents.data()); 75 reinterpret_cast<const unsigned char*>(file_contents.data());
76 76
77 SkBitmap bitmap; 77 SkBitmap bitmap;
78 gfx::PNGCodec::Decode(data, file_contents.length(), &bitmap); 78 gfx::PNGCodec::Decode(data, file_contents.length(), &bitmap);
79 79
80 return gfx::Image::CreateFrom1xBitmap(bitmap); 80 return gfx::Image::CreateFrom1xBitmap(bitmap);
81 } 81 }
82 82
83 class ExtensionActionIconFactoryTest 83 class ExtensionActionIconFactoryTest
(...skipping 209 matching lines...) Expand 10 before | Expand all | Expand 10 after
293 icon = icon_factory.GetIcon(1); 293 icon = icon_factory.GetIcon(1);
294 294
295 EXPECT_TRUE(ImageRepsAreEqual( 295 EXPECT_TRUE(ImageRepsAreEqual(
296 default_icon.ToImageSkia()->GetRepresentation(ui::SCALE_FACTOR_100P), 296 default_icon.ToImageSkia()->GetRepresentation(ui::SCALE_FACTOR_100P),
297 icon.ToImageSkia()->GetRepresentation(ui::SCALE_FACTOR_100P))); 297 icon.ToImageSkia()->GetRepresentation(ui::SCALE_FACTOR_100P)));
298 298
299 } 299 }
300 300
301 } // namespace 301 } // namespace
302 } // namespace extensions 302 } // namespace extensions
OLDNEW
« no previous file with comments | « chrome/browser/extensions/convert_web_app_unittest.cc ('k') | chrome/browser/extensions/extension_browsertest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698