OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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/scoped_cftyperef.h" | 9 #include "base/mac/scoped_cftyperef.h" |
10 #include "base/scoped_ptr.h" | 10 #include "base/scoped_ptr.h" |
11 #include "base/shared_memory.h" | 11 #include "base/shared_memory.h" |
12 #include "chrome/common/font_loader_mac.h" | 12 #include "chrome/common/font_loader_mac.h" |
13 #include "chrome/common/sandbox_mac_unittest_helper.h" | 13 #include "chrome/common/sandbox_mac_unittest_helper.h" |
14 #include "testing/gtest/include/gtest/gtest.h" | 14 #include "testing/gtest/include/gtest/gtest.h" |
15 | 15 |
16 namespace { | 16 namespace { |
17 | 17 |
18 using sandboxtest::MacSandboxTest; | 18 using sandboxtest::MacSandboxTest; |
19 | 19 |
(...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
129 CGFontRef font_ref; | 129 CGFontRef font_ref; |
130 if (!CGFontFromFontContainer(font_container, &font_ref)) { | 130 if (!CGFontFromFontContainer(font_container, &font_ref)) { |
131 LOG(ERROR) << "CGFontFromFontContainer failed"; | 131 LOG(ERROR) << "CGFontFromFontContainer failed"; |
132 return false; | 132 return false; |
133 } | 133 } |
134 | 134 |
135 if (!font_ref) { | 135 if (!font_ref) { |
136 LOG(ERROR) << "Got NULL CGFontRef"; | 136 LOG(ERROR) << "Got NULL CGFontRef"; |
137 return false; | 137 return false; |
138 } | 138 } |
139 scoped_cftyperef<CGFontRef> cgfont; | 139 base::mac::ScopedCFTypeRef<CGFontRef> cgfont; |
140 cgfont.reset(font_ref); | 140 cgfont.reset(font_ref); |
141 | 141 |
142 const NSFont* nsfont = reinterpret_cast<const NSFont*>( | 142 const NSFont* nsfont = reinterpret_cast<const NSFont*>( |
143 CTFontCreateWithGraphicsFont(cgfont.get(), 16.0, | 143 CTFontCreateWithGraphicsFont(cgfont.get(), 16.0, |
144 NULL, NULL)); | 144 NULL, NULL)); |
145 if (!nsfont) { | 145 if (!nsfont) { |
146 LOG(ERROR) << "CTFontCreateWithGraphicsFont() failed"; | 146 LOG(ERROR) << "CTFontCreateWithGraphicsFont() failed"; |
147 return false; | 147 return false; |
148 } | 148 } |
149 | 149 |
(...skipping 24 matching lines...) Expand all Loading... |
174 file_util::WriteFileDescriptor(fileno(temp_file), | 174 file_util::WriteFileDescriptor(fileno(temp_file), |
175 static_cast<const char *>(font_data.memory()), font_data_size); | 175 static_cast<const char *>(font_data.memory()), font_data_size); |
176 | 176 |
177 ASSERT_TRUE(RunTestInSandbox(sandbox::SANDBOX_TYPE_RENDERER, | 177 ASSERT_TRUE(RunTestInSandbox(sandbox::SANDBOX_TYPE_RENDERER, |
178 "FontLoadingTestCase", temp_file_path.value().c_str())); | 178 "FontLoadingTestCase", temp_file_path.value().c_str())); |
179 temp_file_closer.reset(); | 179 temp_file_closer.reset(); |
180 ASSERT_TRUE(file_util::Delete(temp_file_path, false)); | 180 ASSERT_TRUE(file_util::Delete(temp_file_path, false)); |
181 } | 181 } |
182 | 182 |
183 } // namespace | 183 } // namespace |
OLD | NEW |