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

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

Issue 196073002: Move ScopedFILE to base namespace and scoped_file.h (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 9 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 #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/files/scoped_file.h"
8 #include "base/logging.h" 9 #include "base/logging.h"
9 #include "base/mac/scoped_cftyperef.h" 10 #include "base/mac/scoped_cftyperef.h"
10 #include "base/memory/scoped_ptr.h" 11 #include "base/memory/scoped_ptr.h"
11 #include "base/memory/shared_memory.h" 12 #include "base/memory/shared_memory.h"
12 #include "content/common/mac/font_descriptor.h" 13 #include "content/common/mac/font_descriptor.h"
13 #include "content/common/mac/font_loader.h" 14 #include "content/common/mac/font_loader.h"
14 #include "content/common/sandbox_mac_unittest_helper.h" 15 #include "content/common/sandbox_mac_unittest_helper.h"
15 #include "testing/gtest/include/gtest/gtest.h" 16 #include "testing/gtest/include/gtest/gtest.h"
16 17
17 namespace content { 18 namespace content {
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after
98 return false; 99 return false;
99 } 100 }
100 101
101 return true; 102 return true;
102 } 103 }
103 104
104 TEST_F(MacSandboxTest, FontLoadingTest) { 105 TEST_F(MacSandboxTest, FontLoadingTest) {
105 base::FilePath temp_file_path; 106 base::FilePath temp_file_path;
106 FILE* temp_file = base::CreateAndOpenTemporaryFile(&temp_file_path); 107 FILE* temp_file = base::CreateAndOpenTemporaryFile(&temp_file_path);
107 ASSERT_TRUE(temp_file); 108 ASSERT_TRUE(temp_file);
108 file_util::ScopedFILE temp_file_closer(temp_file); 109 base::ScopedFILE temp_file_closer(temp_file);
109 110
110 NSFont* srcFont = [NSFont fontWithName:@"Geeza Pro" size:16.0]; 111 NSFont* srcFont = [NSFont fontWithName:@"Geeza Pro" size:16.0];
111 FontDescriptor descriptor(srcFont); 112 FontDescriptor descriptor(srcFont);
112 FontLoader::Result result; 113 FontLoader::Result result;
113 FontLoader::LoadFont(descriptor, &result); 114 FontLoader::LoadFont(descriptor, &result);
114 EXPECT_GT(result.font_data_size, 0U); 115 EXPECT_GT(result.font_data_size, 0U);
115 EXPECT_GT(result.font_id, 0U); 116 EXPECT_GT(result.font_id, 0U);
116 117
117 base::WriteFileDescriptor(fileno(temp_file), 118 base::WriteFileDescriptor(fileno(temp_file),
118 static_cast<const char *>(result.font_data.memory()), 119 static_cast<const char *>(result.font_data.memory()),
119 result.font_data_size); 120 result.font_data_size);
120 121
121 ASSERT_TRUE(RunTestInSandbox(SANDBOX_TYPE_RENDERER, 122 ASSERT_TRUE(RunTestInSandbox(SANDBOX_TYPE_RENDERER,
122 "FontLoadingTestCase", temp_file_path.value().c_str())); 123 "FontLoadingTestCase", temp_file_path.value().c_str()));
123 temp_file_closer.reset(); 124 temp_file_closer.reset();
124 ASSERT_TRUE(base::DeleteFile(temp_file_path, false)); 125 ASSERT_TRUE(base::DeleteFile(temp_file_path, false));
125 } 126 }
126 127
127 } // namespace content 128 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/renderer_host/media/video_capture_host_unittest.cc ('k') | media/cast/test/sender.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698