OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 144 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
155 } | 155 } |
156 | 156 |
157 TEST_F(MacSandboxTest, FontLoadingTest) { | 157 TEST_F(MacSandboxTest, FontLoadingTest) { |
158 FilePath temp_file_path; | 158 FilePath temp_file_path; |
159 FILE* temp_file = file_util::CreateAndOpenTemporaryFile(&temp_file_path); | 159 FILE* temp_file = file_util::CreateAndOpenTemporaryFile(&temp_file_path); |
160 ASSERT_TRUE(temp_file); | 160 ASSERT_TRUE(temp_file); |
161 file_util::ScopedFILE temp_file_closer(temp_file); | 161 file_util::ScopedFILE temp_file_closer(temp_file); |
162 | 162 |
163 base::SharedMemory font_data; | 163 base::SharedMemory font_data; |
164 uint32 font_data_size; | 164 uint32 font_data_size; |
| 165 uint32 font_id; |
165 NSFont* srcFont = [NSFont fontWithName:@"Geeza Pro" size:16.0]; | 166 NSFont* srcFont = [NSFont fontWithName:@"Geeza Pro" size:16.0]; |
166 EXPECT_TRUE(FontLoader::LoadFontIntoBuffer(srcFont, | 167 EXPECT_TRUE(FontLoader::LoadFontIntoBuffer(srcFont, |
167 &font_data, &font_data_size)); | 168 &font_data, &font_data_size, &font_id)); |
168 EXPECT_GT(font_data_size, 0U); | 169 EXPECT_GT(font_data_size, 0U); |
| 170 EXPECT_GT(font_id, 0U); |
169 | 171 |
170 file_util::WriteFileDescriptor(fileno(temp_file), | 172 file_util::WriteFileDescriptor(fileno(temp_file), |
171 static_cast<const char *>(font_data.memory()), font_data_size); | 173 static_cast<const char *>(font_data.memory()), font_data_size); |
172 | 174 |
173 ASSERT_TRUE(RunTestInSandbox(Sandbox::SANDBOX_TYPE_RENDERER, | 175 ASSERT_TRUE(RunTestInSandbox(Sandbox::SANDBOX_TYPE_RENDERER, |
174 "FontLoadingTestCase", temp_file_path.value().c_str())); | 176 "FontLoadingTestCase", temp_file_path.value().c_str())); |
175 temp_file_closer.reset(); | 177 temp_file_closer.reset(); |
176 ASSERT_TRUE(file_util::Delete(temp_file_path, false)); | 178 ASSERT_TRUE(file_util::Delete(temp_file_path, false)); |
177 } | 179 } |
178 | 180 |
179 } // namespace | 181 } // namespace |
OLD | NEW |