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

Side by Side Diff: content/common/sandbox_mac_fontloading_unittest.mm

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
« no previous file with comments | « content/common/plugin_list_posix.cc ('k') | content/renderer/dom_serializer_browsertest.cc » ('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 #import <Cocoa/Cocoa.h> 5 #import <Cocoa/Cocoa.h>
6 6
7 #include "base/file_util.h" 7 #include "base/file_util.h"
8 #include "base/logging.h" 8 #include "base/logging.h"
9 #include "base/mac/scoped_cftyperef.h" 9 #include "base/mac/scoped_cftyperef.h"
10 #include "base/memory/scoped_ptr.h" 10 #include "base/memory/scoped_ptr.h"
(...skipping 13 matching lines...) Expand all
24 private: 24 private:
25 scoped_ptr<base::SharedMemory> font_shmem_; 25 scoped_ptr<base::SharedMemory> font_shmem_;
26 size_t font_data_length_; 26 size_t font_data_length_;
27 }; 27 };
28 REGISTER_SANDBOX_TEST_CASE(FontLoadingTestCase); 28 REGISTER_SANDBOX_TEST_CASE(FontLoadingTestCase);
29 29
30 30
31 // Load raw font data into shared memory object. 31 // Load raw font data into shared memory object.
32 bool FontLoadingTestCase::BeforeSandboxInit() { 32 bool FontLoadingTestCase::BeforeSandboxInit() {
33 std::string font_data; 33 std::string font_data;
34 if (!file_util::ReadFileToString(base::FilePath(test_data_.c_str()), 34 if (!base::ReadFileToString(base::FilePath(test_data_.c_str()), &font_data)) {
35 &font_data)) {
36 LOG(ERROR) << "Failed to read font data from file (" << test_data_ << ")"; 35 LOG(ERROR) << "Failed to read font data from file (" << test_data_ << ")";
37 return false; 36 return false;
38 } 37 }
39 38
40 font_data_length_ = font_data.length(); 39 font_data_length_ = font_data.length();
41 if (font_data_length_ <= 0) { 40 if (font_data_length_ <= 0) {
42 LOG(ERROR) << "No font data: " << font_data_length_; 41 LOG(ERROR) << "No font data: " << font_data_length_;
43 return false; 42 return false;
44 } 43 }
45 44
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after
119 static_cast<const char *>(result.font_data.memory()), 118 static_cast<const char *>(result.font_data.memory()),
120 result.font_data_size); 119 result.font_data_size);
121 120
122 ASSERT_TRUE(RunTestInSandbox(SANDBOX_TYPE_RENDERER, 121 ASSERT_TRUE(RunTestInSandbox(SANDBOX_TYPE_RENDERER,
123 "FontLoadingTestCase", temp_file_path.value().c_str())); 122 "FontLoadingTestCase", temp_file_path.value().c_str()));
124 temp_file_closer.reset(); 123 temp_file_closer.reset();
125 ASSERT_TRUE(base::DeleteFile(temp_file_path, false)); 124 ASSERT_TRUE(base::DeleteFile(temp_file_path, false));
126 } 125 }
127 126
128 } // namespace content 127 } // namespace content
OLDNEW
« no previous file with comments | « content/common/plugin_list_posix.cc ('k') | content/renderer/dom_serializer_browsertest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698